Skip to contentSkip to conversation

first batch of shost sysfs fixes

PATCH In review Christoph Hellwig 3 participants 3 messages May 7, 2003 – May 8, 2003 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 first batch of shost sysfs fixes

(a) scsi_check_device_busy() is unused now, kill it. Btw, although I love to see this this really means we need to imply a scsi_set_device_offline (or even better scsi_set_host_offline) in scsi_remove_host now..
(b) make shost_class static to scsi_sysfs.c, with the new device model changes no LLDD needs this anymore
(c) move private prototypes where they belong.

BTW, Mike, did I miss something or will your changes make every driver converted to scsi_add_host & co OOPS on removal now?

drivers/scsi/hosts.c +0 -46
@@ -193,52 +193,6 @@
 	return 0;
 }
 
-static int scsi_check_device_busy(struct scsi_device *sdev)
-{
-	struct Scsi_Host *shost = sdev->host;
-	struct scsi_cmnd *scmd;
-	unsigned long flags;
-
-	/*
-	 * Loop over all of the commands associated with the
-	 * device.  If any of them are busy, then set the state
-	 * back to inactive and bail.
-	 */
-	spin_lock_irqsave(&sdev->list_lock, flags);
-	list_for_each_entry(scmd, &sdev->cmd_list, list) {
-		if (scmd->request && scmd->request->rq_status != RQ_INACTIVE)
-			goto active;
-
-		/*
-		 * No, this device is really free.  Mark it as such, and
-		 * continue on.
-		 */
-		scmd->state = SCSI_STATE_DISCONNECTING;
-		if (scmd->request)
-			scmd->request->rq_status = RQ_SCSI_DISCONNECTING;
-	}
-	spin_unlock_irqrestore(&sdev->list_lock, flags);
-
-	return 0;
-
-active:
-	printk(KERN_ERR "SCSI device not inactive - rq_status=%d, target=%d, "
-			"pid=%ld, state=%d, owner=%d.\n",
-			scmd->request->rq_status, scmd->device->id,
-			scmd->pid, scmd->state, scmd->owner);
-
-	list_for_each_entry(sdev, &shost->my_devices, siblings) {
-		list_for_each_entry(scmd, &sdev->cmd_list, list) {
-			if (scmd->request->rq_status == RQ_SCSI_DISCONNECTING)
-				scmd->request->rq_status = RQ_INACTIVE;
-		}
-	}
-
-	spin_unlock_irqrestore(&sdev->list_lock, flags);
-	printk(KERN_ERR "Device busy???\n");
-	return 1;
-}
-
 /**
  * scsi_remove_host - check a scsi host for release and release
  * @shost:	a pointer to a scsi host to release
drivers/scsi/hosts.h +0 -12
@@ -590,16 +590,4 @@
         return NULL;
 }
 
-/*
- * sysfs support
- */
-extern int scsi_upper_driver_register(struct Scsi_Device_Template *);
-extern void scsi_upper_driver_unregister(struct Scsi_Device_Template *);
-extern int scsi_sysfs_add_host(struct Scsi_Host *, struct device *);
-extern void scsi_sysfs_remove_host(struct Scsi_Host *);
-
-extern void scsi_free_sdev(struct scsi_device *);
-
-extern struct class shost_class;
-
 #endif
drivers/scsi/scsi_priv.h +3 -1
@@ -107,15 +108,17 @@
 /* scsi_scan.c */
 extern void scsi_scan_host(struct Scsi_Host *shost);
 extern void scsi_forget_host(struct Scsi_Host *shost);
+extern void scsi_free_sdev(struct scsi_device *);
 
 /* scsi_sysfs.c */
 extern int scsi_device_register(struct scsi_device *);
 extern void scsi_device_unregister(struct scsi_device *);
 extern int scsi_upper_driver_register(struct Scsi_Device_Template *);
 extern void scsi_upper_driver_unregister(struct Scsi_Device_Template *);
+extern int scsi_sysfs_add_host(struct Scsi_Host *, struct device *);
+extern void scsi_sysfs_remove_host(struct Scsi_Host *);
 extern int scsi_sysfs_register(void);
 extern void scsi_sysfs_unregister(void);
-
 
 /*
  * dev_info: for the black/white list in the old scsi_static_device_list
drivers/scsi/scsi_syms.c +0 -5
@@ -107,8 +105,3 @@
  */
 EXPORT_SYMBOL(scsi_add_timer);
 EXPORT_SYMBOL(scsi_delete_timer);
-
-/*
- * sysfs support
- */
-EXPORT_SYMBOL(shost_class);
drivers/scsi/scsi_sysfs.c +1 -1
@@ -53,7 +53,7 @@
 	&class_device_attr_unchecked_isa_dma,
 };
 
-struct class shost_class = {
+static struct class shost_class = {
 	.name		= "scsi_host",
 };
 
#1 lore raw
Quoted 3 lines · Christoph Hellwig [[email protected]] wrote:

BTW, Mike, did I miss something or will your changes make every driver converted to scsi_add_host & co OOPS on removal now?

Yes (this is my bad in scsi_host_release), except for scsi_debug. I think I should come up with a solution that will not cause changing the ~20 callers (at least for this change).

Post you mail the other day I was reworking the whole patch to correct this and align somewhat with you previous mail. I am reworking the patch against the merged scsi-misc-2.5.

-andmike
--
Michael Anderson
[email protected]

#2 lore raw
Quoted 5 lines · Mike Anderson
Quoted 3 lines · Christoph Hellwig [[email protected]] wrote:

BTW, Mike, did I miss something or will your changes make every driver converted to scsi_add_host & co OOPS on removal now?

Quoted 7 lines

Yes (this is my bad in scsi_host_release), except for scsi_debug. I think I should come up with a solution that will not cause changing the ~20 callers (at least for this change).

Post you mail the other day I was reworking the whole patch to correct this and align somewhat with you previous mail. I am reworking the patch against the merged scsi-misc-2.5.

So could you two get this fixed soon? I can't push the tree without the fix (although I could revert the sysfs class changes). It would also be nice then to have documentation explaining to driver writers exactly how they were supposed to be using this mechanism (as a diff to the scsi_mid_low_api.txt)

James