public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: James.Bottomley@steeleye.com, andmike@us.ibm.com
Cc: linux-scsi@vger.kernel.org
Subject: [PATCH] first batch of shost sysfs fixes
Date: Wed, 7 May 2003 15:03:30 +0200	[thread overview]
Message-ID: <20030507150329.D10284@lst.de> (raw)

(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?  


--- 1.60/drivers/scsi/hosts.c	Thu May  1 20:10:59 2003
+++ edited/drivers/scsi/hosts.c	Wed May  7 14:40:26 2003
@@ -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
--- 1.61/drivers/scsi/hosts.h	Thu May  1 20:17:11 2003
+++ edited/drivers/scsi/hosts.h	Wed May  7 14:25:40 2003
@@ -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
--- 1.1/drivers/scsi/scsi_priv.h	Sun Apr 27 02:40:32 2003
+++ edited/drivers/scsi/scsi_priv.h	Wed May  7 14:25:01 2003
@@ -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
--- 1.33/drivers/scsi/scsi_syms.c	Thu May  1 18:44:51 2003
+++ edited/drivers/scsi/scsi_syms.c	Wed May  7 14:24:01 2003
@@ -107,8 +105,3 @@
  */
 EXPORT_SYMBOL(scsi_add_timer);
 EXPORT_SYMBOL(scsi_delete_timer);
-
-/*
- * sysfs support
- */
-EXPORT_SYMBOL(shost_class);
--- 1.13/drivers/scsi/scsi_sysfs.c	Mon May  5 00:48:20 2003
+++ edited/drivers/scsi/scsi_sysfs.c	Wed May  7 14:23:49 2003
@@ -53,7 +53,7 @@
 	&class_device_attr_unchecked_isa_dma,
 };
 
-struct class shost_class = {
+static struct class shost_class = {
 	.name		= "scsi_host",
 };
 

             reply	other threads:[~2003-05-07 12:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-07 13:03 Christoph Hellwig [this message]
2003-05-07 14:09 ` [PATCH] first batch of shost sysfs fixes Mike Anderson
2003-05-08 13:48   ` James Bottomley

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=20030507150329.D10284@lst.de \
    --to=hch@lst.de \
    --cc=James.Bottomley@steeleye.com \
    --cc=andmike@us.ibm.com \
    --cc=linux-scsi@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