summaryrefslogtreecommitdiff
path: root/drivers/base/cpu.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <greg@kroah.com>2003-04-28 09:16:45 -0700
committerGreg Kroah-Hartman <greg@kroah.com>2003-04-28 09:16:45 -0700
commit0d120f58d2599d4e262ef216d7a06a32ca76548c (patch)
tree36963c5ba9b2215395367f9bf3e2f7b761d3ba2c /drivers/base/cpu.c
parent28926b3d45f4850f1d2d246a2c01b6d24fbd227c (diff)
driver core: fix up cpu.c, memblk.c, and node.c due to the class changes
Diffstat (limited to 'drivers/base/cpu.c')
-rw-r--r--drivers/base/cpu.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index a5d65dc4eff7..814fda5272f7 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -10,23 +10,16 @@
#include <asm/topology.h>
-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 @@ struct device_driver cpu_driver = {
*/
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 @@ int __init register_cpu(struct cpu *cpu, int num, struct node *root)
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 __init cpu_dev_init(void)
{
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;
}