Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux...
[sfrench/cifs-2.6.git] / drivers / scsi / 53c7xx.c
index 9cb5dd48383fbdde590270a36ac13512dafabb64..c690c2b89e41ddf59abb611a3a7c2f43448bbed8 100644 (file)
 
 #include <linux/module.h>
 
-#include <linux/config.h>
 
 #include <linux/types.h>
 #include <asm/setup.h>
 #include "scsi.h"
 #include <scsi/scsi_dbg.h>
 #include <scsi/scsi_host.h>
+#include <scsi/scsi_transport_spi.h>
 #include "53c7xx.h"
 #include <linux/stat.h>
 #include <linux/stddef.h>
@@ -360,7 +360,7 @@ int CmdPageStart = (0 - Ent_dsa_zero - sizeof(struct NCR53c7x0_cmd)) & 0xff;
 static char *setup_strings[] =
        {"","","","","","","",""};
 
-#define MAX_SETUP_STRINGS (sizeof(setup_strings) / sizeof(char *))
+#define MAX_SETUP_STRINGS ARRAY_SIZE(setup_strings)
 #define SETUP_BUFFER_SIZE 200
 static char setup_buffer[SETUP_BUFFER_SIZE];
 static char setup_used[MAX_SETUP_STRINGS];
@@ -708,7 +708,7 @@ request_synchronous (int host, int target) {
        printk (KERN_ALERT "target %d is host ID\n", target);
        return -1;
     } 
-    else if (target > h->max_id) {
+    else if (target >= h->max_id) {
        printk (KERN_ALERT "target %d exceeds maximum of %d\n", target,
            h->max_id);
        return -1;
@@ -1070,7 +1070,7 @@ NCR53c7x0_init (struct Scsi_Host *host) {
 
     NCR53c7x0_driver_init (host);
 
-    if (request_irq(host->irq, NCR53c7x0_intr, SA_SHIRQ, "53c7xx", host))
+    if (request_irq(host->irq, NCR53c7x0_intr, IRQF_SHARED, "53c7xx", host))
     {
        printk("scsi%d : IRQ%d not free, detaching\n",
                host->host_no, host->irq);
@@ -1724,7 +1724,7 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) {
                printk ("scsi%d : status ", host->host_no);
                scsi_print_status (status);
                printk ("\nscsi%d : message ", host->host_no);
-               scsi_print_msg (&msg);
+               spi_print_msg(&msg);
                printk ("\n");
            } else if (hostdata->test_completed == 3) {
                printk("scsi%d : test 2 no connection with target %d\n",
@@ -2189,15 +2189,15 @@ static const struct {
  */
 
 
-static void 
+static void
 synchronous (struct Scsi_Host *host, int target, char *msg) {
     struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *)
        host->hostdata[0];
     int desire, divisor, i, limit;
     unsigned char scntl3, sxfer;
 /* The diagnostic message fits on one line, even with max. width integers */
-    char buf[80];      
-   
+    char buf[80];
+
 /* Desired transfer clock in Hz */
     desire = 1000000000L / (msg[3] * 4);
 /* Scale the available SCSI clock by 10 so we get tenths */
@@ -2208,14 +2208,14 @@ synchronous (struct Scsi_Host *host, int target, char *msg) {
        msg[4] = 8;
 
     if (hostdata->options & OPTION_DEBUG_SDTR)
-       printk("scsi%d : optimal synchronous divisor of %d.%01d\n", 
+       printk("scsi%d : optimal synchronous divisor of %d.%01d\n",
            host->host_no, divisor / 10, divisor % 10);
 
-    limit = (sizeof(syncs) / sizeof(syncs[0]) -1);
+    limit = ARRAY_SIZE(syncs) - 1;
     for (i = 0; (i < limit) && (divisor > syncs[i].div); ++i);
 
     if (hostdata->options & OPTION_DEBUG_SDTR)
-       printk("scsi%d : selected synchronous divisor of %d.%01d\n", 
+       printk("scsi%d : selected synchronous divisor of %d.%01d\n",
            host->host_no, syncs[i].div / 10, syncs[i].div % 10);
 
     msg[3] = ((1000000000L / hostdata->scsi_clock) * syncs[i].div / 10 / 4);
@@ -2313,7 +2313,7 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct
            printk ("scsi%d : received message", host->host_no);
            if (c) 
                printk (" from target %d lun %d ", c->device->id, c->device->lun);
-           scsi_print_msg ((unsigned char *) hostdata->msg_buf);
+           spi_print_msg((unsigned char *) hostdata->msg_buf);
            printk("\n");
        }
        
@@ -3621,7 +3621,7 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) {
 #ifdef LINUX_1_2
        || cmd->device->id > 7
 #else
-       || cmd->device->id > host->max_id
+       || cmd->device->id >= host->max_id
 #endif
        || cmd->device->id == host->this_id
        || hostdata->state == STATE_DISABLED) {
@@ -4232,7 +4232,7 @@ restart:
  * Purpose : handle NCR53c7x0 interrupts for all NCR devices sharing
  *     the same IRQ line.  
  * 
- * Inputs : Since we're using the SA_INTERRUPT interrupt handler
+ * Inputs : Since we're using the IRQF_DISABLED interrupt handler
  *     semantics, irq indicates the interrupt which invoked 
  *     this handler.  
  *
@@ -5540,7 +5540,7 @@ print_dsa (struct Scsi_Host *host, u32 *dsa, const char *prefix) {
            i > 0 && !check_address ((unsigned long) ptr, 1);
            ptr += len, i -= len) {
            printk("               ");
-           len = scsi_print_msg (ptr);
+           len = spi_print_msg(ptr);
            printk("\n");
            if (!len)
                break;