m68k/scsi: a3000 - Do not use legacy Scsi_Host.base
[safe/jmp/linux-2.6] / drivers / scsi / aha152x.c
index a09b2d3..8eab858 100644 (file)
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
 #include <linux/list.h>
+#include <linux/slab.h>
 #include <scsi/scsicam.h>
 
 #include "scsi.h"
@@ -288,20 +289,20 @@ static LIST_HEAD(aha152x_host_list);
 #define DO_LOCK(flags) \
        do { \
                if(spin_is_locked(&QLOCK)) { \
-                       DPRINTK(debug_intr, DEBUG_LEAD "(%s:%d) already locked at %s:%d\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__, QLOCKER, QLOCKERL); \
+                       DPRINTK(debug_intr, DEBUG_LEAD "(%s:%d) already locked at %s:%d\n", CMDINFO(CURRENT_SC), __func__, __LINE__, QLOCKER, QLOCKERL); \
                } \
-               DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) locking\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \
+               DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) locking\n", CMDINFO(CURRENT_SC), __func__, __LINE__); \
                spin_lock_irqsave(&QLOCK,flags); \
-               DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) locked\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \
-               QLOCKER=__FUNCTION__; \
+               DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) locked\n", CMDINFO(CURRENT_SC), __func__, __LINE__); \
+               QLOCKER=__func__; \
                QLOCKERL=__LINE__; \
        } while(0)
 
 #define DO_UNLOCK(flags)       \
        do { \
-               DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) unlocking (locked at %s:%d)\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__, QLOCKER, QLOCKERL); \
+               DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) unlocking (locked at %s:%d)\n", CMDINFO(CURRENT_SC), __func__, __LINE__, QLOCKER, QLOCKERL); \
                spin_unlock_irqrestore(&QLOCK,flags); \
-               DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) unlocked\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \
+               DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) unlocked\n", CMDINFO(CURRENT_SC), __func__, __LINE__); \
                QLOCKER="(not locked)"; \
                QLOCKERL=0; \
        } while(0)
@@ -337,7 +338,7 @@ CMD_INC_RESID(struct scsi_cmnd *cmd, int inc)
 #else
 #define IRQ_MIN 9
 #if defined(__PPC)
-#define IRQ_MAX (NR_IRQS-1)
+#define IRQ_MAX (nr_irqs-1)
 #else
 #define IRQ_MAX 12
 #endif
@@ -994,13 +995,13 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete,
        SCpnt->SCp.sent_command = 0;
 
        if(SCpnt->SCp.phase & (resetting|check_condition)) {
-               if(SCpnt->host_scribble==0 || SCSEM(SCpnt) || SCNEXT(SCpnt)) {
+               if (!SCpnt->host_scribble || SCSEM(SCpnt) || SCNEXT(SCpnt)) {
                        printk(ERR_LEAD "cannot reuse command\n", CMDINFO(SCpnt));
                        return FAILED;
                }
        } else {
                SCpnt->host_scribble = kmalloc(sizeof(struct aha152x_scdata), GFP_ATOMIC);
-               if(SCpnt->host_scribble==0) {
+               if(!SCpnt->host_scribble) {
                        printk(ERR_LEAD "allocation failed\n", CMDINFO(SCpnt));
                        return FAILED;
                }
@@ -1162,7 +1163,7 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt)
        }
 
        DO_LOCK(flags);
-       issued       = remove_SC(&ISSUE_SC, SCpnt)==0;
+       issued       = remove_SC(&ISSUE_SC, SCpnt) == NULL;
        disconnected = issued && remove_SC(&DISCONNECTED_SC, SCpnt);
        DO_UNLOCK(flags);
 
@@ -3582,7 +3583,7 @@ static int checksetup(struct aha152x_setup *setup)
        if (i == ARRAY_SIZE(ports))
                return 0;
 
-       if ( request_region(setup->io_port, IO_RANGE, "aha152x")==0 ) {
+       if (!request_region(setup->io_port, IO_RANGE, "aha152x")) {
                printk(KERN_ERR "aha152x: io port 0x%x busy.\n", setup->io_port);
                return 0;
        }
@@ -3830,7 +3831,7 @@ static int __init aha152x_init(void)
                        iounmap(p);
                }
                if (!ok && setup_count == 0)
-                       return 0;
+                       return -ENODEV;
 
                printk(KERN_INFO "aha152x: BIOS test: passed, ");
 #else
@@ -3842,7 +3843,7 @@ static int __init aha152x_init(void)
                        if ((setup_count == 1) && (setup[0].io_port == ports[i]))
                                continue;
 
-                       if ( request_region(ports[i], IO_RANGE, "aha152x")==0 ) {
+                       if (!request_region(ports[i], IO_RANGE, "aha152x")) {
                                printk(KERN_ERR "aha152x: io port 0x%x busy.\n", ports[i]);
                                continue;
                        }
@@ -3909,14 +3910,14 @@ static int __init aha152x_init(void)
 #endif
        }
 
-       return 1;
+       return 0;
 }
 
 static void __exit aha152x_exit(void)
 {
-       struct aha152x_hostdata *hd;
+       struct aha152x_hostdata *hd, *tmp;
 
-       list_for_each_entry(hd, &aha152x_host_list, host_list) {
+       list_for_each_entry_safe(hd, tmp, &aha152x_host_list, host_list) {
                struct Scsi_Host *shost = container_of((void *)hd, struct Scsi_Host, hostdata);
 
                aha152x_release(shost);