Kobject: convert drivers/* from kobject_unregister() to kobject_put()
authorGreg Kroah-Hartman <gregkh@suse.de>
Thu, 20 Dec 2007 16:13:05 +0000 (08:13 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 25 Jan 2008 04:40:40 +0000 (20:40 -0800)
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>
17 files changed:
drivers/base/bus.c
drivers/base/sys.c
drivers/block/pktcdvd.c
drivers/cpufreq/cpufreq.c
drivers/cpuidle/sysfs.c
drivers/edac/edac_device_sysfs.c
drivers/edac/edac_mc_sysfs.c
drivers/edac/edac_pci_sysfs.c
drivers/firmware/edd.c
drivers/firmware/efivars.c
drivers/infiniband/core/sysfs.c
drivers/md/md.c
drivers/net/ibmveth.c
drivers/parisc/pdc_stable.c
drivers/pci/hotplug/pci_hotplug_core.c
drivers/pci/hotplug/rpadlpar_sysfs.c
drivers/uio/uio.c

index aea579365f6decbc2af8960aefe5377d4da0801e..a377b65ba328066091d2171e12ed81b60b61f13f 100644 (file)
@@ -681,7 +681,7 @@ int bus_add_driver(struct device_driver *drv)
        kobject_uevent(&priv->kobj, KOBJ_ADD);
        return error;
 out_unregister:
-       kobject_unregister(&priv->kobj);
+       kobject_put(&priv->kobj);
 out_put_bus:
        bus_put(bus);
        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);
        driver_detach(drv);
        module_remove_driver(drv);
-       kobject_unregister(&drv->p->kobj);
+       kobject_put(&drv->p->kobj);
        bus_put(drv->bus);
 }
 
index 47fc6eb6473f0c1d6bfb7f216b7abeacc8aed36b..e666441dd76b047ae64d930124054912b047cc40 100644 (file)
@@ -264,7 +264,7 @@ void sysdev_unregister(struct sys_device * sysdev)
        }
        mutex_unlock(&sysdev_drivers_lock);
 
-       kobject_unregister(&sysdev->kobj);
+       kobject_put(&sysdev->kobj);
 }
 
 
index d1ee38361e0bdb0638d603642a862dd3a37b2759..e9de1712e5a0b1b98b8cc1ce95d59d8daf0b615e 100644 (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)
 {
        if (p)
-               kobject_unregister(&p->kobj);
+               kobject_put(&p->kobj);
 }
 /*
  * default release function for pktcdvd kernel objects.
index 9e102af0c07b792b90ddbaa55439b2ae08e9debc..5efd5550f4ca7a4afcf1a606d29e293eea5b4c9e 100644 (file)
@@ -913,7 +913,7 @@ err_out_unregister:
                cpufreq_cpu_data[j] = NULL;
        spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
 
-       kobject_unregister(&policy->kobj);
+       kobject_put(&policy->kobj);
        wait_for_completion(&policy->kobj_unregister);
 
 err_out_driver_exit:
@@ -1030,8 +1030,6 @@ static int __cpufreq_remove_dev (struct sys_device * sys_dev)
 
        unlock_policy_rwsem_write(cpu);
 
-       kobject_unregister(&data->kobj);
-
        kobject_put(&data->kobj);
 
        /* we need to make sure that the underlying kobj is actually
index 059db9c2147480ec3b0d755b724ffcaa5b9f22af..088ea74edd3480d42d883e7e7705e3a1f17af7fa 100644 (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)
 {
-       kobject_unregister(&device->kobjs[i]->kobj);
+       kobject_put(&device->kobjs[i]->kobj);
        wait_for_completion(&device->kobjs[i]->kobj_unregister);
        kfree(device->kobjs[i]);
        device->kobjs[i] = NULL;
@@ -358,5 +358,5 @@ void cpuidle_remove_sysfs(struct sys_device *sysdev)
        struct cpuidle_device *dev;
 
        dev = per_cpu(cpuidle_devices, cpu);
-       kobject_unregister(&dev->kobj);
+       kobject_put(&dev->kobj);
 }
index 10e5b19a3e3be62a1e749c531b3c86b5c8b39830..53764577035f3f23d0e073991d368f99b8225479 100644 (file)
@@ -303,7 +303,7 @@ void edac_device_unregister_sysfs_main_kobj(
         *   a) module_put() this module
         *   b) 'kfree' the memory
         */
-       kobject_unregister(&edac_dev->kobj);
+       kobject_put(&edac_dev->kobj);
 }
 
 /* edac_dev -> instance information */
@@ -574,7 +574,7 @@ static int edac_device_create_block(struct edac_device_ctl_info *edac_dev,
 
        /* Error unwind stack */
 err_on_attrib:
-       kobject_unregister(&block->kobj);
+       kobject_put(&block->kobj);
 
 err_out:
        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:
         *      edac_device_ctrl_block_release() callback operation
         */
-       kobject_unregister(&block->kobj);
+       kobject_put(&block->kobj);
 }
 
 /* instance ctor/dtor code */
@@ -672,7 +672,7 @@ static int edac_device_create_instance(struct edac_device_ctl_info *edac_dev,
 
        /* error unwind stack */
 err_release_instance_kobj:
-       kobject_unregister(&instance->kobj);
+       kobject_put(&instance->kobj);
 
 err_out:
        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:
         *      edac_device_ctrl_instance_release() for callback operation
         */
-       kobject_unregister(&instance->kobj);
+       kobject_put(&instance->kobj);
 }
 
 /*
index 45b1d36334184ee2cce8a4fd574d841f9ddc0a7b..9aac88027fb31f8a7398fa33173c396983fd7ad2 100644 (file)
@@ -395,7 +395,7 @@ static int edac_create_csrow_object(struct mem_ctl_info *mci,
                goto err_release_top_kobj;
 
        /* 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
         */
 
@@ -406,7 +406,7 @@ static int edac_create_csrow_object(struct mem_ctl_info *mci,
                err = edac_create_channel_files(&csrow->kobj, chan);
                if (err) {
                        /* special case the unregister here */
-                       kobject_unregister(&csrow->kobj);
+                       kobject_put(&csrow->kobj);
                        goto err_out;
                }
        }
@@ -808,7 +808,7 @@ fail_out:
 void edac_mc_unregister_sysfs_main_kobj(struct mem_ctl_info *mci)
 {
        /* delete the kobj from the mc_kset */
-       kobject_unregister(&mci->edac_mci_kobj);
+       kobject_put(&mci->edac_mci_kobj);
 }
 
 #define EDAC_DEVICE_SYMLINK    "device"
@@ -923,7 +923,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
 fail1:
        for (i--; i >= 0; i--) {
                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++) {
                if (mci->csrows[i].nr_pages > 0) {
                        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__);
 
        /* unregister this instance's kobject */
-       kobject_unregister(&mci->edac_mci_kobj);
+       kobject_put(&mci->edac_mci_kobj);
 }
 
 
index 834eaa9d6148b4d553b3a18a4fba1a1587b398be..5b075da9914511ffebcb3f2de1362988957a9c3c 100644 (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
         * kfree the memory
         */
-       kobject_unregister(&pci->kobj);
+       kobject_put(&pci->kobj);
 }
 
 /***************************** EDAC PCI sysfs root **********************/
@@ -411,9 +411,9 @@ static void edac_pci_main_kobj_teardown(void)
         * main kobj
         */
        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__);
-               kobject_unregister(&edac_pci_top_main_kobj);
+               kobject_put(&edac_pci_top_main_kobj);
        }
 }
 
index dc0b87b135054f59a459de4c9404afcfc8e98699..d168223db1594b7d351956f14903448548c08e1e 100644 (file)
@@ -693,7 +693,7 @@ edd_create_symlink_to_pcidev(struct edd_device *edev)
 static inline void
 edd_device_unregister(struct edd_device *edev)
 {
-       kobject_unregister(&edev->kobj);
+       kobject_put(&edev->kobj);
 }
 
 static void edd_populate_dir(struct edd_device * edev)
index b61a72fb6219772f61903cacff484867a55eaa36..f4f709d1370bf4b2c0ed0d5517530e8136ce4490 100644 (file)
@@ -397,7 +397,7 @@ static struct kobj_type efivar_ktype = {
 static inline void
 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);
 
 out_firmware_unregister:
-       kobject_unregister(efi_kobj);
+       kobject_put(efi_kobj);
 
 out_free:
        kfree(variable_name);
@@ -753,7 +753,7 @@ efivars_exit(void)
        }
 
        kset_unregister(vars_kset);
-       kobject_unregister(efi_kobj);
+       kobject_put(efi_kobj);
 }
 
 module_init(efivars_init);
index aa81129704cf841964af728c82594737b2b2efb1..c864ef70fdf9633db07e00723aeceb47bd0cba4a 100644 (file)
@@ -714,7 +714,7 @@ err_put:
                        sysfs_remove_group(p, &pma_group);
                        sysfs_remove_group(p, &port->pkey_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, &port->pkey_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);
 }
 
index ae800ba061a68a6b3ecf813653203cedb3e7a2d2..c28a120b4161ea7324eae5160ed2a4c2fc7e0ab6 100644 (file)
@@ -231,7 +231,7 @@ static void mddev_put(mddev_t *mddev)
                list_del(&mddev->all_mddevs);
                spin_unlock(&all_mddevs_lock);
                blk_cleanup_queue(mddev->queue);
-               kobject_unregister(&mddev->kobj);
+               kobject_put(&mddev->kobj);
        } else
                spin_unlock(&all_mddevs_lock);
 }
index bee30375999aaa4791483c07b5939d66a752f694..57772bebff56336cb50c3bde81c0823d13210787 100644 (file)
@@ -1236,7 +1236,7 @@ static int __devexit ibmveth_remove(struct vio_dev *dev)
        int 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);
 
index 87bc6b73b2493cf30d57280f10827945b2ae2ea1..de34aa9d3136055566204767cd2f5b9cbb28bfb6 100644 (file)
@@ -1026,7 +1026,7 @@ pdcs_unregister_pathentries(void)
        for (i = 0; (entry = pdcspath_entries[i]); i++) {
                read_lock(&entry->rw_lock);
                if (entry->ready >= 2)
-                       kobject_unregister(&entry->kobj);
+                       kobject_put(&entry->kobj);
                read_unlock(&entry->rw_lock);
        }
 }
@@ -1086,7 +1086,7 @@ fail_pdcsreg:
        kset_unregister(paths_kset);
        
 fail_ksetreg:
-       kobject_unregister(stable_kobj);
+       kobject_put(stable_kobj);
        
 fail_firmreg:
        printk(KERN_INFO PDCS_PREFIX " bailing out\n");
@@ -1098,7 +1098,7 @@ pdc_stable_exit(void)
 {
        pdcs_unregister_pathentries();
        kset_unregister(paths_kset);
-       kobject_unregister(stable_kobj);
+       kobject_put(stable_kobj);
 }
 
 
index 3606d5b52a70ffd6c6b3c85e859e2d6220f4b1fd..47bb0e1ff3faff303a72cbe17963da8e34f675fc 100644 (file)
@@ -671,7 +671,7 @@ int pci_hp_deregister (struct hotplug_slot *slot)
 
        fs_remove_slot (slot);
        dbg ("Removed slot %s from the list\n", slot->name);
-       kobject_unregister(&slot->kobj);
+       kobject_put(&slot->kobj);
        return 0;
 }
 
index 9cde367915b6bb72dcb70840dbfd49442f4e8667..e32148a8fa125e0d6d7bcf9d017d0db0015d6329 100644 (file)
@@ -114,12 +114,12 @@ int dlpar_sysfs_init(void)
 
        error = sysfs_create_group(dlpar_kobj, &dlpar_attr_group);
        if (error)
-               kobject_unregister(dlpar_kobj);
+               kobject_put(dlpar_kobj);
        return error;
 }
 
 void dlpar_sysfs_exit(void)
 {
        sysfs_remove_group(dlpar_kobj, &dlpar_attr_group);
-       kobject_unregister(dlpar_kobj);
+       kobject_put(dlpar_kobj);
 }
index f352731add64ac11a732bbfcd1aa93c5a3749628..03b66fb734a6e7c7656b44a60afebdf4818352cb 100644 (file)
@@ -186,9 +186,9 @@ err:
        for (mi--; mi>=0; mi--) {
                mem = &idev->info->mem[mi];
                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);
 err_group:
        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];
                if (mem->size == 0)
                        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);
 }