public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] aic7xxx: user scsi_device host private data
@ 2005-05-23 15:14 Christoph Hellwig
  2005-05-23 15:34 ` James Bottomley
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2005-05-23 15:14 UTC (permalink / raw)
  To: jejb; +Cc: linux-scsi

Index: drivers/scsi/aic7xxx/aic7xxx_osm.c
===================================================================
--- ddc0c48133f130f8f4fcaeee05c8cff31209259d/drivers/scsi/aic7xxx/aic7xxx_osm.c  (mode:100644)
+++ uncommitted/drivers/scsi/aic7xxx/aic7xxx_osm.c  (mode:100644)
@@ -610,10 +610,8 @@
 static int
 ahc_linux_queue(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *))
 {
-	struct	 ahc_softc *ahc;
-	struct	 ahc_linux_device *dev;
-
-	ahc = *(struct ahc_softc **)cmd->device->host->hostdata;
+	struct ahc_softc *ahc = *(struct ahc_softc **)cmd->device->host->hostdata;
+	struct ahc_linux_device *dev = cmd->device->hostdata;
 
 	/*
 	 * Save the callback on completion function.
@@ -629,10 +627,6 @@
 	if (ahc->platform_data->qfrozen != 0)
 		return SCSI_MLQUEUE_HOST_BUSY;
 
-	dev = ahc_linux_get_device(ahc, cmd->device->channel, cmd->device->id,
-				   cmd->device->lun);
-	BUG_ON(dev == NULL);
-
 	cmd->result = CAM_REQ_INPROG << 16;
 
 	return ahc_linux_run_command(ahc, dev, cmd);
@@ -707,6 +701,8 @@
 		if (dev == NULL)
 			goto out;
 	}
+
+	device->hostdata = dev;
 	retval = 0;
 
  out:
@@ -717,16 +713,12 @@
 static int
 ahc_linux_slave_configure(struct scsi_device *device)
 {
-	struct	ahc_softc *ahc;
-	struct	ahc_linux_device *dev;
-
-	ahc = *((struct ahc_softc **)device->host->hostdata);
+	struct ahc_softc *ahc = *((struct ahc_softc **)device->host->hostdata);
+	struct ahc_linux_device *dev = device->hostdata;
 
 	if (bootverbose)
 		printf("%s: Slave Configure %d\n", ahc_name(ahc), device->id);
 
-	dev = ahc_linux_get_device(ahc, device->channel, device->id,
-				   device->lun);
 	dev->scsi_device = device;
 	ahc_linux_device_queue_depth(ahc, dev);
 
@@ -740,16 +732,11 @@
 static void
 ahc_linux_slave_destroy(struct scsi_device *device)
 {
-	struct	ahc_softc *ahc;
-	struct	ahc_linux_device *dev;
+	struct ahc_softc *ahc = *((struct ahc_softc **)device->host->hostdata);
+	struct ahc_linux_device *dev = device->hostdata;
 
-	ahc = *((struct ahc_softc **)device->host->hostdata);
 	if (bootverbose)
 		printf("%s: Slave Destroy %d\n", ahc_name(ahc), device->id);
-	dev = ahc_linux_get_device(ahc, device->channel,
-				   device->id, device->lun);
-
-	BUG_ON(dev->active);
 
 	ahc_linux_free_device(ahc, dev);
 }
@@ -1401,6 +1388,7 @@
 				   devinfo->lun);
 	if (dev == NULL)
 		return;
+
 	was_queuing = dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED);
 	switch (alg) {
 	default:
@@ -2330,7 +2318,7 @@
 ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
 {
 	struct ahc_softc *ahc;
-	struct ahc_linux_device *dev;
+	struct ahc_linux_device *dev = cmd->device->hostdata;
 	struct scb *pending_scb;
 	u_int  saved_scbptr;
 	u_int  active_scb_index;
@@ -2365,21 +2353,6 @@
 	 * at all, and the system wanted us to just abort the
 	 * command, return success.
 	 */
-	dev = ahc_linux_get_device(ahc, cmd->device->channel, cmd->device->id,
-				   cmd->device->lun);
-
-	if (dev == NULL) {
-		/*
-		 * No target device for this command exists,
-		 * so we must not still own the command.
-		 */
-		printf("%s:%d:%d:%d: Is not an active device\n",
-		       ahc_name(ahc), cmd->device->channel, cmd->device->id,
-		       cmd->device->lun);
-		retval = SUCCESS;
-		goto no_cmd;
-	}
-
 	if ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED)) == 0
 	 && ahc_search_untagged_queues(ahc, cmd, cmd->device->id,
 				       cmd->device->channel + 'A',

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

* Re: [PATCH] aic7xxx: user scsi_device host private data
  2005-05-23 15:14 [PATCH] aic7xxx: user scsi_device host private data Christoph Hellwig
@ 2005-05-23 15:34 ` James Bottomley
  2005-05-23 19:16   ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: James Bottomley @ 2005-05-23 15:34 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: SCSI Mailing List

On Mon, 2005-05-23 at 17:14 +0200, Christoph Hellwig wrote:
> -	BUG_ON(dev == NULL);

Leave that one, just in case ... I think it's completely impossible now,
but I'm still suspicious of the aic untagged queues and whether they can
spit back a command.

> -	BUG_ON(dev->active);

Ditto this one .. although I'm less sanguine that this won't be tripped.
 
James



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

* Re: [PATCH] aic7xxx: user scsi_device host private data
  2005-05-23 15:34 ` James Bottomley
@ 2005-05-23 19:16   ` Christoph Hellwig
  2005-05-23 20:04     ` James Bottomley
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2005-05-23 19:16 UTC (permalink / raw)
  To: James Bottomley; +Cc: Christoph Hellwig, SCSI Mailing List

On Mon, May 23, 2005 at 10:34:41AM -0500, James Bottomley wrote:
> On Mon, 2005-05-23 at 17:14 +0200, Christoph Hellwig wrote:
> > -	BUG_ON(dev == NULL);
> 
> Leave that one, just in case ... I think it's completely impossible now,
> but I'm still suspicious of the aic untagged queues and whether they can
> spit back a command.

This doesn't make sense as we never reset the hostdata, so this is a
real can't happen.

> > -	BUG_ON(dev->active);
> 
> Ditto this one .. although I'm less sanguine that this won't be tripped.

this makes a tiny little bit more sense to keep


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

* Re: [PATCH] aic7xxx: user scsi_device host private data
  2005-05-23 19:16   ` Christoph Hellwig
@ 2005-05-23 20:04     ` James Bottomley
  0 siblings, 0 replies; 4+ messages in thread
From: James Bottomley @ 2005-05-23 20:04 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: SCSI Mailing List

On Mon, 2005-05-23 at 21:16 +0200, Christoph Hellwig wrote:
> This doesn't make sense as we never reset the hostdata, so this is a
> real can't happen.

Then you should ... at the place where the old code released the device
in slave_destroy.

James



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

end of thread, other threads:[~2005-05-23 20:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-23 15:14 [PATCH] aic7xxx: user scsi_device host private data Christoph Hellwig
2005-05-23 15:34 ` James Bottomley
2005-05-23 19:16   ` Christoph Hellwig
2005-05-23 20:04     ` James Bottomley

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