linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH ] drivers/base/bus.c - export reprobe
@ 2006-03-14  0:52 Moore, Eric
  2006-03-14 15:34 ` Greg KH
  0 siblings, 1 reply; 14+ messages in thread
From: Moore, Eric @ 2006-03-14  0:52 UTC (permalink / raw)
  To: linux-scsi, linux-kernel; +Cc: James.Bottomley, hch, gregkh

[-- Attachment #1: Type: text/plain, Size: 392 bytes --]

Request for exporting device_reprobe - 

Adding support for exposing hidden raid components 
for sg interface. The sdev->no_uld_attach flag
will set set accordingly.

The sas module supports adding/removing raid
volumes using online storage management application
interface.  

This patch was provided to me by Christoph Hellwig.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>

[-- Attachment #2: rescan_device --]
[-- Type: application/octet-stream, Size: 1641 bytes --]

Index: scsi-misc-2.6/drivers/base/bus.c
===================================================================
--- scsi-misc-2.6.orig/drivers/base/bus.c	2006-03-04 13:07:40.000000000 +0100
+++ scsi-misc-2.6/drivers/base/bus.c	2006-03-07 21:06:59.000000000 +0100
@@ -536,6 +536,28 @@
 	bus_for_each_dev(bus, NULL, NULL, bus_rescan_devices_helper);
 }
 
+/**
+ * device_reprobe - remove driver for a device and probe for a new driver
+ * @dev: the device to reprobe
+ *
+ * This function detaches the attached driver (if any) for the given
+ * device and restarts the driver probing process.  It is intended
+ * to use if probing criteria changed during a devices lifetime and
+ * driver attachment should change accordingly.
+ */
+void device_reprobe(struct device *dev)
+{
+	if (dev->driver) {
+		if (dev->parent)        /* Needed for USB */
+			down(&dev->parent->sem);
+		device_release_driver(dev);
+		if (dev->parent)
+			up(&dev->parent->sem);
+	}
+
+	bus_rescan_devices_helper(dev, NULL);
+}
+EXPORT_SYMBOL_GPL(device_reprobe);
 
 struct bus_type * get_bus(struct bus_type * bus)
 {
Index: scsi-misc-2.6/include/linux/device.h
===================================================================
--- scsi-misc-2.6.orig/include/linux/device.h	2006-03-04 13:07:49.000000000 +0100
+++ scsi-misc-2.6/include/linux/device.h	2006-03-07 20:53:43.000000000 +0100
@@ -378,6 +378,7 @@
 extern void device_release_driver(struct device * dev);
 extern int  device_attach(struct device * dev);
 extern void driver_attach(struct device_driver * drv);
+extern void device_reprobe(struct device *dev);
 
 
 /*

^ permalink raw reply	[flat|nested] 14+ messages in thread
* RE: [PATCH ] drivers/base/bus.c - export reprobe
@ 2006-03-14 16:18 Moore, Eric
  2006-03-14 16:27 ` Jan-Benedict Glaw
  2006-03-14 16:50 ` Greg KH
  0 siblings, 2 replies; 14+ messages in thread
From: Moore, Eric @ 2006-03-14 16:18 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-scsi, linux-kernel, James.Bottomley, hch

[-- Attachment #1: Type: text/plain, Size: 216 bytes --]

On Tuesday, March 14, 2006 8:35 AM,  Greg KH wrote:

> 
> base64 for the attachment with DOS line ends?  ugh, can you please fix
> this up and resend?
> 

Here is repost of patch due to dos line endings.



[-- Attachment #2: rescan_device --]
[-- Type: application/octet-stream, Size: 1641 bytes --]

Index: scsi-misc-2.6/drivers/base/bus.c
===================================================================
--- scsi-misc-2.6.orig/drivers/base/bus.c	2006-03-04 13:07:40.000000000 +0100
+++ scsi-misc-2.6/drivers/base/bus.c	2006-03-07 21:06:59.000000000 +0100
@@ -536,6 +536,28 @@
 	bus_for_each_dev(bus, NULL, NULL, bus_rescan_devices_helper);
 }
 
+/**
+ * device_reprobe - remove driver for a device and probe for a new driver
+ * @dev: the device to reprobe
+ *
+ * This function detaches the attached driver (if any) for the given
+ * device and restarts the driver probing process.  It is intended
+ * to use if probing criteria changed during a devices lifetime and
+ * driver attachment should change accordingly.
+ */
+void device_reprobe(struct device *dev)
+{
+	if (dev->driver) {
+		if (dev->parent)        /* Needed for USB */
+			down(&dev->parent->sem);
+		device_release_driver(dev);
+		if (dev->parent)
+			up(&dev->parent->sem);
+	}
+
+	bus_rescan_devices_helper(dev, NULL);
+}
+EXPORT_SYMBOL_GPL(device_reprobe);
 
 struct bus_type * get_bus(struct bus_type * bus)
 {
Index: scsi-misc-2.6/include/linux/device.h
===================================================================
--- scsi-misc-2.6.orig/include/linux/device.h	2006-03-04 13:07:49.000000000 +0100
+++ scsi-misc-2.6/include/linux/device.h	2006-03-07 20:53:43.000000000 +0100
@@ -378,6 +378,7 @@
 extern void device_release_driver(struct device * dev);
 extern int  device_attach(struct device * dev);
 extern void driver_attach(struct device_driver * drv);
+extern void device_reprobe(struct device *dev);
 
 
 /*

^ permalink raw reply	[flat|nested] 14+ messages in thread
* RE: [PATCH ] drivers/base/bus.c - export reprobe
@ 2006-03-14 22:01 Moore, Eric
  2006-03-14 22:31 ` Greg KH
  0 siblings, 1 reply; 14+ messages in thread
From: Moore, Eric @ 2006-03-14 22:01 UTC (permalink / raw)
  To: Greg KH, James Bottomley; +Cc: Christoph Hellwig, linux-scsi, linux-kernel, hch

[-- Attachment #1: Type: text/plain, Size: 417 bytes --]

On Tuesday, March 14, 2006 10:58 AM,  Greg KH wrote:

> 
> Sure, that makes a lot of sense:
> 
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
> 
> Oh, and please make that scsi wrapper function either
> EXPORT_SYMBOL_GPL() or an inline function or macro.
> 
> thanks,
> 


Here we go again (hopefully no managled this time).

I'll repost the other patch with EXPORT_SYMBOL_GPL.

Eric Moore


[-- Attachment #2: rescan_device --]
[-- Type: application/octet-stream, Size: 1596 bytes --]

Index: scsi-misc-2.6/drivers/base/bus.c
===================================================================
--- scsi-misc-2.6.orig/drivers/base/bus.c	2006-03-04 13:07:40.000000000 +0100
+++ scsi-misc-2.6/drivers/base/bus.c	2006-03-07 21:06:59.000000000 +0100
@@ -536,6 +536,28 @@
 	bus_for_each_dev(bus, NULL, NULL, bus_rescan_devices_helper);
 }
 
+/**
+ * device_reprobe - remove driver for a device and probe for a new driver
+ * @dev: the device to reprobe
+ *
+ * This function detaches the attached driver (if any) for the given
+ * device and restarts the driver probing process.  It is intended
+ * to use if probing criteria changed during a devices lifetime and
+ * driver attachment should change accordingly.
+ */
+void device_reprobe(struct device *dev)
+{
+	if (dev->driver) {
+		if (dev->parent)        /* Needed for USB */
+			down(&dev->parent->sem);
+		device_release_driver(dev);
+		if (dev->parent)
+			up(&dev->parent->sem);
+	}
+
+	bus_rescan_devices_helper(dev, NULL);
+}
+EXPORT_SYMBOL_GPL(device_reprobe);
 
 struct bus_type * get_bus(struct bus_type * bus)
 {
Index: scsi-misc-2.6/include/linux/device.h
===================================================================
--- scsi-misc-2.6.orig/include/linux/device.h	2006-03-04 13:07:49.000000000 +0100
+++ scsi-misc-2.6/include/linux/device.h	2006-03-07 20:53:43.000000000 +0100
@@ -378,6 +378,7 @@
 extern void device_release_driver(struct device * dev);
 extern int  device_attach(struct device * dev);
 extern void driver_attach(struct device_driver * drv);
+extern void device_reprobe(struct device *dev);
 
 
 /*

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

end of thread, other threads:[~2006-03-14 22:43 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-14  0:52 [PATCH ] drivers/base/bus.c - export reprobe Moore, Eric
2006-03-14 15:34 ` Greg KH
2006-03-14 17:08   ` Christoph Hellwig
2006-03-14 17:19     ` Greg KH
2006-03-14 17:25       ` Christoph Hellwig
2006-03-14 17:29         ` Greg KH
2006-03-14 17:43           ` James Bottomley
2006-03-14 17:57             ` Greg KH
2006-03-14 22:43               ` James Bottomley
2006-03-14 16:18 Moore, Eric
2006-03-14 16:27 ` Jan-Benedict Glaw
2006-03-14 16:50 ` Greg KH
2006-03-14 22:01 Moore, Eric
2006-03-14 22:31 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).