mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC] bind and unbind drivers from userspace through sysfs
@ 2005-06-24  5:12 Greg KH
  2005-06-24  5:14 ` [PATCH] driver core: Add the ability to unbind drivers to devices from userspace Greg KH
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Greg KH @ 2005-06-24  5:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: Patrick Mochel

Now that we have the internal infrastructure of the driver model
reworked so the locks aren't so global and imposing, it's possible to
bind and unbind drivers from devices from userspace with only a very
tiny ammount of code.

In reply to this email, are two patches, one that adds bind and one that
adds unbind functionality.  I've added these to my trees and should show
up in the next -mm releases.  Comments appreciated.

Oh, and yes, we still need a way to add new device ids to drivers from
sysfs, like PCI currently has.  I'll be working on that next.

Even so, with these two patches, people should be able to do things that
they have been wanting to do for a while (like take over the what driver
to what device logic in userspace, as I know some distro installers
really want to do.)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 19+ messages in thread
* [PATCH] driver core: change bus_rescan_devices to return void
@ 2005-06-30  6:04 Greg KH
  2005-06-30  6:04 ` [PATCH] driver core: Add the ability to bind drivers to devices from userspace Greg KH
  0 siblings, 1 reply; 19+ messages in thread
From: Greg KH @ 2005-06-30  6:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh

[PATCH] driver core: change bus_rescan_devices to return void

No one was looking at the return value of bus_rescan_devices, and it
really wasn't anything that anyone in the kernel would ever care about.
So change it which enabled some counting code to be removed also.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 23d3d602cb96addd3c1158424fb01a49ea5e81b1
tree 2daa85579c964bfe3d1a91fe365d202b8f38422b
parent afdce75f1eaebcf358b7594ba7969aade105c3b0
author Greg Kroah-Hartman <gregkh@suse.de> Wed, 22 Jun 2005 16:09:05 -0700
committer Greg Kroah-Hartman <gregkh@suse.de> Wed, 29 Jun 2005 22:48:04 -0700

 drivers/base/bus.c     |   27 +++++++++------------------
 include/linux/device.h |    2 +-
 2 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -483,31 +483,22 @@ void bus_remove_driver(struct device_dri
 /* Helper for bus_rescan_devices's iter */
 static int bus_rescan_devices_helper(struct device *dev, void *data)
 {
-	int *count = data;
-
-	if (!dev->driver && (device_attach(dev) > 0))
-		(*count)++;
-
+	if (!dev->driver)
+		device_attach(dev);
 	return 0;
 }
 
-
 /**
- *	bus_rescan_devices - rescan devices on the bus for possible drivers
- *	@bus:	the bus to scan.
+ * bus_rescan_devices - rescan devices on the bus for possible drivers
+ * @bus: the bus to scan.
  *
- *	This function will look for devices on the bus with no driver
- *	attached and rescan it against existing drivers to see if it
- *	matches any. Calls device_attach(). Returns the number of devices
- *	that were sucessfully bound to a driver.
+ * This function will look for devices on the bus with no driver
+ * attached and rescan it against existing drivers to see if it matches
+ * any by calling device_attach() for the unbound devices.
  */
-int bus_rescan_devices(struct bus_type * bus)
+void bus_rescan_devices(struct bus_type * bus)
 {
-	int count = 0;
-
-	bus_for_each_dev(bus, NULL, &count, bus_rescan_devices_helper);
-
-	return count;
+	bus_for_each_dev(bus, NULL, NULL, bus_rescan_devices_helper);
 }
 
 
diff --git a/include/linux/device.h b/include/linux/device.h
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -69,7 +69,7 @@ struct bus_type {
 extern int bus_register(struct bus_type * bus);
 extern void bus_unregister(struct bus_type * bus);
 
-extern int bus_rescan_devices(struct bus_type * bus);
+extern void bus_rescan_devices(struct bus_type * bus);
 
 extern struct bus_type * get_bus(struct bus_type * bus);
 extern void put_bus(struct bus_type * bus);


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2005-07-02  5:20 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-24  5:12 [RFC] bind and unbind drivers from userspace through sysfs Greg KH
2005-06-24  5:14 ` [PATCH] driver core: Add the ability to unbind drivers to devices from userspace Greg KH
2005-06-24  5:15   ` [PATCH] driver core: Add the ability to bind " Greg KH
2005-06-24 15:57   ` [PATCH] driver core: Add the ability to unbind " Patrick Mochel
2005-06-25  3:27     ` Greg KH
2005-06-25  4:16       ` Dmitry Torokhov
2005-06-25  9:39         ` Michael Tokarev
2005-06-25  3:05 ` [RFC] bind and unbind drivers from userspace through sysfs Bill Nottingham
2005-06-25  3:26   ` Greg KH
2005-06-25  4:22 ` Dmitry Torokhov
2005-06-29 23:47   ` Greg KH
2005-06-30  6:13     ` Dmitry Torokhov
2005-06-30 16:01       ` Greg KH
2005-06-30 20:20         ` Dmitry Torokhov
2005-07-01 22:31           ` Greg KH
2005-07-02  4:25             ` Dmitry Torokhov
2005-07-02  4:51               ` Greg KH
2005-07-02  5:20                 ` Dmitry Torokhov
2005-06-30  6:04 [PATCH] driver core: change bus_rescan_devices to return void Greg KH
2005-06-30  6:04 ` [PATCH] driver core: Add the ability to bind drivers to devices from userspace Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®