[parisc-linux-cvs] fix zalon7xx module loading/unloading

Richard Hirst rhirst@linuxcare.com
Tue, 18 Jun 2002 22:24:14 +0100


Fix up zalon support so we can insmod and rmmod zalon7xx_mod and insmod
again.  Remove compiler warnings.


Index: drivers/scsi/zalon7xx.c
===================================================================
RCS file: /var/cvs/linux/drivers/scsi/zalon7xx.c,v
retrieving revision 1.13
diff -u -r1.13 zalon7xx.c
--- drivers/scsi/zalon7xx.c	2001/12/03 23:05:07	1.13
+++ drivers/scsi/zalon7xx.c	2002/06/18 21:43:37
@@ -71,11 +71,11 @@
 	if (status == PDC_RET_OK) {
 		clock = (int) pdc_result[16];
 	} else {
-		printk(KERN_WARNING __FUNCTION__ ": pdc_iodc_read returned %d\n", status);
+		printk(KERN_WARNING "%s: pdc_iodc_read returned %d\n", __FUNCTION__, status);
 		clock = defaultclock; 
 	}
 
-	printk(KERN_DEBUG __FUNCTION__ ": SCSI clock %d\n", clock);
+	printk(KERN_DEBUG "%s: SCSI clock %d\n", __FUNCTION__, clock);
  	return clock;
 }
 #endif
@@ -103,13 +103,13 @@
 	*/
         irq = gsc_alloc_irq(&gsc_irq);
 
-	printk(__FUNCTION__ ": Zalon vers field is 0x%x, IRQ %d\n",
+	printk("%s: Zalon vers field is 0x%x, IRQ %d\n", __FUNCTION__,
 		zalon_vers, irq);
 
 	__raw_writel(gsc_irq.txn_addr | gsc_irq.txn_data, dev->hpa + IO_MODULE_EIM);
 
 	if ( zalon_vers == 0)
-		printk(KERN_WARNING __FUNCTION__ ": Zalon 1.1 or earlier\n");
+		printk(KERN_WARNING "%s: Zalon 1.1 or earlier\n", __FUNCTION__);
 
 	/*
 	**  zalon_attach: returns -1 on failure, 0 on success
@@ -150,3 +150,13 @@
 	return (hosts_used != 0);
 }
 
+#ifdef MODULE
+extern int ncr53c8xx_release(struct Scsi_Host *host);
+
+int zalon7xx_release(struct Scsi_Host *host)
+{
+	ncr53c8xx_release(host);
+	unregister_parisc_driver(&zalon_driver);
+	return 1;
+}
+#endif
Index: drivers/scsi/zalon7xx.h
===================================================================
RCS file: /var/cvs/linux/drivers/scsi/zalon7xx.h,v
retrieving revision 1.3
diff -u -r1.3 zalon7xx.h
--- drivers/scsi/zalon7xx.h	2001/04/30 08:59:45	1.3
+++ drivers/scsi/zalon7xx.h	2002/06/18 21:43:37
@@ -19,14 +19,14 @@
 int ncr53c8xx_reset(Scsi_Cmnd *, unsigned int);
 
 #ifdef MODULE
-int ncr53c8xx_release(struct Scsi_Host *);
+int zalon7xx_release(struct Scsi_Host *);
 #else
-#define ncr53c8xx_release NULL
+#define zalon7xx_release NULL
 #endif
 
 #define SCSI_ZALON { proc_name:		"zalon720",	\
 			detect:         zalon7xx_detect,	\
-			release:        ncr53c8xx_release,	\
+			release:        zalon7xx_release,	\
 			info:           ncr53c8xx_info, 	\
 			queuecommand:   ncr53c8xx_queue_command,\
 			abort:          ncr53c8xx_abort,	\
Index: drivers/scsi/ncr53c8xx.c
===================================================================
RCS file: /var/cvs/linux/drivers/scsi/ncr53c8xx.c,v
retrieving revision 1.22
diff -u -r1.22 ncr53c8xx.c
--- drivers/scsi/ncr53c8xx.c	2002/01/03 22:37:17	1.22
+++ drivers/scsi/ncr53c8xx.c	2002/06/18 21:43:41
@@ -3772,7 +3772,9 @@
 	**	Try to map the controller chip into iospace.
 	*/
 
+#ifndef ENABLE_SCSI_ZALON
 	request_region(device->slot.io_port, 128, "ncr53c8xx");
+#endif
 	np->base_io = device->slot.io_port;
 
 #ifdef SCSI_NCR_NVRAM_SUPPORT
@@ -4003,7 +4005,9 @@
 #ifdef DEBUG_NCR53C8XX
 		printk(KERN_DEBUG "%s: releasing IO region %x[%d]\n", ncr_name(np), np->base_io, 128);
 #endif
+#ifndef ENABLE_SCSI_ZALON
 		release_region(np->base_io, 128);
+#endif
 	}
 	if (np->irq) {
 #ifdef DEBUG_NCR53C8XX
@@ -5109,7 +5113,9 @@
 #ifdef DEBUG_NCR53C8XX
 	printk("%s: releasing IO region %x[%d]\n", ncr_name(np), np->base_io, 128);
 #endif
+#ifndef ENABLE_SCSI_ZALON
 	release_region(np->base_io, 128);
+#endif
 
 	/*
 	**	Free allocated ccb(s)
Index: drivers/scsi/sym53c8xx_defs.h
===================================================================
RCS file: /var/cvs/linux/drivers/scsi/sym53c8xx_defs.h,v
retrieving revision 1.16
diff -u -r1.16 sym53c8xx_defs.h
--- drivers/scsi/sym53c8xx_defs.h	2002/01/03 22:37:18	1.16
+++ drivers/scsi/sym53c8xx_defs.h	2002/06/18 21:43:42
@@ -405,9 +405,9 @@
 #define	writew_b2l	__raw_writew
 #define	writel_b2l	__raw_writel
 #define	readw_raw	__raw_readw
-#define	readl_raw	__raw_readl
+#define	readl_raw(a)	__raw_readl((unsigned long)(a))
 #define	writew_raw	__raw_writew
-#define	writel_raw	__raw_writel
+#define	writel_raw(v,a)	__raw_writel(v,(unsigned long)(a))
 #else	/* Other bid-endian */
 #define	readw_l2b	readw
 #define	readl_l2b	readl