Commit b65b902c authored by Patrick Mochel's avatar Patrick Mochel

[memblk] Convert to use new system device API

parent 22ff2891
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* drivers/base/memblk.c - basic Memory Block class support * drivers/base/memblk.c - basic Memory Block class support
*/ */
#include <linux/device.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/memblk.h> #include <linux/memblk.h>
...@@ -11,8 +10,8 @@ ...@@ -11,8 +10,8 @@
#include <asm/topology.h> #include <asm/topology.h>
static struct class memblk_class = { static struct sysdev_class memblk_class = {
.name = "memblk", set_kset_name("memblk"),
}; };
...@@ -30,27 +29,23 @@ static struct device_driver memblk_driver = { ...@@ -30,27 +29,23 @@ static struct device_driver memblk_driver = {
*/ */
int __init register_memblk(struct memblk *memblk, int num, struct node *root) int __init register_memblk(struct memblk *memblk, int num, struct node *root)
{ {
int error;
memblk->node_id = memblk_to_node(num); memblk->node_id = memblk_to_node(num);
memblk->sysdev.name = "memblk"; memblk->sysdev.cls = &memblk_class,
memblk->sysdev.id = num; memblk->sysdev.id = num;
if (root)
memblk->sysdev.root = &root->sysroot; error = sys_device_register(&memblk->sysdev);
snprintf(memblk->sysdev.dev.name, DEVICE_NAME_SIZE, "Memory Block %u", num); if (!error)
memblk->sysdev.dev.driver = &memblk_driver; error = sysfs_create_link(&root->sysdev.kobj,
return sys_device_register(&memblk->sysdev); &memblk->sysdev,kobj,
memblk->sysdev.kobj.name);
return error;
} }
int __init register_memblk_type(void) int __init register_memblk_type(void)
{ {
int error; return sysdev_class_register(&memblk_class);
error = class_register(&memblk_class);
if (!error) {
error = driver_register(&memblk_driver);
if (error)
class_unregister(&memblk_class);
}
return error;
} }
postcore_initcall(register_memblk_type); postcore_initcall(register_memblk_type);
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