public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Driver core: remove put_bus()
Date: Thu, 13 Sep 2007 16:39:47 -0700	[thread overview]
Message-ID: <20070913233947.GD10856@kroah.com> (raw)
In-Reply-To: <20070913233751.GA10856@kroah.com>

put_bus() should not be globally visable as it is not used by anything
other than drivers/base/bus.c.  This patch removes the visability of it,
and renames it to match all of the other *_put() functions in the
kernel.


Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/base/base.h |    1 -
 drivers/base/bus.c  |   29 ++++++++++++++---------------
 2 files changed, 14 insertions(+), 16 deletions(-)

--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -19,7 +19,6 @@ extern int bus_add_device(struct device 
 extern void bus_attach_device(struct device * dev);
 extern void bus_remove_device(struct device * dev);
 extern struct bus_type *get_bus(struct bus_type * bus);
-extern void put_bus(struct bus_type * bus);
 
 extern int bus_add_driver(struct device_driver *);
 extern void bus_remove_driver(struct device_driver *);
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -30,6 +30,11 @@
 static int __must_check bus_rescan_devices_helper(struct device *dev,
 						void *data);
 
+static void bus_put(struct bus_type *bus)
+{
+	kset_put(&bus->subsys);
+}
+
 static ssize_t
 drv_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
 {
@@ -124,7 +129,7 @@ int bus_create_file(struct bus_type * bu
 	int error;
 	if (get_bus(bus)) {
 		error = sysfs_create_file(&bus->subsys.kobj, &attr->attr);
-		put_bus(bus);
+		bus_put(bus);
 	} else
 		error = -EINVAL;
 	return error;
@@ -134,7 +139,7 @@ void bus_remove_file(struct bus_type * b
 {
 	if (get_bus(bus)) {
 		sysfs_remove_file(&bus->subsys.kobj, &attr->attr);
-		put_bus(bus);
+		bus_put(bus);
 	}
 }
 
@@ -186,7 +191,7 @@ static ssize_t driver_unbind(struct devi
 		err = count;
 	}
 	put_device(dev);
-	put_bus(bus);
+	bus_put(bus);
 	return err;
 }
 static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind);
@@ -219,7 +224,7 @@ static ssize_t driver_bind(struct device
 			err = -ENODEV;
 	}
 	put_device(dev);
-	put_bus(bus);
+	bus_put(bus);
 	return err;
 }
 static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind);
@@ -459,7 +464,7 @@ out_subsys:
 out_id:
 	device_remove_attrs(bus, dev);
 out_put:
-	put_bus(dev->bus);
+	bus_put(dev->bus);
 	return error;
 }
 
@@ -509,7 +514,7 @@ void bus_remove_device(struct device * d
 		}
 		pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id);
 		device_release_driver(dev);
-		put_bus(dev->bus);
+		bus_put(dev->bus);
 	}
 }
 
@@ -646,7 +651,7 @@ int bus_add_driver(struct device_driver 
 out_unregister:
 	kobject_unregister(&drv->kobj);
 out_put_bus:
-	put_bus(bus);
+	bus_put(bus);
 	return error;
 }
 
@@ -671,7 +676,7 @@ void bus_remove_driver(struct device_dri
 	driver_detach(drv);
 	module_remove_driver(drv);
 	kobject_unregister(&drv->kobj);
-	put_bus(drv->bus);
+	bus_put(drv->bus);
 }
 
 
@@ -732,12 +737,6 @@ struct bus_type *get_bus(struct bus_type
 				struct bus_type, subsys) : NULL;
 }
 
-void put_bus(struct bus_type * bus)
-{
-	kset_put(&bus->subsys);
-}
-
-
 /**
  *	find_bus - locate bus by name.
  *	@name:	name of bus.
@@ -874,7 +873,7 @@ out:
  *	@bus:	bus.
  *
  *	Unregister the child subsystems and the bus itself.
- *	Finally, we call put_bus() to release the refcount
+ *	Finally, we call bus_put() to release the refcount
  */
 void bus_unregister(struct bus_type * bus)
 {

  parent reply	other threads:[~2007-09-13 23:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-13 23:37 [RFC] Some driver core and kobject minor patches Greg KH
2007-09-13 23:38 ` Driver core: remove get_bus() Greg KH
2007-09-14 11:02   ` Cornelia Huck
2007-09-14 11:27     ` Greg KH
2007-09-13 23:39 ` Driver core: remove kset_set_kset_s Greg KH
2007-09-13 23:39 ` Greg KH [this message]
2007-09-14 11:03   ` Driver core: remove put_bus() Cornelia Huck
2007-09-13 23:40 ` Driver core: remove subsys_get() Greg KH
2007-09-13 23:40 ` Driver core: remove subsys_put() Greg KH
2007-09-13 23:40 ` Driver core: remove subsys_set_kset Greg KH
2007-09-13 23:41 ` sysfs: spit a warning to users when they try to create a duplicate sysfs file Greg KH
2007-09-14 12:06   ` Cornelia Huck
2007-09-16 20:39     ` Greg KH
2007-09-15 12:44   ` Stefan Richter
2007-09-13 23:42 ` Drivers: clean up direct setting of the name of a kset Greg KH
2007-09-13 23:42 ` [RFC] Some driver core and kobject minor patches Greg KH
2007-09-13 23:43 ` cdev: remove unneeded setting of cdev names Greg KH
2007-09-13 23:43 ` kobjects: fix up improper use of the kobject name field Greg KH
2007-09-13 23:44 ` kobject: remove the static array for the name Greg KH
2007-09-14 11:25 ` [RFC] Some driver core and kobject minor patches Cornelia Huck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070913233947.GD10856@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox