Merge tag 'configfs-5.11' of git://git.infradead.org/users/hch/configfs
[linux-2.6-microblaze.git] / kernel / reboot.c
index 769ad55..eb1b158 100644 (file)
@@ -662,10 +662,35 @@ static ssize_t mode_store(struct kobject *kobj, struct kobj_attribute *attr,
        else
                return -EINVAL;
 
+       reboot_default = 0;
+
        return count;
 }
 static struct kobj_attribute reboot_mode_attr = __ATTR_RW(mode);
 
+#ifdef CONFIG_X86
+static ssize_t force_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
+{
+       return sprintf(buf, "%d\n", reboot_force);
+}
+static ssize_t force_store(struct kobject *kobj, struct kobj_attribute *attr,
+                         const char *buf, size_t count)
+{
+       bool res;
+
+       if (!capable(CAP_SYS_BOOT))
+               return -EPERM;
+
+       if (kstrtobool(buf, &res))
+               return -EINVAL;
+
+       reboot_default = 0;
+       reboot_force = res;
+
+       return count;
+}
+static struct kobj_attribute reboot_force_attr = __ATTR_RW(force);
+
 static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
 {
        const char *val;
@@ -716,10 +741,14 @@ static ssize_t type_store(struct kobject *kobj, struct kobj_attribute *attr,
        else
                return -EINVAL;
 
+       reboot_default = 0;
+
        return count;
 }
 static struct kobj_attribute reboot_type_attr = __ATTR_RW(type);
+#endif
 
+#ifdef CONFIG_SMP
 static ssize_t cpu_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
 {
        return sprintf(buf, "%d\n", reboot_cpu);
@@ -741,38 +770,23 @@ static ssize_t cpu_store(struct kobject *kobj, struct kobj_attribute *attr,
        if (cpunum >= num_possible_cpus())
                return -ERANGE;
 
+       reboot_default = 0;
        reboot_cpu = cpunum;
 
        return count;
 }
 static struct kobj_attribute reboot_cpu_attr = __ATTR_RW(cpu);
-
-static ssize_t force_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
-{
-       return sprintf(buf, "%d\n", reboot_force);
-}
-static ssize_t force_store(struct kobject *kobj, struct kobj_attribute *attr,
-                         const char *buf, size_t count)
-{
-       bool res;
-
-       if (!capable(CAP_SYS_BOOT))
-               return -EPERM;
-
-       if (kstrtobool(buf, &res))
-               return -EINVAL;
-
-       reboot_force = res;
-
-       return count;
-}
-static struct kobj_attribute reboot_force_attr = __ATTR_RW(force);
+#endif
 
 static struct attribute *reboot_attrs[] = {
        &reboot_mode_attr.attr,
+#ifdef CONFIG_X86
+       &reboot_force_attr.attr,
        &reboot_type_attr.attr,
+#endif
+#ifdef CONFIG_SMP
        &reboot_cpu_attr.attr,
-       &reboot_force_attr.attr,
+#endif
        NULL,
 };