]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/base/cpu.c
Merge tag 'pm+acpi-3.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[karo-tx-linux.git] / drivers / base / cpu.c
index 1d110dc6f0c1f371ac262a9f6e352b5d626bf2fa..a16d20e389f0f2fead522d97edee5f3c66bc9112 100644 (file)
@@ -102,7 +102,6 @@ static ssize_t cpu_release_store(struct device *dev,
 static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store);
 static DEVICE_ATTR(release, S_IWUSR, NULL, cpu_release_store);
 #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
-
 #endif /* CONFIG_HOTPLUG_CPU */
 
 struct bus_type cpu_subsys = {
@@ -151,7 +150,31 @@ static ssize_t show_crash_notes_size(struct device *dev,
        return rc;
 }
 static DEVICE_ATTR(crash_notes_size, 0400, show_crash_notes_size, NULL);
+
+static struct attribute *crash_note_cpu_attrs[] = {
+       &dev_attr_crash_notes.attr,
+       &dev_attr_crash_notes_size.attr,
+       NULL
+};
+
+static struct attribute_group crash_note_cpu_attr_group = {
+       .attrs = crash_note_cpu_attrs,
+};
+#endif
+
+static const struct attribute_group *common_cpu_attr_groups[] = {
+#ifdef CONFIG_KEXEC
+       &crash_note_cpu_attr_group,
+#endif
+       NULL
+};
+
+static const struct attribute_group *hotplugable_cpu_attr_groups[] = {
+#ifdef CONFIG_KEXEC
+       &crash_note_cpu_attr_group,
 #endif
+       NULL
+};
 
 /*
  * Print cpu online, possible, present, and system maps
@@ -269,19 +292,15 @@ int __cpuinit register_cpu(struct cpu *cpu, int num)
 #ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE
        cpu->dev.bus->uevent = arch_cpu_uevent;
 #endif
+       cpu->dev.groups = common_cpu_attr_groups;
+       if (cpu->hotpluggable)
+               cpu->dev.groups = hotplugable_cpu_attr_groups;
        error = device_register(&cpu->dev);
        if (!error)
                per_cpu(cpu_sys_devices, num) = &cpu->dev;
        if (!error)
                register_cpu_under_node(num, cpu_to_node(num));
 
-#ifdef CONFIG_KEXEC
-       if (!error)
-               error = device_create_file(&cpu->dev, &dev_attr_crash_notes);
-       if (!error)
-               error = device_create_file(&cpu->dev,
-                                          &dev_attr_crash_notes_size);
-#endif
        return error;
 }