]> err.no Git - linux-2.6/blobdiff - drivers/scsi/aha1542.c
Merge branch 'upstream-fixes' into upstream
[linux-2.6] / drivers / scsi / aha1542.c
index adda750412f29a25ad0d870995062c10b7d54606..24f0f5461792d4068c35d053a6967cb4525b6347 100644 (file)
@@ -25,7 +25,6 @@
  *        Added proper detection of the AHA-1640 (MCA version of AHA-1540)
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
@@ -543,10 +542,8 @@ static void aha1542_intr_handle(struct Scsi_Host *shost, void *dev_id, struct pt
                        return;
                }
                my_done = SCtmp->scsi_done;
-               if (SCtmp->host_scribble) {
-                       kfree(SCtmp->host_scribble);
-                       SCtmp->host_scribble = NULL;
-               }
+               kfree(SCtmp->host_scribble);
+               SCtmp->host_scribble = NULL;
                /* Fetch the sense data, and tuck it away, in the required slot.  The
                   Adaptec automatically fetches it, and there is no guarantee that
                   we will still have it in the cdb when we come back */
@@ -1013,7 +1010,7 @@ static int __init do_setup(char *str)
 
        int count=setup_idx;
 
-       get_options(str, sizeof(ints)/sizeof(int), ints);
+       get_options(str, ARRAY_SIZE(ints), ints);
        aha1542_setup(str,ints);
 
        return count<setup_idx;
@@ -1023,7 +1020,7 @@ __setup("aha1542=",do_setup);
 #endif
 
 /* return non-zero on detection */
-static int __init aha1542_detect(Scsi_Host_Template * tpnt)
+static int __init aha1542_detect(struct scsi_host_template * tpnt)
 {
        unsigned char dma_chan;
        unsigned char irq_level;
@@ -1074,8 +1071,7 @@ static int __init aha1542_detect(Scsi_Host_Template * tpnt)
                int slot = 0;
                int pos = 0;
 
-               for (indx = 0; (slot !=  MCA_NOTFOUND) && 
-                            (indx < sizeof(bases)/sizeof(bases[0])); indx++) {
+               for (indx = 0; (slot != MCA_NOTFOUND) && (indx < ARRAY_SIZE(bases)); indx++) {
 
                        if (bases[indx])
                                continue;
@@ -1085,10 +1081,9 @@ static int __init aha1542_detect(Scsi_Host_Template * tpnt)
                        if (slot == MCA_NOTFOUND)
                                break;
 
-                       
                        /* Found one */
                        pos = mca_read_stored_pos(slot, 3);
-                       
+
                        /* Decode address */
                        if (pos & 0x80) {
                                if (pos & 0x02) {
@@ -1120,23 +1115,22 @@ static int __init aha1542_detect(Scsi_Host_Template * tpnt)
                        mca_set_adapter_name(slot, "Adapter AHA-1640");
                        mca_set_adapter_procfn(slot, NULL, NULL);
                        mca_mark_as_used(slot);
-                       
+
                        /* Go on */
                        slot++;
                }
-               
+
        }
 #endif
 
        /*
         *      Hunt for ISA Plug'n'Pray Adaptecs (AHA1535)
         */
-        
+
        if(isapnp)
        {
                struct pnp_dev *pdev = NULL;
-               for(indx = 0; indx <sizeof(bases)/sizeof(bases[0]);indx++)
-               {
+               for(indx = 0; indx < ARRAY_SIZE(bases); indx++) {
                        if(bases[indx])
                                continue;
                        pdev = pnp_find_dev(NULL, ISAPNP_VENDOR('A', 'D', 'P'), 
@@ -1146,29 +1140,29 @@ static int __init aha1542_detect(Scsi_Host_Template * tpnt)
                        /*
                         *      Activate the PnP card
                         */
-                        
+
                        if(pnp_device_attach(pdev)<0)
                                continue;
-                       
+
                        if(pnp_activate_dev(pdev)<0) {
                                pnp_device_detach(pdev);
                                continue;
                        }
-                       
+
                        if(!pnp_port_valid(pdev, 0)) {
                                pnp_device_detach(pdev);
                                continue;
                        }
-                               
+
                        bases[indx] = pnp_port_start(pdev, 0);
-                       
+
                        /* The card can be queried for its DMA, we have 
                           the DMA set up that is enough */
-                          
+
                        printk(KERN_INFO "ISAPnP found an AHA1535 at I/O 0x%03X\n", bases[indx]);
                }
        }
-       for (indx = 0; indx < sizeof(bases) / sizeof(bases[0]); indx++)
+       for (indx = 0; indx < ARRAY_SIZE(bases); indx++)
                if (bases[indx] != 0 && request_region(bases[indx], 4, "aha1542")) {
                        shpnt = scsi_register(tpnt,
                                        sizeof(struct aha1542_hostdata));
@@ -1432,10 +1426,8 @@ static int aha1542_dev_reset(Scsi_Cmnd * SCpnt)
                    HOSTDATA(SCpnt->host)->SCint[i]->target == SCpnt->target) {
                        Scsi_Cmnd *SCtmp;
                        SCtmp = HOSTDATA(SCpnt->host)->SCint[i];
-                       if (SCtmp->host_scribble) {
-                               kfree(SCtmp->host_scribble);
-                               SCtmp->host_scribble = NULL;
-                       }
+                       kfree(SCtmp->host_scribble);
+                       SCtmp->host_scribble = NULL;
                        HOSTDATA(SCpnt->host)->SCint[i] = NULL;
                        HOSTDATA(SCpnt->host)->mb[i].status = 0;
                }
@@ -1495,10 +1487,8 @@ static int aha1542_bus_reset(Scsi_Cmnd * SCpnt)
                                 */
                                continue;
                        }
-                       if (SCtmp->host_scribble) {
-                               kfree(SCtmp->host_scribble);
-                               SCtmp->host_scribble = NULL;
-                       }
+                       kfree(SCtmp->host_scribble);
+                       SCtmp->host_scribble = NULL;
                        HOSTDATA(SCpnt->device->host)->SCint[i] = NULL;
                        HOSTDATA(SCpnt->device->host)->mb[i].status = 0;
                }
@@ -1565,10 +1555,8 @@ static int aha1542_host_reset(Scsi_Cmnd * SCpnt)
                                 */
                                continue;
                        }
-                       if (SCtmp->host_scribble) {
-                               kfree(SCtmp->host_scribble);
-                               SCtmp->host_scribble = NULL;
-                       }
+                       kfree(SCtmp->host_scribble);
+                       SCtmp->host_scribble = NULL;
                        HOSTDATA(SCpnt->device->host)->SCint[i] = NULL;
                        HOSTDATA(SCpnt->device->host)->mb[i].status = 0;
                }
@@ -1711,10 +1699,8 @@ static int aha1542_old_reset(Scsi_Cmnd * SCpnt, unsigned int reset_flags)
                                Scsi_Cmnd *SCtmp;
                                SCtmp = HOSTDATA(SCpnt->host)->SCint[i];
                                SCtmp->result = DID_RESET << 16;
-                               if (SCtmp->host_scribble) {
-                                       kfree(SCtmp->host_scribble);
-                                       SCtmp->host_scribble = NULL;
-                               }
+                               kfree(SCtmp->host_scribble);
+                               SCtmp->host_scribble = NULL;
                                printk(KERN_WARNING "Sending DID_RESET for target %d\n", SCpnt->target);
                                SCtmp->scsi_done(SCpnt);
 
@@ -1757,10 +1743,8 @@ fail:
                                                Scsi_Cmnd *SCtmp;
                                                SCtmp = HOSTDATA(SCpnt->host)->SCint[i];
                                                SCtmp->result = DID_RESET << 16;
-                                               if (SCtmp->host_scribble) {
-                                                       kfree(SCtmp->host_scribble);
-                                                       SCtmp->host_scribble = NULL;
-                                               }
+                                               kfree(SCtmp->host_scribble);
+                                               SCtmp->host_scribble = NULL;
                                                printk(KERN_WARNING "Sending DID_RESET for target %d\n", SCpnt->target);
                                                SCtmp->scsi_done(SCpnt);
 
@@ -1801,7 +1785,7 @@ static int aha1542_biosparam(struct scsi_device *sdev,
 MODULE_LICENSE("GPL");
 
 
-static Scsi_Host_Template driver_template = {
+static struct scsi_host_template driver_template = {
        .proc_name              = "aha1542",
        .name                   = "Adaptec 1542",
        .detect                 = aha1542_detect,