Driver core: move the static kobject out of struct driver
This patch removes the kobject, and a few other driver-core-only fields
out of struct driver and into the driver core only. Now drivers can be
safely create on the stack or statically (like they currently are.)
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
diff --git a/drivers/base/module.c b/drivers/base/module.c
index cad07be..103be9c 100644
--- a/drivers/base/module.c
+++ b/drivers/base/module.c
@@ -50,7 +50,7 @@
if (mkobj) {
mk = container_of(mkobj, struct module_kobject, kobj);
/* remember our module structure */
- drv->mkobj = mk;
+ drv->p->mkobj = mk;
/* kset_find_obj took a reference */
kobject_put(mkobj);
}
@@ -60,11 +60,11 @@
return;
/* Don't check return codes; these calls are idempotent */
- no_warn = sysfs_create_link(&drv->kobj, &mk->kobj, "module");
+ no_warn = sysfs_create_link(&drv->p->kobj, &mk->kobj, "module");
driver_name = make_driver_name(drv);
if (driver_name) {
module_create_drivers_dir(mk);
- no_warn = sysfs_create_link(mk->drivers_dir, &drv->kobj,
+ no_warn = sysfs_create_link(mk->drivers_dir, &drv->p->kobj,
driver_name);
kfree(driver_name);
}
@@ -78,12 +78,12 @@
if (!drv)
return;
- sysfs_remove_link(&drv->kobj, "module");
+ sysfs_remove_link(&drv->p->kobj, "module");
if (drv->owner)
mk = &drv->owner->mkobj;
- else if (drv->mkobj)
- mk = drv->mkobj;
+ else if (drv->p->mkobj)
+ mk = drv->p->mkobj;
if (mk && mk->drivers_dir) {
driver_name = make_driver_name(drv);
if (driver_name) {