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>
This commit is contained in:
@@ -50,7 +50,7 @@ void module_add_driver(struct module *mod, struct device_driver *drv)
|
||||
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 @@ void module_add_driver(struct module *mod, struct device_driver *drv)
|
||||
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 @@ void module_remove_driver(struct device_driver *drv)
|
||||
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) {
|
||||
|
Reference in New Issue
Block a user