public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/5] SCSI scanning and removal fixes
@ 2005-07-26 14:20 Alan Stern
  2005-09-07 15:28 ` James Bottomley
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Stern @ 2005-07-26 14:20 UTC (permalink / raw)
  To: James Bottomley; +Cc: SCSI development list

James:

This patch (as544) adds a private entry point to scsi_remove_device, for 
use when callers already own the scan_mutex.  The appropriate callers are 
modified to use the new entry point.

Alan Stern



Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

Index: 2613/drivers/scsi/scsi_sysfs.c
===================================================================
--- 2613.orig/drivers/scsi/scsi_sysfs.c
+++ 2613/drivers/scsi/scsi_sysfs.c
@@ -653,7 +653,7 @@ int scsi_sysfs_add_sdev(struct scsi_devi
 			error = attr_add(&sdev->sdev_gendev,
 					sdev->host->hostt->sdev_attrs[i]);
 			if (error) {
-				scsi_remove_device(sdev);
+				__scsi_remove_device(sdev);
 				goto out;
 			}
 		}
@@ -667,7 +667,7 @@ int scsi_sysfs_add_sdev(struct scsi_devi
 							scsi_sysfs_sdev_attrs[i]);
 			error = device_create_file(&sdev->sdev_gendev, attr);
 			if (error) {
-				scsi_remove_device(sdev);
+				__scsi_remove_device(sdev);
 				goto out;
 			}
 		}
@@ -687,17 +687,10 @@ int scsi_sysfs_add_sdev(struct scsi_devi
 	return error;
 }
 
-/**
- * scsi_remove_device - unregister a device from the scsi bus
- * @sdev:	scsi_device to unregister
- **/
-void scsi_remove_device(struct scsi_device *sdev)
+void __scsi_remove_device(struct scsi_device *sdev)
 {
-	struct Scsi_Host *shost = sdev->host;
-
-	down(&shost->scan_mutex);
 	if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0)
-		goto out;
+		return;
 
 	class_device_unregister(&sdev->sdev_classdev);
 	device_del(&sdev->sdev_gendev);
@@ -706,8 +699,17 @@ void scsi_remove_device(struct scsi_devi
 		sdev->host->hostt->slave_destroy(sdev);
 	transport_unregister_device(&sdev->sdev_gendev);
 	put_device(&sdev->sdev_gendev);
-out:
-	up(&shost->scan_mutex);
+}
+
+/**
+ * scsi_remove_device - unregister a device from the scsi bus
+ * @sdev:	scsi_device to unregister
+ **/
+void scsi_remove_device(struct scsi_device *sdev)
+{
+	down(&sdev->host->scan_mutex);
+	__scsi_remove_device(sdev);
+	up(&sdev->host->scan_mutex);
 }
 EXPORT_SYMBOL(scsi_remove_device);
 
Index: 2613/drivers/scsi/scsi_priv.h
===================================================================
--- 2613.orig/drivers/scsi/scsi_priv.h
+++ 2613/drivers/scsi/scsi_priv.h
@@ -141,6 +141,7 @@ extern void scsi_sysfs_unregister(void);
 extern void scsi_sysfs_device_initialize(struct scsi_device *);
 extern int scsi_sysfs_target_initialize(struct scsi_device *);
 extern struct scsi_transport_template blank_transport_template;
+extern void __scsi_remove_device(struct scsi_device *);
 
 extern struct bus_type scsi_bus_type;
 


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

* Re: [PATCH 3/5] SCSI scanning and removal fixes
  2005-07-26 14:20 [PATCH 3/5] SCSI scanning and removal fixes Alan Stern
@ 2005-09-07 15:28 ` James Bottomley
  0 siblings, 0 replies; 2+ messages in thread
From: James Bottomley @ 2005-09-07 15:28 UTC (permalink / raw)
  To: Alan Stern; +Cc: SCSI development list

On Tue, 2005-07-26 at 10:20 -0400, Alan Stern wrote:
> This patch (as544) adds a private entry point to scsi_remove_device, for 
> use when callers already own the scan_mutex.  The appropriate callers are 
> modified to use the new entry point.

Oops, that's a bit of a bad of a bad bug which was introduced when
someone added the mutex to scsi_remove_device().  I'll add this too,
thanks.

James



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

end of thread, other threads:[~2005-09-07 15:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-26 14:20 [PATCH 3/5] SCSI scanning and removal fixes Alan Stern
2005-09-07 15:28 ` James Bottomley

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