ChangeSet 1.1158, 2003/04/28 23:16:45-07:00, greg@kroah.com driver core: fix up cpu.c, memblk.c, and node.c due to the class changes drivers/base/cpu.c | 29 ++++++++++++++++++----------- drivers/base/memblk.c | 14 ++++---------- drivers/base/node.c | 14 ++++---------- 3 files changed, 26 insertions(+), 31 deletions(-) diff -Nru a/drivers/base/cpu.c b/drivers/base/cpu.c --- a/drivers/base/cpu.c Tue Apr 29 09:48:10 2003 +++ b/drivers/base/cpu.c Tue Apr 29 09:48:10 2003 @@ -10,23 +10,16 @@ #include -static int cpu_add_device(struct device * dev) -{ - return 0; -} -struct device_class cpu_devclass = { +struct class cpu_class = { .name = "cpu", - .add_device = cpu_add_device, }; struct device_driver cpu_driver = { .name = "cpu", .bus = &system_bus_type, - .devclass = &cpu_devclass, }; - /* * register_cpu - Setup a driverfs device for a CPU. * @num - CPU number to use when creating the device. @@ -35,6 +28,8 @@ */ int __init register_cpu(struct cpu *cpu, int num, struct node *root) { + int retval; + cpu->node_id = cpu_to_node(num); cpu->sysdev.name = "cpu"; cpu->sysdev.id = num; @@ -42,7 +37,19 @@ cpu->sysdev.root = &root->sysroot; snprintf(cpu->sysdev.dev.name, DEVICE_NAME_SIZE, "CPU %u", num); cpu->sysdev.dev.driver = &cpu_driver; - return sys_device_register(&cpu->sysdev); + retval = sys_device_register(&cpu->sysdev); + if (retval) + return retval; + memset(&cpu->sysdev.class_dev, 0x00, sizeof(struct class_device)); + cpu->sysdev.class_dev.dev = &cpu->sysdev.dev; + cpu->sysdev.class_dev.class = &cpu_class; + snprintf(cpu->sysdev.class_dev.class_id, BUS_ID_SIZE, "cpu%d", num); + retval = class_device_register(&cpu->sysdev.class_dev); + if (retval) { + // FIXME cleanup sys_device_register + return retval; + } + return 0; } @@ -50,11 +57,11 @@ { int error; - error = devclass_register(&cpu_devclass); + error = class_register(&cpu_class); if (!error) { error = driver_register(&cpu_driver); if (error) - devclass_unregister(&cpu_devclass); + class_unregister(&cpu_class); } return error; } diff -Nru a/drivers/base/memblk.c b/drivers/base/memblk.c --- a/drivers/base/memblk.c Tue Apr 29 09:48:10 2003 +++ b/drivers/base/memblk.c Tue Apr 29 09:48:10 2003 @@ -11,20 +11,14 @@ #include -static int memblk_add_device(struct device * dev) -{ - return 0; -} -struct device_class memblk_devclass = { +static struct class memblk_class = { .name = "memblk", - .add_device = memblk_add_device, }; -struct device_driver memblk_driver = { +static struct device_driver memblk_driver = { .name = "memblk", .bus = &system_bus_type, - .devclass = &memblk_devclass, }; @@ -51,11 +45,11 @@ { int error; - error = devclass_register(&memblk_devclass); + error = class_register(&memblk_class); if (!error) { error = driver_register(&memblk_driver); if (error) - devclass_unregister(&memblk_devclass); + class_unregister(&memblk_class); } return error; } diff -Nru a/drivers/base/node.c b/drivers/base/node.c --- a/drivers/base/node.c Tue Apr 29 09:48:10 2003 +++ b/drivers/base/node.c Tue Apr 29 09:48:10 2003 @@ -11,20 +11,14 @@ #include -static int node_add_device(struct device * dev) -{ - return 0; -} -struct device_class node_devclass = { +static struct class node_class = { .name = "node", - .add_device = node_add_device, }; -struct device_driver node_driver = { +static struct device_driver node_driver = { .name = "node", .bus = &system_bus_type, - .devclass = &node_devclass, }; @@ -93,11 +87,11 @@ { int error; - error = devclass_register(&node_devclass); + error = class_register(&node_class); if (!error) { error = driver_register(&node_driver); if (error) - devclass_unregister(&node_devclass); + class_unregister(&node_class); } return error; }