Skip to content

Commit c10997f

Browse files
committed
Kobject: convert drivers/* from kobject_unregister() to kobject_put()
There is no need for kobject_unregister() anymore, thanks to Kay's kobject cleanup changes, so replace all instances of it with kobject_put(). Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 38a382a commit c10997f

17 files changed

Lines changed: 40 additions & 42 deletions

File tree

‎drivers/base/bus.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ int bus_add_driver(struct device_driver *drv)
681681
kobject_uevent(&priv->kobj, KOBJ_ADD);
682682
return error;
683683
out_unregister:
684-
kobject_unregister(&priv->kobj);
684+
kobject_put(&priv->kobj);
685685
out_put_bus:
686686
bus_put(bus);
687687
return error;
@@ -708,7 +708,7 @@ void bus_remove_driver(struct device_driver * drv)
708708
pr_debug("bus: '%s': remove driver %s\n", drv->bus->name, drv->name);
709709
driver_detach(drv);
710710
module_remove_driver(drv);
711-
kobject_unregister(&drv->p->kobj);
711+
kobject_put(&drv->p->kobj);
712712
bus_put(drv->bus);
713713
}
714714

‎drivers/base/sys.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ void sysdev_unregister(struct sys_device * sysdev)
264264
}
265265
mutex_unlock(&sysdev_drivers_lock);
266266

267-
kobject_unregister(&sysdev->kobj);
267+
kobject_put(&sysdev->kobj);
268268
}
269269

270270

‎drivers/block/pktcdvd.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static struct pktcdvd_kobj* pkt_kobj_create(struct pktcdvd_device *pd,
130130
static void pkt_kobj_remove(struct pktcdvd_kobj *p)
131131
{
132132
if (p)
133-
kobject_unregister(&p->kobj);
133+
kobject_put(&p->kobj);
134134
}
135135
/*
136136
* default release function for pktcdvd kernel objects.

‎drivers/cpufreq/cpufreq.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
913913
cpufreq_cpu_data[j] = NULL;
914914
spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
915915

916-
kobject_unregister(&policy->kobj);
916+
kobject_put(&policy->kobj);
917917
wait_for_completion(&policy->kobj_unregister);
918918

919919
err_out_driver_exit:
@@ -1030,8 +1030,6 @@ static int __cpufreq_remove_dev (struct sys_device * sys_dev)
10301030

10311031
unlock_policy_rwsem_write(cpu);
10321032

1033-
kobject_unregister(&data->kobj);
1034-
10351033
kobject_put(&data->kobj);
10361034

10371035
/* we need to make sure that the underlying kobj is actually

‎drivers/cpuidle/sysfs.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ static struct kobj_type ktype_state_cpuidle = {
277277

278278
static void inline cpuidle_free_state_kobj(struct cpuidle_device *device, int i)
279279
{
280-
kobject_unregister(&device->kobjs[i]->kobj);
280+
kobject_put(&device->kobjs[i]->kobj);
281281
wait_for_completion(&device->kobjs[i]->kobj_unregister);
282282
kfree(device->kobjs[i]);
283283
device->kobjs[i] = NULL;
@@ -358,5 +358,5 @@ void cpuidle_remove_sysfs(struct sys_device *sysdev)
358358
struct cpuidle_device *dev;
359359

360360
dev = per_cpu(cpuidle_devices, cpu);
361-
kobject_unregister(&dev->kobj);
361+
kobject_put(&dev->kobj);
362362
}

‎drivers/edac/edac_device_sysfs.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ void edac_device_unregister_sysfs_main_kobj(
303303
* a) module_put() this module
304304
* b) 'kfree' the memory
305305
*/
306-
kobject_unregister(&edac_dev->kobj);
306+
kobject_put(&edac_dev->kobj);
307307
}
308308

309309
/* edac_dev -> instance information */
@@ -574,7 +574,7 @@ static int edac_device_create_block(struct edac_device_ctl_info *edac_dev,
574574

575575
/* Error unwind stack */
576576
err_on_attrib:
577-
kobject_unregister(&block->kobj);
577+
kobject_put(&block->kobj);
578578

579579
err_out:
580580
return err;
@@ -605,7 +605,7 @@ static void edac_device_delete_block(struct edac_device_ctl_info *edac_dev,
605605
/* unregister this block's kobject, SEE:
606606
* edac_device_ctrl_block_release() callback operation
607607
*/
608-
kobject_unregister(&block->kobj);
608+
kobject_put(&block->kobj);
609609
}
610610

611611
/* instance ctor/dtor code */
@@ -672,7 +672,7 @@ static int edac_device_create_instance(struct edac_device_ctl_info *edac_dev,
672672

673673
/* error unwind stack */
674674
err_release_instance_kobj:
675-
kobject_unregister(&instance->kobj);
675+
kobject_put(&instance->kobj);
676676

677677
err_out:
678678
return err;
@@ -697,7 +697,7 @@ static void edac_device_delete_instance(struct edac_device_ctl_info *edac_dev,
697697
/* unregister this instance's kobject, SEE:
698698
* edac_device_ctrl_instance_release() for callback operation
699699
*/
700-
kobject_unregister(&instance->kobj);
700+
kobject_put(&instance->kobj);
701701
}
702702

703703
/*

‎drivers/edac/edac_mc_sysfs.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ static int edac_create_csrow_object(struct mem_ctl_info *mci,
395395
goto err_release_top_kobj;
396396

397397
/* At this point, to release a csrow kobj, one must
398-
* call the kobject_unregister and allow that tear down
398+
* call the kobject_put and allow that tear down
399399
* to work the releasing
400400
*/
401401

@@ -406,7 +406,7 @@ static int edac_create_csrow_object(struct mem_ctl_info *mci,
406406
err = edac_create_channel_files(&csrow->kobj, chan);
407407
if (err) {
408408
/* special case the unregister here */
409-
kobject_unregister(&csrow->kobj);
409+
kobject_put(&csrow->kobj);
410410
goto err_out;
411411
}
412412
}
@@ -808,7 +808,7 @@ int edac_mc_register_sysfs_main_kobj(struct mem_ctl_info *mci)
808808
void edac_mc_unregister_sysfs_main_kobj(struct mem_ctl_info *mci)
809809
{
810810
/* delete the kobj from the mc_kset */
811-
kobject_unregister(&mci->edac_mci_kobj);
811+
kobject_put(&mci->edac_mci_kobj);
812812
}
813813

814814
#define EDAC_DEVICE_SYMLINK "device"
@@ -923,7 +923,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
923923
fail1:
924924
for (i--; i >= 0; i--) {
925925
if (csrow->nr_pages > 0) {
926-
kobject_unregister(&mci->csrows[i].kobj);
926+
kobject_put(&mci->csrows[i].kobj);
927927
}
928928
}
929929

@@ -950,7 +950,7 @@ void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci)
950950
for (i = 0; i < mci->nr_csrows; i++) {
951951
if (mci->csrows[i].nr_pages > 0) {
952952
debugf0("%s() unreg csrow-%d\n", __func__, i);
953-
kobject_unregister(&mci->csrows[i].kobj);
953+
kobject_put(&mci->csrows[i].kobj);
954954
}
955955
}
956956

@@ -967,7 +967,7 @@ void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci)
967967
debugf0("%s() unregister this mci kobj\n", __func__);
968968

969969
/* unregister this instance's kobject */
970-
kobject_unregister(&mci->edac_mci_kobj);
970+
kobject_put(&mci->edac_mci_kobj);
971971
}
972972

973973

‎drivers/edac/edac_pci_sysfs.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void edac_pci_unregister_sysfs_instance_kobj(struct edac_pci_ctl_info *pci)
205205
* function release the main reference count and then
206206
* kfree the memory
207207
*/
208-
kobject_unregister(&pci->kobj);
208+
kobject_put(&pci->kobj);
209209
}
210210

211211
/***************************** EDAC PCI sysfs root **********************/
@@ -411,9 +411,9 @@ static void edac_pci_main_kobj_teardown(void)
411411
* main kobj
412412
*/
413413
if (atomic_dec_return(&edac_pci_sysfs_refcount) == 0) {
414-
debugf0("%s() called kobject_unregister on main kobj\n",
414+
debugf0("%s() called kobject_put on main kobj\n",
415415
__func__);
416-
kobject_unregister(&edac_pci_top_main_kobj);
416+
kobject_put(&edac_pci_top_main_kobj);
417417
}
418418
}
419419

‎drivers/firmware/edd.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ edd_create_symlink_to_pcidev(struct edd_device *edev)
693693
static inline void
694694
edd_device_unregister(struct edd_device *edev)
695695
{
696-
kobject_unregister(&edev->kobj);
696+
kobject_put(&edev->kobj);
697697
}
698698

699699
static void edd_populate_dir(struct edd_device * edev)

‎drivers/firmware/efivars.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ static struct kobj_type efivar_ktype = {
397397
static inline void
398398
efivar_unregister(struct efivar_entry *var)
399399
{
400-
kobject_unregister(&var->kobj);
400+
kobject_put(&var->kobj);
401401
}
402402

403403

@@ -732,7 +732,7 @@ efivars_init(void)
732732
kset_unregister(vars_kset);
733733

734734
out_firmware_unregister:
735-
kobject_unregister(efi_kobj);
735+
kobject_put(efi_kobj);
736736

737737
out_free:
738738
kfree(variable_name);
@@ -753,7 +753,7 @@ efivars_exit(void)
753753
}
754754

755755
kset_unregister(vars_kset);
756-
kobject_unregister(efi_kobj);
756+
kobject_put(efi_kobj);
757757
}
758758

759759
module_init(efivars_init);

0 commit comments

Comments
 (0)