cpu: convert 'cpu' and 'machinecheck' sysdev_class to a regular subsystem

This moves the 'cpu sysdev_class' over to a regular 'cpu' subsystem
and converts the devices to regular devices. The sysdev drivers are
implemented as subsystem interfaces now.

After all sysdev classes are ported to regular driver core entities, the
sysdev implementation will be entirely removed from the kernel.

Userspace relies on events and generic sysfs subsystem infrastructure
from sysdev devices, which are made available with this conversion.

Cc: Haavard Skinnemoen <[email protected]>
Cc: Hans-Christian Egtvedt <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Paul Mundt <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Chris Metcalf <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Tigran Aivazian <[email protected]>
Cc: Len Brown <[email protected]>
Cc: Zhang Rui <[email protected]>
Cc: Dave Jones <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Russell King <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Arjan van de Ven <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: "Srivatsa S. Bhat" <[email protected]>
Signed-off-by: Kay Sievers <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
Kay Sievers 2011-12-21 14:29:42 -08:00 • committed by Greg Kroah-Hartman
commit 8a25a2fd12
38 changed files with 874 additions and 877 deletions

View file

@ -13,7 +13,7 @@
#include <linux/init.h>
#include <linux/cpu.h>
#include <linux/bitmap.h>
#include <linux/sysdev.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
@ -337,9 +337,9 @@ static struct kobj_type ktype_percpu_entry = {
.default_attrs = sq_sysfs_attrs,
};
static int __devinit sq_sysdev_add(struct sys_device *sysdev)
static int __devinit sq_dev_add(struct device *dev)
{
unsigned int cpu = sysdev->id;
unsigned int cpu = dev->id;
struct kobject *kobj;
int error;
@ -348,25 +348,27 @@ static int __devinit sq_sysdev_add(struct sys_device *sysdev)
return -ENOMEM;
kobj = sq_kobject[cpu];
error = kobject_init_and_add(kobj, &ktype_percpu_entry, &sysdev->kobj,
error = kobject_init_and_add(kobj, &ktype_percpu_entry, &dev->kobj,
"%s", "sq");
if (!error)
kobject_uevent(kobj, KOBJ_ADD);
return error;
}
static int __devexit sq_sysdev_remove(struct sys_device *sysdev)
static int __devexit sq_dev_remove(struct device *dev)
{
unsigned int cpu = sysdev->id;
unsigned int cpu = dev->id;
struct kobject *kobj = sq_kobject[cpu];
kobject_put(kobj);
return 0;
}
static struct sysdev_driver sq_sysdev_driver = {
.add = sq_sysdev_add,
.remove = __devexit_p(sq_sysdev_remove),
static struct subsys_interface sq_interface = {
.name = "sq"
.subsys = &cpu_subsys,
.add_dev = sq_dev_add,
.remove_dev = __devexit_p(sq_dev_remove),
};
static int __init sq_api_init(void)
@ -386,7 +388,7 @@ static int __init sq_api_init(void)
if (unlikely(!sq_bitmap))
goto out;
ret = sysdev_driver_register(&cpu_sysdev_class, &sq_sysdev_driver);
ret = subsys_interface_register(&sq_interface);
if (unlikely(ret != 0))
goto out;
@ -401,7 +403,7 @@ out:
static void __exit sq_api_exit(void)
{
sysdev_driver_unregister(&cpu_sysdev_class, &sq_sysdev_driver);
subsys_interface_unregister(&sq_interface);
kfree(sq_bitmap);
kmem_cache_destroy(sq_cache);
}