aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMariusz Kozlowski <m.kozlowski@tuxland.pl>2007-02-14 15:03:39 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-16 18:19:17 -0500
commitb92be9f1ecd3c8b16e9bb22d55bb97b3d89f091a (patch)
tree6f5b561fd2268214d3b511f6dc8e0c1a598f24b7
parent1350770112bd9bd5696cb52deb712370012d80e0 (diff)
Driver: remove redundant kobject_unregister checks
Here is a patch that removes all redundant kobject_unregister argument checks. Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/base/class.c3
-rw-r--r--fs/partitions/check.c9
-rw-r--r--kernel/module.c7
3 files changed, 6 insertions, 13 deletions
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 96def1ddba19..1417e5cd4c6f 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -163,8 +163,7 @@ int class_register(struct class * cls)
163void class_unregister(struct class * cls) 163void class_unregister(struct class * cls)
164{ 164{
165 pr_debug("device class '%s': unregistering\n", cls->name); 165 pr_debug("device class '%s': unregistering\n", cls->name);
166 if (cls->virtual_dir) 166 kobject_unregister(cls->virtual_dir);
167 kobject_unregister(cls->virtual_dir);
168 remove_class_attrs(cls); 167 remove_class_attrs(cls);
169 subsystem_unregister(&cls->subsys); 168 subsystem_unregister(&cls->subsys);
170} 169}
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index ac32a2e8540c..22d38ffc9ef0 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -358,8 +358,7 @@ void delete_partition(struct gendisk *disk, int part)
358 p->ios[0] = p->ios[1] = 0; 358 p->ios[0] = p->ios[1] = 0;
359 p->sectors[0] = p->sectors[1] = 0; 359 p->sectors[0] = p->sectors[1] = 0;
360 sysfs_remove_link(&p->kobj, "subsystem"); 360 sysfs_remove_link(&p->kobj, "subsystem");
361 if (p->holder_dir) 361 kobject_unregister(p->holder_dir);
362 kobject_unregister(p->holder_dir);
363 kobject_uevent(&p->kobj, KOBJ_REMOVE); 362 kobject_uevent(&p->kobj, KOBJ_REMOVE);
364 kobject_del(&p->kobj); 363 kobject_del(&p->kobj);
365 kobject_put(&p->kobj); 364 kobject_put(&p->kobj);
@@ -603,10 +602,8 @@ void del_gendisk(struct gendisk *disk)
603 disk->stamp = 0; 602 disk->stamp = 0;
604 603
605 kobject_uevent(&disk->kobj, KOBJ_REMOVE); 604 kobject_uevent(&disk->kobj, KOBJ_REMOVE);
606 if (disk->holder_dir) 605 kobject_unregister(disk->holder_dir);
607 kobject_unregister(disk->holder_dir); 606 kobject_unregister(disk->slave_dir);
608 if (disk->slave_dir)
609 kobject_unregister(disk->slave_dir);
610 if (disk->driverfs_dev) { 607 if (disk->driverfs_dev) {
611 char *disk_name = make_block_name(disk); 608 char *disk_name = make_block_name(disk);
612 sysfs_remove_link(&disk->kobj, "device"); 609 sysfs_remove_link(&disk->kobj, "device");
diff --git a/kernel/module.c b/kernel/module.c
index 225501f620ff..e06b77af23fd 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1180,11 +1180,8 @@ static void mod_kobject_remove(struct module *mod)
1180{ 1180{
1181 module_remove_modinfo_attrs(mod); 1181 module_remove_modinfo_attrs(mod);
1182 module_param_sysfs_remove(mod); 1182 module_param_sysfs_remove(mod);
1183 if (mod->mkobj.drivers_dir) 1183 kobject_unregister(mod->mkobj.drivers_dir);
1184 kobject_unregister(mod->mkobj.drivers_dir); 1184 kobject_unregister(mod->holders_dir);
1185 if (mod->holders_dir)
1186 kobject_unregister(mod->holders_dir);
1187
1188 kobject_unregister(&mod->mkobj.kobj); 1185 kobject_unregister(&mod->mkobj.kobj);
1189} 1186}
1190 1187