]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] qla1280 TCQ update
authorDoug Ledford <dledford@redhat.com>
Tue, 15 Oct 2002 11:55:43 +0000 (04:55 -0700)
committerDoug Ledford <dledford@redhat.com>
Tue, 15 Oct 2002 11:55:43 +0000 (04:55 -0700)
qla1280.h:
  Update device template
qla1280.c:
  Update to use slave_attach for setting queue depth

12 files changed:
drivers/scsi/fcal.c
drivers/scsi/fcal.h
drivers/scsi/ncr53c8xx.c
drivers/scsi/ncr53c8xx.h
drivers/scsi/pluto.c
drivers/scsi/pluto.h
drivers/scsi/qla1280.c
drivers/scsi/qla1280.h
drivers/scsi/sym53c8xx.c
drivers/scsi/sym53c8xx.h
drivers/scsi/sym53c8xx_2/sym53c8xx.h
drivers/scsi/sym53c8xx_2/sym_glue.c

index 47d20082c1aff969a91b8d1f4ffc0555da7a9975..77192c05310f1e512b544b3855a52d3348badc5e 100644 (file)
@@ -70,17 +70,21 @@ static unsigned char target2alpa[] = {
 
 static int fcal_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd);
 
-static void fcal_select_queue_depths(struct Scsi_Host *host, Scsi_Device *devlist)
+int fcal_slave_attach(Scsi_Device *device)
 {
-       Scsi_Device *device;
+       int depth_to_use;
        
-       for (device = devlist; device; device = device->next) {
-               if (device->host != host) continue;
-               if (device->tagged_supported)
-                       device->queue_depth = /* 254 */ 8;
-               else
-                       device->queue_depth = 2;
-       }
+       if (device->tagged_supported)
+               depth_to_use = /* 254 */ 8;
+       else
+               depth_to_use = 2;
+
+       scsi_adjust_queue_depth(device,
+                               (device->tagged_supported ?
+                                MSG_SIMPLE_TAG : 0),
+                               depth_to_use);
+
+       return 0;
 }
 
 /* Detect all FC Arbitrated Loops attached to the machine.
@@ -165,7 +169,6 @@ int __init fcal_detect(Scsi_Host_Template *tpnt)
 #ifdef __sparc_v9__
                host->unchecked_isa_dma = 1;
 #endif
-               host->select_queue_depths = fcal_select_queue_depths;
 
                fc->channels = 1;
                fc->targets = 127;
index 8246571b9cb87ebab0257a7e8156106a0eaece69..194e3d0e063743ff6b61176955820b54b7105c4f 100644 (file)
@@ -23,6 +23,7 @@ struct fcal {
 int fcal_detect(Scsi_Host_Template *);
 int fcal_release(struct Scsi_Host *);
 int fcal_proc_info (char *, char **, off_t, int, int, int);
+int fcal_slave_attach(Scsi_Device *);
 
 #define FCAL {                                                 \
        name:                   "Fibre Channel Arbitrated Loop",\
@@ -30,6 +31,7 @@ int fcal_proc_info (char *, char **, off_t, int, int, int);
        release:                fcal_release,                   \
        proc_info:              fcal_proc_info,                 \
        queuecommand:           fcp_scsi_queuecommand,          \
+       slave_attach:           fcal_slave_attach,              \
        can_queue:              FCAL_CAN_QUEUE,                 \
        this_id:                -1,                             \
        sg_tablesize:           1,                              \
index c056da9c0ed931cb233c353e4160c2187eafa0fe..26ce03f229c2316611235d91c1de329a4dfd71c0 100644 (file)
@@ -378,8 +378,6 @@ static Scsi_Host_Template   *the_template   = NULL;
 
 #define ScsiResult(host_code, scsi_code) (((host_code) << 16) + ((scsi_code) & 0x7f))
 
-static void ncr53c8xx_select_queue_depths(
-       struct Scsi_Host *host, struct scsi_device *devlist);
 static void ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs);
 static void ncr53c8xx_timeout(unsigned long np);
 
@@ -3710,7 +3708,6 @@ ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
        instance->dma_channel   = 0;
        instance->cmd_per_lun   = MAX_TAGS;
        instance->can_queue     = (MAX_START-4);
-       instance->select_queue_depths = ncr53c8xx_select_queue_depths;
        scsi_set_pci_device(instance, device->pdev);
 
 #ifdef SCSI_NCR_INTEGRITY_CHECKING
@@ -8500,56 +8497,57 @@ static void __init ncr_getclock (ncb_p np, int mult)
 **   Linux select queue depths function
 */
 
-static void ncr53c8xx_select_queue_depths(struct Scsi_Host *host, struct scsi_device *devlist)
+int ncr53c8xx_slave_attach(Scsi_Device *device)
 {
-       struct scsi_device *device;
+       struct Scsi_Host *host = device->host;
+       ncb_p np;
+       tcb_p tp;
+       lcb_p lp;
+       int numtags, depth_to_use;
 
-       for (device = devlist; device; device = device->next) {
-               ncb_p np;
-               tcb_p tp;
-               lcb_p lp;
-               int numtags;
+       np = ((struct host_data *) host->hostdata)->ncb;
+       tp = &np->target[device->id];
+       lp = tp->lp[device->lun];
 
-               if (device->host != host)
-                       continue;
+       /*
+       **      Select queue depth from driver setup.
+       **      Donnot use more than configured by user.
+       **      Use at least 2.
+       **      Donnot use more than our maximum.
+       */
+       numtags = device_queue_depth(np->unit, device->id, device->lun);
+       if (numtags > tp->usrtags)
+               numtags = tp->usrtags;
+       if (!device->tagged_supported)
+               numtags = 1;
+       depth_to_use = numtags;
+       if (depth_to_use < 2)
+               depth_to_use = 2;
+       if (depth_to_use > MAX_TAGS)
+               depth_to_use = MAX_TAGS;
 
-               np = ((struct host_data *) host->hostdata)->ncb;
-               tp = &np->target[device->id];
-               lp = tp->lp[device->lun];
+       scsi_adjust_queue_depth(device,
+                               (device->tagged_supported ?
+                                MSG_SIMPLE_TAG : 0),
+                               depth_to_use);
 
-               /*
-               **      Select queue depth from driver setup.
-               **      Donnot use more than configured by user.
-               **      Use at least 2.
-               **      Donnot use more than our maximum.
-               */
-               numtags = device_queue_depth(np->unit, device->id, device->lun);
-               if (numtags > tp->usrtags)
-                       numtags = tp->usrtags;
-               if (!device->tagged_supported)
-                       numtags = 1;
-               device->queue_depth = numtags;
-               if (device->queue_depth < 2)
-                       device->queue_depth = 2;
-               if (device->queue_depth > MAX_TAGS)
-                       device->queue_depth = MAX_TAGS;
-
-               /*
-               **      Since the queue depth is not tunable under Linux,
-               **      we need to know this value in order not to 
-               **      announce stupid things to user.
-               */
-               if (lp) {
-                       lp->numtags = lp->maxtags = numtags;
-                       lp->scdev_depth = device->queue_depth;
-               }
-               ncr_setup_tags (np, device->id, device->lun);
+       /*
+       **      Since the queue depth is not tunable under Linux,
+       **      we need to know this value in order not to 
+       **      announce stupid things to user.
+       */
+       if (lp) {
+               lp->numtags = lp->maxtags = numtags;
+               lp->scdev_depth = depth_to_use;
+       }
+       ncr_setup_tags (np, device->id, device->lun);
 
 #ifdef DEBUG_NCR53C8XX
-printk("ncr53c8xx_select_queue_depth: host=%d, id=%d, lun=%d, depth=%d\n",
-       np->unit, device->id, device->lun, device->queue_depth);
+       printk("ncr53c8xx_select_queue_depth: host=%d, id=%d, lun=%d, depth=%d\n",
+              np->unit, device->id, device->lun, depth_to_use);
 #endif
-       }
+
+       return 0;
 }
 
 /*
index ac4e795a14034e410a4e814e1eee8067cb11c499..ed4e569aa6131e68badf36c04abf3f3f2756b039 100644 (file)
@@ -59,6 +59,7 @@ int ncr53c8xx_detect(Scsi_Host_Template *tpnt);
 const char *ncr53c8xx_info(struct Scsi_Host *host);
 int ncr53c8xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
 int ncr53c8xx_reset(Scsi_Cmnd *, unsigned int);
+int ncr53c8xx_slave_attach(Scsi_Device *);
 
 #ifdef MODULE
 int ncr53c8xx_release(struct Scsi_Host *);
@@ -74,6 +75,7 @@ int ncr53c8xx_release(struct Scsi_Host *);
                        release:        ncr53c8xx_release,      \
                        info:           ncr53c8xx_info,         \
                        queuecommand:   ncr53c8xx_queue_command,\
+                       slave_attach:   ncr53c8xx_slave_attach, \
                        abort:          ncr53c8xx_abort,        \
                        reset:          ncr53c8xx_reset,        \
                        bios_param:     scsicam_bios_param,     \
index c812e3b291d6d6f04ccdcb3d5a00adc3db07d0fd..52d03fa981686e3f46433e4132ab8496d659e724 100644 (file)
@@ -71,17 +71,21 @@ static void __init pluto_detect_scsi_done(Scsi_Cmnd *SCpnt)
                up(&fc_sem);
 }
 
-static void pluto_select_queue_depths(struct Scsi_Host *host, Scsi_Device *devlist)
+int pluto_slave_attach(Scsi_Device *device)
 {
-       Scsi_Device *device;
-       
-       for (device = devlist; device; device = device->next) {
-               if (device->host != host) continue;
-               if (device->tagged_supported)
-                       device->queue_depth = /* 254 */ 8;
-               else
-                       device->queue_depth = 2;
-       }
+       int depth_to_use;
+
+       if (device->tagged_supported)
+               depth_to_use = /* 254 */ 8;
+       else
+               depth_to_use = 2;
+
+       scsi_adjust_queue_depth(device,
+                               (device->tagged_supported ?
+                                MSG_SIMPLE_TAG : 0),
+                               depth_to_use);
+
+       return 0;
 }
 
 /* Detect all SSAs attached to the machine.
@@ -241,7 +245,6 @@ int __init pluto_detect(Scsi_Host_Template *tpnt)
                                host->unchecked_isa_dma = 1;
 #endif
 
-                               host->select_queue_depths = pluto_select_queue_depths;
 
                                fc->channels = inq->channels + 1;
                                fc->targets = inq->targets;
index 01d34564f1b825a741ae780b277837f28eea745e..558693d10b90a69a7218a79dc42cd45b00c0b98f 100644 (file)
@@ -41,6 +41,7 @@ struct pluto_inquiry {
 int pluto_detect(Scsi_Host_Template *);
 int pluto_release(struct Scsi_Host *);
 const char * pluto_info(struct Scsi_Host *);
+int pluto_slave_attach(Scsi_Device *);
 
 #define PLUTO {                                                        \
        name:                   "Sparc Storage Array 100/200",  \
@@ -48,6 +49,7 @@ const char * pluto_info(struct Scsi_Host *);
        release:                pluto_release,                  \
        info:                   pluto_info,                     \
        queuecommand:           fcp_scsi_queuecommand,          \
+       slave_attach:           pluto_slave_attach,             \
        can_queue:              PLUTO_CAN_QUEUE,                \
        this_id:                -1,                             \
        sg_tablesize:           1,                              \
index 68731d7505ec6ca2759559a84ca0954c7a2c867f..8239f95b6381e0bf0cee2de9dccec3138f2744bd 100644 (file)
@@ -382,8 +382,7 @@ static void qla1280_done(struct scsi_qla_host *, srb_t **, srb_t **);
 static void qla1280_next(struct scsi_qla_host *, scsi_lu_t *, int);
 static void qla1280_putq_t(scsi_lu_t *, srb_t *);
 static void qla1280_done_q_put(srb_t *, srb_t **, srb_t **);
-static void qla1280_device_queue_depth(struct scsi_qla_host *, Scsi_Device *);
-static void qla1280_select_queue_depth(struct Scsi_Host *, Scsi_Device *);
+static int qla1280_slave_attach(Scsi_Device *);
 #if STOP_ON_ERROR
 static void qla1280_panic(char *, struct Scsi_Host *host);
 #endif
@@ -840,7 +839,6 @@ qla1280_do_device_init(struct pci_dev *pdev,
 
        host->can_queue = 0xfffff;      /* unlimited  */
        host->cmd_per_lun = 1;
-       host->select_queue_depths = qla1280_select_queue_depth;
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,18)
        host->base = (unsigned char *)ha->mmpbase;
 #else
@@ -1796,7 +1794,7 @@ qla1280_do_dpc(void *p)
 }
 
 /**************************************************************************
- *   qla1280_device_queue_depth
+ *   qla1280_slave_attach
  *
  * Description:
  *   Determines the queue depth for a given device.  There are two ways
@@ -1806,51 +1804,28 @@ qla1280_do_dpc(void *p)
  *   as the default queue depth.  Otherwise, we use either 4 or 8 as the
  *   default queue depth (dependent on the number of hardware SCBs).
  **************************************************************************/
-static void
-qla1280_device_queue_depth(struct scsi_qla_host *p, Scsi_Device * device)
+static int
+qla1280_slave_attach(Scsi_Device * device)
 {
-       int default_depth = 3;
+       struct scsi_qla_host *p = (struct scsi_qla_host *)device->host->hostdata;
        int bus = device->channel;
        int target = device->id;
 
-       device->queue_depth = default_depth;
-
+       if (qla1280_check_for_dead_scsi_bus(p, bus))
+               return 1;
        if (device->tagged_supported &&
            (p->bus_settings[bus].qtag_enables & (BIT_0 << target))) {
-               device->tagged_queue = 1;
-               device->current_tag = 0;
-               device->queue_depth = p->bus_settings[bus].hiwat;
+               scsi_adjust_queue_depth(device, MSG_ORDERED_TAG,
+                               p->bus_settings[bus].hiwat);
                /* device->queue_depth = 20; */
                printk(KERN_INFO "scsi(%li:%d:%d:%d): Enabled tagged queuing, "
                       "queue depth %d.\n", p->host_no, device->channel,
                       device->id, device->lun, device->queue_depth);
+       } else {
+               scsi_adjust_queue_depth(device, 0 /* TCQ off */, 3);
        }
        qla12160_get_target_parameters(p, bus, target, device->lun);
-}
-
-/**************************************************************************
- *   qla1280_select_queue_depth
- *
- *   Sets the queue depth for each SCSI device hanging off the input
- *   host adapter.  We use a queue depth of 2 for devices that do not
- *   support tagged queueing.
- **************************************************************************/
-static void
-qla1280_select_queue_depth(struct Scsi_Host *host, Scsi_Device * scsi_devs)
-{
-       Scsi_Device *device;
-       struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata;
-
-       ENTER("qla1280_select_queue_depth");
-       for (device = scsi_devs; device != NULL; device = device->next) {
-               if (device->host == host)
-                       qla1280_device_queue_depth (ha, device);
-       }
-
-       if (scsi_devs)
-               qla1280_check_for_dead_scsi_bus(ha, scsi_devs->channel);
-
-       LEAVE("qla1280_select_queue_depth");
+       return 0;
 }
 
 /*
index 1139d7d023a722cc48809be68d69a6efdec23cb6..5dbaf0a89cb83a08826085a11857fe5c2d55fbbb 100644 (file)
@@ -1314,6 +1314,7 @@ int qla1280_queuecommand(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
 int qla1280_abort(Scsi_Cmnd *);
 int qla1280_reset(Scsi_Cmnd *, unsigned int);
 int qla1280_biosparam(Disk *, struct block_device *, int[]);
+static int qla1280_slave_attach(Scsi_Device *);
 void qla1280_intr_handler(int, void *, struct pt_regs *);
 void qla1280_setup(char *s, int *dummy);
 
@@ -1342,7 +1343,7 @@ void qla1280_setup(char *s, int *dummy);
 /*     use_new_eh_code: 0, */                                  \
        abort: qla1280_abort,                                   \
        reset: qla1280_reset,                                   \
-       slave_attach: NULL,                                     \
+       slave_attach: qla1280_slave_attach,                     \
        bios_param: qla1280_biosparam,                          \
        can_queue: 255,         /* max simultaneous cmds      */\
        this_id: -1,            /* scsi id of host adapter    */\
index 5558ae08a692609dbee94d80fe02f6f5d9dcb4e6..4e02050bd8851f5bfd9e8ccc4cda5bc8af679753 100644 (file)
@@ -1341,8 +1341,6 @@ MODULE_PARM(sym53c8xx, "s");
 #define SetScsiAbortResult(cmd) SetScsiResult(cmd, DID_ABORT, 0xff)
 #endif
 
-static void sym53c8xx_select_queue_depths(
-       struct Scsi_Host *host, struct scsi_device *devlist);
 static void sym53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs);
 static void sym53c8xx_timeout(unsigned long np);
 
@@ -5923,8 +5921,6 @@ ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
 #endif
 #endif
        
-       instance->select_queue_depths = sym53c8xx_select_queue_depths;
-
        NCR_UNLOCK_NCB(np, flags);
 
        /*
@@ -13545,56 +13541,57 @@ static int device_queue_depth(ncb_p np, int target, int lun)
        return DEF_DEPTH;
 }
 
-static void sym53c8xx_select_queue_depths(struct Scsi_Host *host, struct scsi_device *devlist)
+int sym53c8xx_slave_attach(Scsi_Device *device)
 {
-       struct scsi_device *device;
-
-       for (device = devlist; device; device = device->next) {
-               ncb_p np;
-               tcb_p tp;
-               lcb_p lp;
-               int numtags;
+       struct Scsi_Host *host = device->host;
+       ncb_p np;
+       tcb_p tp;
+       lcb_p lp;
+       int numtags, depth_to_use;
 
-               if (device->host != host)
-                       continue;
+       np = ((struct host_data *) host->hostdata)->ncb;
+       tp = &np->target[device->id];
+       lp = ncr_lp(np, tp, device->lun);
 
-               np = ((struct host_data *) host->hostdata)->ncb;
-               tp = &np->target[device->id];
-               lp = ncr_lp(np, tp, device->lun);
+       /*
+       **      Select queue depth from driver setup.
+       **      Donnot use more than configured by user.
+       **      Use at least 2.
+       **      Donnot use more than our maximum.
+       */
+       numtags = device_queue_depth(np, device->id, device->lun);
+       if (numtags > tp->usrtags)
+               numtags = tp->usrtags;
+       if (!device->tagged_supported)
+               numtags = 1;
+       depth_to_use = numtags;
+       if (depth_to_use < 2)
+               depth_to_use = 2;
+       if (depth_to_use > MAX_TAGS)
+               depth_to_use = MAX_TAGS;
 
-               /*
-               **      Select queue depth from driver setup.
-               **      Donnot use more than configured by user.
-               **      Use at least 2.
-               **      Donnot use more than our maximum.
-               */
-               numtags = device_queue_depth(np, device->id, device->lun);
-               if (numtags > tp->usrtags)
-                       numtags = tp->usrtags;
-               if (!device->tagged_supported)
-                       numtags = 1;
-               device->queue_depth = numtags;
-               if (device->queue_depth < 2)
-                       device->queue_depth = 2;
-               if (device->queue_depth > MAX_TAGS)
-                       device->queue_depth = MAX_TAGS;
+       scsi_adjust_queue_depth(device,
+                               (device->tagged_supported ?
+                                MSG_SIMPLE_TAG : 0),
+                               depth_to_use);
 
-               /*
-               **      Since the queue depth is not tunable under Linux,
-               **      we need to know this value in order not to 
-               **      announce stupid things to user.
-               */
-               if (lp) {
-                       lp->numtags = lp->maxtags = numtags;
-                       lp->scdev_depth = device->queue_depth;
-               }
-               ncr_setup_tags (np, device->id, device->lun);
+       /*
+       **      Since the queue depth is not tunable under Linux,
+       **      we need to know this value in order not to 
+       **      announce stupid things to user.
+       */
+       if (lp) {
+               lp->numtags = lp->maxtags = numtags;
+               lp->scdev_depth = depth_to_use;
+       }
+       ncr_setup_tags (np, device->id, device->lun);
 
 #ifdef DEBUG_SYM53C8XX
-printk("sym53c8xx_select_queue_depth: host=%d, id=%d, lun=%d, depth=%d\n",
-       np->unit, device->id, device->lun, device->queue_depth);
+       printk("sym53c8xx_select_queue_depth: host=%d, id=%d, lun=%d, depth=%d\n",
+              np->unit, device->id, device->lun, depth_to_use);
 #endif
-       }
+
+       return 0;
 }
 
 /*
index 256d34b6461b90e22dac71fd8e7eee6ae962aa51..cc689df0373d7ca7e70623e482fc0dbf5660e172 100644 (file)
@@ -74,6 +74,7 @@ int sym53c8xx_detect(Scsi_Host_Template *tpnt);
 const char *sym53c8xx_info(struct Scsi_Host *host);
 int sym53c8xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
 int sym53c8xx_reset(Scsi_Cmnd *, unsigned int);
+int sym53c8xx_slave_attach(Scsi_Device *);
 
 #ifdef MODULE
 int sym53c8xx_release(struct Scsi_Host *);
@@ -89,6 +90,7 @@ int sym53c8xx_release(struct Scsi_Host *);
                        release:        sym53c8xx_release,      \
                        info:           sym53c8xx_info,         \
                        queuecommand:   sym53c8xx_queue_command,\
+                       slave_attach:   sym53c8xx_slave_attach, \
                        abort:          sym53c8xx_abort,        \
                        reset:          sym53c8xx_reset,        \
                        bios_param:     scsicam_bios_param,     \
index 0f6114bda6369838a676ab352e1bfa914f6ba419..f36c1c5f29030525110af6a475f34ff1e48c08b2 100644 (file)
@@ -89,6 +89,8 @@ int sym53c8xx_eh_device_reset_handler(Scsi_Cmnd *);
 int sym53c8xx_eh_bus_reset_handler(Scsi_Cmnd *);
 int sym53c8xx_eh_host_reset_handler(Scsi_Cmnd *);
 
+int sym53c8xx_slave_attach(Scsi_Device *);
+
 #ifdef MODULE
 int sym53c8xx_release(struct Scsi_Host *);
 #else
@@ -109,6 +111,7 @@ int sym53c8xx_release(struct Scsi_Host *);
        release:                sym53c8xx_release,                      \
        info:                   sym53c8xx_info,                         \
        queuecommand:           sym53c8xx_queue_command,                \
+       slave_attach:           sym53c8xx_slave_attach,                 \
        eh_abort_handler:       sym53c8xx_eh_abort_handler,             \
        eh_device_reset_handler:sym53c8xx_eh_device_reset_handler,      \
        eh_bus_reset_handler:   sym53c8xx_eh_bus_reset_handler,         \
index 564802b6c8c24e3c4f822e51d7ffdd197148118d..685a29399965d8ca77ce50a6d6ec12de9408e69c 100644 (file)
@@ -1327,66 +1327,63 @@ static int device_queue_depth(hcb_p np, int target, int lun)
 /*
  * Linux entry point for device queue sizing.
  */
-static void 
-sym53c8xx_select_queue_depths(struct Scsi_Host *host, 
-                              struct scsi_device *devlist)
+int
+sym53c8xx_slave_attach(Scsi_Device *device)
 {
-       struct scsi_device *device;
-
-       for (device = devlist; device; device = device->next) {
-               hcb_p np;
-               tcb_p tp;
-               lcb_p lp;
-               int reqtags;
-
-               if (device->host != host)
-                       continue;
+       struct Scsi_Host *host = device->host;
+       hcb_p np;
+       tcb_p tp;
+       lcb_p lp;
+       int reqtags, depth_to_use;
 
-               np = ((struct host_data *) host->hostdata)->ncb;
-               tp = &np->target[device->id];
+       np = ((struct host_data *) host->hostdata)->ncb;
+       tp = &np->target[device->id];
 
-               /*
-                *  Get user settings for transfer parameters.
-                */
-               tp->inq_byte7_valid = (INQ7_SYNC|INQ7_WIDE16);
-               sym_update_trans_settings(np, tp);
+       /*
+        *  Get user settings for transfer parameters.
+        */
+       tp->inq_byte7_valid = (INQ7_SYNC|INQ7_WIDE16);
+       sym_update_trans_settings(np, tp);
 
-               /*
-                *  Allocate the LCB if not yet.
-                *  If it fail, we may well be in the sh*t. :)
-                */
-               lp = sym_alloc_lcb(np, device->id, device->lun);
-               if (!lp) {
-                       device->queue_depth = 1;
-                       continue;
-               }
+       /*
+        *  Allocate the LCB if not yet.
+        *  If it fail, we may well be in the sh*t. :)
+        */
+       lp = sym_alloc_lcb(np, device->id, device->lun);
+       if (!lp)
+               return -ENOMEM;
 
-               /*
-                *  Get user flags.
-                */
-               lp->curr_flags = lp->user_flags;
+       /*
+        *  Get user flags.
+        */
+       lp->curr_flags = lp->user_flags;
 
-               /*
-                *  Select queue depth from driver setup.
-                *  Donnot use more than configured by user.
-                *  Use at least 2.
-                *  Donnot use more than our maximum.
-                */
-               reqtags = device_queue_depth(np, device->id, device->lun);
-               if (reqtags > tp->usrtags)
-                       reqtags = tp->usrtags;
-               if (!device->tagged_supported)
-                       reqtags = 0;
+       /*
+        *  Select queue depth from driver setup.
+        *  Donnot use more than configured by user.
+        *  Use at least 2.
+        *  Donnot use more than our maximum.
+        */
+       reqtags = device_queue_depth(np, device->id, device->lun);
+       if (reqtags > tp->usrtags)
+               reqtags = tp->usrtags;
+       if (!device->tagged_supported)
+               reqtags = 0;
 #if 1 /* Avoid to locally queue commands for no good reasons */
-               if (reqtags > SYM_CONF_MAX_TAG)
-                       reqtags = SYM_CONF_MAX_TAG;
-               device->queue_depth = reqtags ? reqtags : 2;
+       if (reqtags > SYM_CONF_MAX_TAG)
+               reqtags = SYM_CONF_MAX_TAG;
+       depth_to_use = (reqtags ? reqtags : 2);
 #else
-               device->queue_depth = reqtags ? SYM_CONF_MAX_TAG : 2;
+       depth_to_use = (reqtags ? SYM_CONF_MAX_TAG : 2);
 #endif
-               lp->s.scdev_depth = device->queue_depth;
-               sym_tune_dev_queuing(np, device->id, device->lun, reqtags);
-       }
+       scsi_adjust_queue_depth(device,
+                               (device->tagged_supported ?
+                                MSG_SIMPLE_TAG : 0),
+                               depth_to_use);
+       lp->s.scdev_depth = depth_to_use;
+       sym_tune_dev_queuing(np, device->id, device->lun, reqtags);
+
+       return 0;
 }
 
 /*
@@ -2132,7 +2129,6 @@ sym_attach (Scsi_Host_Template *tpnt, int unit, sym_device *dev)
 #if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0)
        instance->max_cmd_len   = 16;
 #endif
-       instance->select_queue_depths = sym53c8xx_select_queue_depths;
        instance->highmem_io    = 1;
 
        SYM_UNLOCK_HCB(np, flags);