Commit 60c37a8b authored by Patrick Mochel's avatar Patrick Mochel

[driver model] Convert to new system device API

parent 9777b1de
......@@ -9,15 +9,8 @@
#include <asm/topology.h>
struct class cpu_class = {
.name = "cpu",
};
struct device_driver cpu_driver = {
.name = "cpu",
.bus = &system_bus_type,
struct sysdev_class cpu_sysdev_class = {
set_kset_name("cpu"),
};
/*
......@@ -28,42 +21,15 @@ 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;
if (root)
cpu->sysdev.root = &root->sysroot;
snprintf(cpu->sysdev.dev.name, DEVICE_NAME_SIZE, "CPU %u", num);
cpu->sysdev.dev.driver = &cpu_driver;
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) {
sys_device_unregister(&cpu->sysdev);
return retval;
}
return 0;
cpu->sysdev.cls = &cpu_sysdev_class;
return sys_device_register(&cpu->sysdev);
}
int __init cpu_dev_init(void)
{
int error;
error = class_register(&cpu_class);
if (error)
goto out;
error = driver_register(&cpu_driver);
if (error)
class_unregister(&cpu_class);
out:
return error;
return sysdev_class_register(&cpu_sysdev_class);
}
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