vserver 1.9.5.x5
[linux-2.6.git] / drivers / scsi / wd7000.c
index 193e40c..bf4a758 100644 (file)
 #include <scsi/scsicam.h>
 
 
-#define ANY2SCSI_INLINE                /* undef this to use old macros */
 #undef  WD7000_DEBUG           /* general debug                */
 #ifdef WD7000_DEBUG
 #define dprintk printk
@@ -590,7 +589,7 @@ typedef union icb {
 
 #ifdef MODULE
 static char *wd7000;
-MODULE_PARM(wd7000, "s");
+module_param(wd7000, charp, 0);
 #endif
 
 /*
@@ -726,55 +725,17 @@ static int __init wd7000_setup(char *str)
 
 __setup("wd7000=", wd7000_setup);
 
-#ifdef ANY2SCSI_INLINE
-/*
- * Since they're used a lot, I've redone the following from the macros
- * formerly in wd7000.h, hopefully to speed them up by getting rid of
- * all the shifting (it may not matter; GCC might have done as well anyway).
- *
- * xany2scsi and xscsi2int were not being used, and are no longer defined.
- * (They were simply 4-byte versions of these routines).
- */
-typedef union {                        /* let's cheat... */
-       int i;
-       unchar u[sizeof(int)];  /* the sizeof(int) makes it more portable */
-} i_u;
-
-
 static inline void any2scsi(unchar * scsi, int any)
 {
-       *scsi++ = ((i_u) any).u[2];
-       *scsi++ = ((i_u) any).u[1];
-       *scsi++ = ((i_u) any).u[0];
+       *scsi++ = (unsigned)any >> 16;
+       *scsi++ = (unsigned)any >> 8;
+       *scsi++ = any;
 }
 
-
 static inline int scsi2int(unchar * scsi)
 {
-       i_u result;
-
-       result.i = 0;           /* clears unused bytes */
-       result.u[2] = *scsi++;
-       result.u[1] = *scsi++;
-       result.u[0] = *scsi++;
-
-       return (result.i);
+       return (scsi[0] << 16) | (scsi[1] << 8) | scsi[2];
 }
-#else
-/*
- * These are the old ones - I've just moved them here...
- */
-#undef any2scsi
-#define any2scsi(up, p)   (up)[0] = (((unsigned long) (p)) >> 16);     \
-                         (up)[1] = ((unsigned long) (p)) >> 8;         \
-                         (up)[2] = ((unsigned long) (p));
-
-#undef scsi2int
-#define scsi2int(up)   ( (((unsigned long) *(up)) << 16) +     \
-                        (((unsigned long) (up)[1]) << 8) +     \
-                        ((unsigned long) (up)[2]) )
-#endif
-
 
 static inline void wd7000_enable_intr(Adapter * host)
 {
@@ -1468,16 +1429,16 @@ static int wd7000_detect(struct scsi_host_template *tpnt)
                                                break;
 
                                if (i == pass) {
-                                       void *biosaddr = ioremap(wd7000_biosaddr[biosaddr_ptr] + signatures[sig_ptr].ofs,
+                                       void __iomem *biosaddr = ioremap(wd7000_biosaddr[biosaddr_ptr] + signatures[sig_ptr].ofs,
                                                                 signatures[sig_ptr].len);
-                                       short bios_match = 0;
+                                       short bios_match = 1;
 
                                        if (biosaddr)
-                                               bios_match = memcmp((char *) biosaddr, signatures[sig_ptr].sig, signatures[sig_ptr].len);
+                                               bios_match = check_signature(biosaddr, signatures[sig_ptr].sig, signatures[sig_ptr].len);
 
                                        iounmap(biosaddr);
 
-                                       if (!bios_match)
+                                       if (bios_match)
                                                goto bios_matched;
                                }
                        }
@@ -1512,8 +1473,7 @@ static int wd7000_detect(struct scsi_host_template *tpnt)
                         * ASC reset...
                         */
                        outb(ASC_RES, iobase + ASC_CONTROL);
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout(HZ / 100);
+                       msleep(10);
                        outb(0, iobase + ASC_CONTROL);
 
                        if (WAIT(iobase + ASC_STAT, ASC_STATMASK, CMD_RDY, 0)) {