Commit 0d120f58 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

driver core: fix up cpu.c, memblk.c, and node.c due to the class changes

parent 28926b3d
...@@ -10,23 +10,16 @@ ...@@ -10,23 +10,16 @@
#include <asm/topology.h> #include <asm/topology.h>
static int cpu_add_device(struct device * dev) struct class cpu_class = {
{
return 0;
}
struct device_class cpu_devclass = {
.name = "cpu", .name = "cpu",
.add_device = cpu_add_device,
}; };
struct device_driver cpu_driver = { struct device_driver cpu_driver = {
.name = "cpu", .name = "cpu",
.bus = &system_bus_type, .bus = &system_bus_type,
.devclass = &cpu_devclass,
}; };
/* /*
* register_cpu - Setup a driverfs device for a CPU. * register_cpu - Setup a driverfs device for a CPU.
* @num - CPU number to use when creating the device. * @num - CPU number to use when creating the device.
...@@ -35,6 +28,8 @@ struct device_driver cpu_driver = { ...@@ -35,6 +28,8 @@ struct device_driver cpu_driver = {
*/ */
int __init register_cpu(struct cpu *cpu, int num, struct node *root) int __init register_cpu(struct cpu *cpu, int num, struct node *root)
{ {
int retval;
cpu->node_id = cpu_to_node(num); cpu->node_id = cpu_to_node(num);
cpu->sysdev.name = "cpu"; cpu->sysdev.name = "cpu";
cpu->sysdev.id = num; cpu->sysdev.id = num;
...@@ -42,7 +37,19 @@ int __init register_cpu(struct cpu *cpu, int num, struct node *root) ...@@ -42,7 +37,19 @@ int __init register_cpu(struct cpu *cpu, int num, struct node *root)
cpu->sysdev.root = &root->sysroot; cpu->sysdev.root = &root->sysroot;
snprintf(cpu->sysdev.dev.name, DEVICE_NAME_SIZE, "CPU %u", num); snprintf(cpu->sysdev.dev.name, DEVICE_NAME_SIZE, "CPU %u", num);
cpu->sysdev.dev.driver = &cpu_driver; 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) ...@@ -50,11 +57,11 @@ int __init cpu_dev_init(void)
{ {
int error; int error;
error = devclass_register(&cpu_devclass); error = class_register(&cpu_class);
if (!error) { if (!error) {
error = driver_register(&cpu_driver); error = driver_register(&cpu_driver);
if (error) if (error)
devclass_unregister(&cpu_devclass); class_unregister(&cpu_class);
} }
return error; return error;
} }
...@@ -11,20 +11,14 @@ ...@@ -11,20 +11,14 @@
#include <asm/topology.h> #include <asm/topology.h>
static int memblk_add_device(struct device * dev) static struct class memblk_class = {
{
return 0;
}
struct device_class memblk_devclass = {
.name = "memblk", .name = "memblk",
.add_device = memblk_add_device,
}; };
struct device_driver memblk_driver = { static struct device_driver memblk_driver = {
.name = "memblk", .name = "memblk",
.bus = &system_bus_type, .bus = &system_bus_type,
.devclass = &memblk_devclass,
}; };
...@@ -51,11 +45,11 @@ int __init register_memblk_type(void) ...@@ -51,11 +45,11 @@ int __init register_memblk_type(void)
{ {
int error; int error;
error = devclass_register(&memblk_devclass); error = class_register(&memblk_class);
if (!error) { if (!error) {
error = driver_register(&memblk_driver); error = driver_register(&memblk_driver);
if (error) if (error)
devclass_unregister(&memblk_devclass); class_unregister(&memblk_class);
} }
return error; return error;
} }
......
...@@ -11,20 +11,14 @@ ...@@ -11,20 +11,14 @@
#include <asm/topology.h> #include <asm/topology.h>
static int node_add_device(struct device * dev) static struct class node_class = {
{
return 0;
}
struct device_class node_devclass = {
.name = "node", .name = "node",
.add_device = node_add_device,
}; };
struct device_driver node_driver = { static struct device_driver node_driver = {
.name = "node", .name = "node",
.bus = &system_bus_type, .bus = &system_bus_type,
.devclass = &node_devclass,
}; };
...@@ -93,11 +87,11 @@ int __init register_node_type(void) ...@@ -93,11 +87,11 @@ int __init register_node_type(void)
{ {
int error; int error;
error = devclass_register(&node_devclass); error = class_register(&node_class);
if (!error) { if (!error) {
error = driver_register(&node_driver); error = driver_register(&node_driver);
if (error) if (error)
devclass_unregister(&node_devclass); class_unregister(&node_class);
} }
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment