fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / scsi / pluto.c
index 7bb0a2e..3b2e1a5 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/proc_fs.h>
 #include <linux/stat.h>
 #include <linux/init.h>
-#include <linux/config.h>
 #ifdef CONFIG_KMOD
 #include <linux/kmod.h>
 #endif
@@ -27,6 +26,9 @@
 
 #include <linux/module.h>
 
+#define RQ_SCSI_BUSY           0xffff
+#define RQ_SCSI_DONE           0xfffe
+
 /* #define PLUTO_DEBUG */
 
 #define pluto_printk printk ("PLUTO %s: ", fc->name); printk
@@ -45,7 +47,7 @@ static struct ctrl_inquiry {
        Scsi_Cmnd cmd;
        char inquiry[256];
        fc_channel *fc;
-} *fcs __initdata = { 0 };
+} *fcs __initdata;
 static int fcscount __initdata = 0;
 static atomic_t fcss __initdata = ATOMIC_INIT(0);
 DECLARE_MUTEX_LOCKED(fc_sem);
@@ -65,13 +67,12 @@ static void __init pluto_detect_done(Scsi_Cmnd *SCpnt)
 
 static void __init pluto_detect_scsi_done(Scsi_Cmnd *SCpnt)
 {
-       SCpnt->request->rq_status = RQ_SCSI_DONE;
        PLND(("Detect done %08lx\n", (long)SCpnt))
        if (atomic_dec_and_test (&fcss))
                up(&fc_sem);
 }
 
-int pluto_slave_configure(Scsi_Device *device)
+int pluto_slave_configure(struct scsi_device *device)
 {
        int depth_to_use;
 
@@ -90,13 +91,12 @@ int pluto_slave_configure(Scsi_Device *device)
 
 /* Detect all SSAs attached to the machine.
    To be fast, do it on all online FC channels at the same time. */
-int __init pluto_detect(Scsi_Host_Template *tpnt)
+int __init pluto_detect(struct scsi_host_template *tpnt)
 {
        int i, retry, nplutos;
        fc_channel *fc;
-       Scsi_Device dev;
-       struct timer_list fc_timer =
-               TIMER_INITIALIZER(pluto_detect_timeout, 0, 0);
+       struct scsi_device dev;
+       DEFINE_TIMER(fc_timer, pluto_detect_timeout, 0, 0);
 
        tpnt->proc_name = "pluto";
        fcscount = 0;
@@ -117,7 +117,7 @@ int __init pluto_detect(Scsi_Host_Template *tpnt)
 #endif
                        return 0;
        }
-       fcs = (struct ctrl_inquiry *) kmalloc (sizeof (struct ctrl_inquiry) * fcscount, GFP_DMA);
+       fcs = kmalloc(sizeof (struct ctrl_inquiry) * fcscount, GFP_DMA);
        if (!fcs) {
                printk ("PLUTO: Not enough memory to probe\n");
                return 0;
@@ -165,11 +165,9 @@ int __init pluto_detect(Scsi_Host_Template *tpnt)
                
                SCpnt->cmd_len = COMMAND_SIZE(INQUIRY);
        
-               SCpnt->request->rq_status = RQ_SCSI_BUSY;
+               SCpnt->request->cmd_flags &= ~REQ_STARTED;
                
                SCpnt->done = pluto_detect_done;
-               SCpnt->bufflen = 256;
-               SCpnt->buffer = fcs[i].inquiry;
                SCpnt->request_bufflen = 256;
                SCpnt->request_buffer = fcs[i].inquiry;
                PLD(("set up %d %08lx\n", i, (long)SCpnt))
@@ -179,7 +177,8 @@ int __init pluto_detect(Scsi_Host_Template *tpnt)
        for (retry = 0; retry < 5; retry++) {
                for (i = 0; i < fcscount; i++) {
                        if (!fcs[i].fc) break;
-                       if (fcs[i].cmd.request->rq_status != RQ_SCSI_DONE) {
+                       if (!(fcs[i].cmd.request->cmd_flags & REQ_STARTED)) {
+                               fcs[i].cmd.request->cmd_flags |= REQ_STARTED;
                                disable_irq(fcs[i].fc->irq);
                                PLND(("queuecommand %d %d\n", retry, i))
                                fcp_scsi_queuecommand (&(fcs[i].cmd), 
@@ -340,7 +339,7 @@ static int pluto_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cm
        return 0;
 }
 
-static Scsi_Host_Template driver_template = {
+static struct scsi_host_template driver_template = {
        .name                   = "Sparc Storage Array 100/200",
        .detect                 = pluto_detect,
        .release                = pluto_release,
@@ -354,7 +353,6 @@ static Scsi_Host_Template driver_template = {
        .use_clustering         = ENABLE_CLUSTERING,
        .eh_abort_handler       = fcp_scsi_abort,
        .eh_device_reset_handler = fcp_scsi_dev_reset,
-       .eh_bus_reset_handler   = fcp_scsi_bus_reset,
        .eh_host_reset_handler  = fcp_scsi_host_reset,
 };