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>
This commit is contained in:
Greg Kroah-Hartman 2007-12-20 08:13:05 -08:00
parent 38a382ae5d
commit c10997f657
17 changed files with 40 additions and 42 deletions

View file

@ -681,7 +681,7 @@ int bus_add_driver(struct device_driver *drv)
kobject_uevent(&priv->kobj, KOBJ_ADD); kobject_uevent(&priv->kobj, KOBJ_ADD);
return error; return error;
out_unregister: out_unregister:
kobject_unregister(&priv->kobj); kobject_put(&priv->kobj);
out_put_bus: out_put_bus:
bus_put(bus); bus_put(bus);
return error; return error;
@ -708,7 +708,7 @@ void bus_remove_driver(struct device_driver * drv)
pr_debug("bus: '%s': remove driver %s\n", drv->bus->name, drv->name); pr_debug("bus: '%s': remove driver %s\n", drv->bus->name, drv->name);
driver_detach(drv); driver_detach(drv);
module_remove_driver(drv); module_remove_driver(drv);
kobject_unregister(&drv->p->kobj); kobject_put(&drv->p->kobj);
bus_put(drv->bus); bus_put(drv->bus);
} }

View file

@ -264,7 +264,7 @@ void sysdev_unregister(struct sys_device * sysdev)
} }
mutex_unlock(&sysdev_drivers_lock); mutex_unlock(&sysdev_drivers_lock);
kobject_unregister(&sysdev->kobj); kobject_put(&sysdev->kobj);
} }

View file

@ -130,7 +130,7 @@ static struct pktcdvd_kobj* pkt_kobj_create(struct pktcdvd_device *pd,
static void pkt_kobj_remove(struct pktcdvd_kobj *p) static void pkt_kobj_remove(struct pktcdvd_kobj *p)
{ {
if (p) if (p)
kobject_unregister(&p->kobj); kobject_put(&p->kobj);
} }
/* /*
* default release function for pktcdvd kernel objects. * default release function for pktcdvd kernel objects.

View file

@ -913,7 +913,7 @@ err_out_unregister:
cpufreq_cpu_data[j] = NULL; cpufreq_cpu_data[j] = NULL;
spin_unlock_irqrestore(&cpufreq_driver_lock, flags); spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
kobject_unregister(&policy->kobj); kobject_put(&policy->kobj);
wait_for_completion(&policy->kobj_unregister); wait_for_completion(&policy->kobj_unregister);
err_out_driver_exit: err_out_driver_exit:
@ -1030,8 +1030,6 @@ static int __cpufreq_remove_dev (struct sys_device * sys_dev)
unlock_policy_rwsem_write(cpu); unlock_policy_rwsem_write(cpu);
kobject_unregister(&data->kobj);
kobject_put(&data->kobj); kobject_put(&data->kobj);
/* we need to make sure that the underlying kobj is actually /* we need to make sure that the underlying kobj is actually

View file

@ -277,7 +277,7 @@ static struct kobj_type ktype_state_cpuidle = {
static void inline cpuidle_free_state_kobj(struct cpuidle_device *device, int i) static void inline cpuidle_free_state_kobj(struct cpuidle_device *device, int i)
{ {
kobject_unregister(&device->kobjs[i]->kobj); kobject_put(&device->kobjs[i]->kobj);
wait_for_completion(&device->kobjs[i]->kobj_unregister); wait_for_completion(&device->kobjs[i]->kobj_unregister);
kfree(device->kobjs[i]); kfree(device->kobjs[i]);
device->kobjs[i] = NULL; device->kobjs[i] = NULL;
@ -358,5 +358,5 @@ void cpuidle_remove_sysfs(struct sys_device *sysdev)
struct cpuidle_device *dev; struct cpuidle_device *dev;
dev = per_cpu(cpuidle_devices, cpu); dev = per_cpu(cpuidle_devices, cpu);
kobject_unregister(&dev->kobj); kobject_put(&dev->kobj);
} }

View file

@ -303,7 +303,7 @@ void edac_device_unregister_sysfs_main_kobj(
* a) module_put() this module * a) module_put() this module
* b) 'kfree' the memory * b) 'kfree' the memory
*/ */
kobject_unregister(&edac_dev->kobj); kobject_put(&edac_dev->kobj);
} }
/* edac_dev -> instance information */ /* edac_dev -> instance information */
@ -574,7 +574,7 @@ static int edac_device_create_block(struct edac_device_ctl_info *edac_dev,
/* Error unwind stack */ /* Error unwind stack */
err_on_attrib: err_on_attrib:
kobject_unregister(&block->kobj); kobject_put(&block->kobj);
err_out: err_out:
return err; return err;
@ -605,7 +605,7 @@ static void edac_device_delete_block(struct edac_device_ctl_info *edac_dev,
/* unregister this block's kobject, SEE: /* unregister this block's kobject, SEE:
* edac_device_ctrl_block_release() callback operation * edac_device_ctrl_block_release() callback operation
*/ */
kobject_unregister(&block->kobj); kobject_put(&block->kobj);
} }
/* instance ctor/dtor code */ /* instance ctor/dtor code */
@ -672,7 +672,7 @@ static int edac_device_create_instance(struct edac_device_ctl_info *edac_dev,
/* error unwind stack */ /* error unwind stack */
err_release_instance_kobj: err_release_instance_kobj:
kobject_unregister(&instance->kobj); kobject_put(&instance->kobj);
err_out: err_out:
return err; return err;
@ -697,7 +697,7 @@ static void edac_device_delete_instance(struct edac_device_ctl_info *edac_dev,
/* unregister this instance's kobject, SEE: /* unregister this instance's kobject, SEE:
* edac_device_ctrl_instance_release() for callback operation * edac_device_ctrl_instance_release() for callback operation
*/ */
kobject_unregister(&instance->kobj); kobject_put(&instance->kobj);
} }
/* /*

View file

@ -395,7 +395,7 @@ static int edac_create_csrow_object(struct mem_ctl_info *mci,
goto err_release_top_kobj; goto err_release_top_kobj;
/* At this point, to release a csrow kobj, one must /* At this point, to release a csrow kobj, one must
* call the kobject_unregister and allow that tear down * call the kobject_put and allow that tear down
* to work the releasing * to work the releasing
*/ */
@ -406,7 +406,7 @@ static int edac_create_csrow_object(struct mem_ctl_info *mci,
err = edac_create_channel_files(&csrow->kobj, chan); err = edac_create_channel_files(&csrow->kobj, chan);
if (err) { if (err) {
/* special case the unregister here */ /* special case the unregister here */
kobject_unregister(&csrow->kobj); kobject_put(&csrow->kobj);
goto err_out; goto err_out;
} }
} }
@ -808,7 +808,7 @@ fail_out:
void edac_mc_unregister_sysfs_main_kobj(struct mem_ctl_info *mci) void edac_mc_unregister_sysfs_main_kobj(struct mem_ctl_info *mci)
{ {
/* delete the kobj from the mc_kset */ /* delete the kobj from the mc_kset */
kobject_unregister(&mci->edac_mci_kobj); kobject_put(&mci->edac_mci_kobj);
} }
#define EDAC_DEVICE_SYMLINK "device" #define EDAC_DEVICE_SYMLINK "device"
@ -923,7 +923,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
fail1: fail1:
for (i--; i >= 0; i--) { for (i--; i >= 0; i--) {
if (csrow->nr_pages > 0) { if (csrow->nr_pages > 0) {
kobject_unregister(&mci->csrows[i].kobj); kobject_put(&mci->csrows[i].kobj);
} }
} }
@ -950,7 +950,7 @@ void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci)
for (i = 0; i < mci->nr_csrows; i++) { for (i = 0; i < mci->nr_csrows; i++) {
if (mci->csrows[i].nr_pages > 0) { if (mci->csrows[i].nr_pages > 0) {
debugf0("%s() unreg csrow-%d\n", __func__, i); debugf0("%s() unreg csrow-%d\n", __func__, i);
kobject_unregister(&mci->csrows[i].kobj); kobject_put(&mci->csrows[i].kobj);
} }
} }
@ -967,7 +967,7 @@ void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci)
debugf0("%s() unregister this mci kobj\n", __func__); debugf0("%s() unregister this mci kobj\n", __func__);
/* unregister this instance's kobject */ /* unregister this instance's kobject */
kobject_unregister(&mci->edac_mci_kobj); kobject_put(&mci->edac_mci_kobj);
} }

View file

@ -205,7 +205,7 @@ void edac_pci_unregister_sysfs_instance_kobj(struct edac_pci_ctl_info *pci)
* function release the main reference count and then * function release the main reference count and then
* kfree the memory * kfree the memory
*/ */
kobject_unregister(&pci->kobj); kobject_put(&pci->kobj);
} }
/***************************** EDAC PCI sysfs root **********************/ /***************************** EDAC PCI sysfs root **********************/
@ -411,9 +411,9 @@ static void edac_pci_main_kobj_teardown(void)
* main kobj * main kobj
*/ */
if (atomic_dec_return(&edac_pci_sysfs_refcount) == 0) { if (atomic_dec_return(&edac_pci_sysfs_refcount) == 0) {
debugf0("%s() called kobject_unregister on main kobj\n", debugf0("%s() called kobject_put on main kobj\n",
__func__); __func__);
kobject_unregister(&edac_pci_top_main_kobj); kobject_put(&edac_pci_top_main_kobj);
} }
} }

View file

@ -693,7 +693,7 @@ edd_create_symlink_to_pcidev(struct edd_device *edev)
static inline void static inline void
edd_device_unregister(struct edd_device *edev) edd_device_unregister(struct edd_device *edev)
{ {
kobject_unregister(&edev->kobj); kobject_put(&edev->kobj);
} }
static void edd_populate_dir(struct edd_device * edev) static void edd_populate_dir(struct edd_device * edev)

View file

@ -397,7 +397,7 @@ static struct kobj_type efivar_ktype = {
static inline void static inline void
efivar_unregister(struct efivar_entry *var) efivar_unregister(struct efivar_entry *var)
{ {
kobject_unregister(&var->kobj); kobject_put(&var->kobj);
} }
@ -732,7 +732,7 @@ efivars_init(void)
kset_unregister(vars_kset); kset_unregister(vars_kset);
out_firmware_unregister: out_firmware_unregister:
kobject_unregister(efi_kobj); kobject_put(efi_kobj);
out_free: out_free:
kfree(variable_name); kfree(variable_name);
@ -753,7 +753,7 @@ efivars_exit(void)
} }
kset_unregister(vars_kset); kset_unregister(vars_kset);
kobject_unregister(efi_kobj); kobject_put(efi_kobj);
} }
module_init(efivars_init); module_init(efivars_init);

View file

@ -714,7 +714,7 @@ err_put:
sysfs_remove_group(p, &pma_group); sysfs_remove_group(p, &pma_group);
sysfs_remove_group(p, &port->pkey_group); sysfs_remove_group(p, &port->pkey_group);
sysfs_remove_group(p, &port->gid_group); sysfs_remove_group(p, &port->gid_group);
kobject_unregister(p); kobject_put(p);
} }
} }
@ -738,10 +738,10 @@ void ib_device_unregister_sysfs(struct ib_device *device)
sysfs_remove_group(p, &pma_group); sysfs_remove_group(p, &pma_group);
sysfs_remove_group(p, &port->pkey_group); sysfs_remove_group(p, &port->pkey_group);
sysfs_remove_group(p, &port->gid_group); sysfs_remove_group(p, &port->gid_group);
kobject_unregister(p); kobject_put(p);
} }
kobject_unregister(device->ports_parent); kobject_put(device->ports_parent);
class_device_unregister(&device->class_dev); class_device_unregister(&device->class_dev);
} }

View file

@ -231,7 +231,7 @@ static void mddev_put(mddev_t *mddev)
list_del(&mddev->all_mddevs); list_del(&mddev->all_mddevs);
spin_unlock(&all_mddevs_lock); spin_unlock(&all_mddevs_lock);
blk_cleanup_queue(mddev->queue); blk_cleanup_queue(mddev->queue);
kobject_unregister(&mddev->kobj); kobject_put(&mddev->kobj);
} else } else
spin_unlock(&all_mddevs_lock); spin_unlock(&all_mddevs_lock);
} }

View file

@ -1236,7 +1236,7 @@ static int __devexit ibmveth_remove(struct vio_dev *dev)
int i; int i;
for(i = 0; i<IbmVethNumBufferPools; i++) for(i = 0; i<IbmVethNumBufferPools; i++)
kobject_unregister(&adapter->rx_buff_pool[i].kobj); kobject_put(&adapter->rx_buff_pool[i].kobj);
unregister_netdev(netdev); unregister_netdev(netdev);

View file

@ -1026,7 +1026,7 @@ pdcs_unregister_pathentries(void)
for (i = 0; (entry = pdcspath_entries[i]); i++) { for (i = 0; (entry = pdcspath_entries[i]); i++) {
read_lock(&entry->rw_lock); read_lock(&entry->rw_lock);
if (entry->ready >= 2) if (entry->ready >= 2)
kobject_unregister(&entry->kobj); kobject_put(&entry->kobj);
read_unlock(&entry->rw_lock); read_unlock(&entry->rw_lock);
} }
} }
@ -1086,7 +1086,7 @@ fail_pdcsreg:
kset_unregister(paths_kset); kset_unregister(paths_kset);
fail_ksetreg: fail_ksetreg:
kobject_unregister(stable_kobj); kobject_put(stable_kobj);
fail_firmreg: fail_firmreg:
printk(KERN_INFO PDCS_PREFIX " bailing out\n"); printk(KERN_INFO PDCS_PREFIX " bailing out\n");
@ -1098,7 +1098,7 @@ pdc_stable_exit(void)
{ {
pdcs_unregister_pathentries(); pdcs_unregister_pathentries();
kset_unregister(paths_kset); kset_unregister(paths_kset);
kobject_unregister(stable_kobj); kobject_put(stable_kobj);
} }

View file

@ -671,7 +671,7 @@ int pci_hp_deregister (struct hotplug_slot *slot)
fs_remove_slot (slot); fs_remove_slot (slot);
dbg ("Removed slot %s from the list\n", slot->name); dbg ("Removed slot %s from the list\n", slot->name);
kobject_unregister(&slot->kobj); kobject_put(&slot->kobj);
return 0; return 0;
} }

View file

@ -114,12 +114,12 @@ int dlpar_sysfs_init(void)
error = sysfs_create_group(dlpar_kobj, &dlpar_attr_group); error = sysfs_create_group(dlpar_kobj, &dlpar_attr_group);
if (error) if (error)
kobject_unregister(dlpar_kobj); kobject_put(dlpar_kobj);
return error; return error;
} }
void dlpar_sysfs_exit(void) void dlpar_sysfs_exit(void)
{ {
sysfs_remove_group(dlpar_kobj, &dlpar_attr_group); sysfs_remove_group(dlpar_kobj, &dlpar_attr_group);
kobject_unregister(dlpar_kobj); kobject_put(dlpar_kobj);
} }

View file

@ -186,9 +186,9 @@ err:
for (mi--; mi>=0; mi--) { for (mi--; mi>=0; mi--) {
mem = &idev->info->mem[mi]; mem = &idev->info->mem[mi];
map = mem->map; map = mem->map;
kobject_unregister(&map->kobj); kobject_put(&map->kobj);
} }
kobject_unregister(idev->map_dir); kobject_put(idev->map_dir);
sysfs_remove_group(&idev->dev->kobj, &uio_attr_grp); sysfs_remove_group(&idev->dev->kobj, &uio_attr_grp);
err_group: err_group:
dev_err(idev->dev, "error creating sysfs files (%d)\n", ret); dev_err(idev->dev, "error creating sysfs files (%d)\n", ret);
@ -203,9 +203,9 @@ static void uio_dev_del_attributes(struct uio_device *idev)
mem = &idev->info->mem[mi]; mem = &idev->info->mem[mi];
if (mem->size == 0) if (mem->size == 0)
break; break;
kobject_unregister(&mem->map->kobj); kobject_put(&mem->map->kobj);
} }
kobject_unregister(idev->map_dir); kobject_put(idev->map_dir);
sysfs_remove_group(&idev->dev->kobj, &uio_attr_grp); sysfs_remove_group(&idev->dev->kobj, &uio_attr_grp);
} }