Hi.
(I have not been able to find a probable current maintainer for
this code.)
The following patch makes drivers/scsi/seagate.c use ioremap
instead of isa_{read, write} (I have not been able to find
a fitting place to put an iounmap since the driver does not
have a release function). The patch also removes some unneces-
sary zero initialization and fixes some resource leaks in
the init/detection process.
It applies against 241ac19 and 242p4.
Comments?.
--- linux-241ac19-clean/drivers/scsi/seagate.c Sun Nov 12 04:01:11 2000
+++ linux-241ac19/drivers/scsi/seagate.c Tue Feb 20 22:32:10 2001
@@ -230,7 +230,7 @@
static int incommand; /* set if arbitration has finished
and we are in some command phase. */
-static unsigned int base_address = 0; /* Where the card ROM starts, used to
+static unsigned int base_address; /* Where the card ROM starts, used to
calculate memory mapped register
location. */
@@ -243,23 +243,26 @@
static unsigned long st0x_dr; /* data register, read write 256
bytes in length. */
-static volatile int st0x_aborted = 0; /* set when we are aborted, ie by a
+static volatile int st0x_aborted; /* set when we are aborted, ie by a
time out, etc. */
-static unsigned char controller_type = 0; /* set to SEAGATE for ST0x
- boards or FD for TMC-8xx
- boards */
+static unsigned char controller_type; /* set to SEAGATE for ST0x
+ boards or FD for TMC-8xx
+ boards */
static int irq = IRQ;
+static void *status_remap;
+static void *data_remap;
+
MODULE_PARM(base_address, "i");
MODULE_PARM(controller_type, "b");
MODULE_PARM(irq, "i");
#define retcode(result) (((result) << 16) | (message << 8) | status)
-#define STATUS ((u8) isa_readb(st0x_cr_sr))
-#define DATA ((u8) isa_readb(st0x_dr))
-#define WRITE_CONTROL(d) { isa_writeb((d), st0x_cr_sr); }
-#define WRITE_DATA(d) { isa_writeb((d), st0x_dr); }
+#define STATUS ((u8) readb(status_remap))
+#define DATA ((u8) readb(data_remap))
+#define WRITE_CONTROL(d) { writeb((d), status_remap); }
+#define WRITE_DATA(d) { writeb((d), data_remap); }
void st0x_setup (char *str, int *ints)
{
@@ -489,13 +492,13 @@
*/
instance = scsi_register (tpnt, 0);
if(instance == NULL)
- return 0;
+ goto err_scsi_register;
hostno = instance->host_no;
if (request_irq (irq, do_seagate_reconnect_intr, SA_INTERRUPT,
(controller_type == SEAGATE) ? "seagate" : "tmc-8xx", NULL)) {
printk ("scsi%d : unable to allocate IRQ%d\n", hostno, irq);
- return 0;
+ goto err_request_irq;
}
instance->irq = irq;
instance->io_port = base_address;
@@ -546,7 +549,25 @@
" SWAPCNTDATA"
#endif
"\n", tpnt->name);
+
+ status_remap = ioremap(st0x_cr_sr, sizeof(u8));
+ if (!status_remap)
+ goto err_status_remap;
+
+ data_remap = ioremap(st0x_dr, sizeof(u8));
+ if (!data_remap)
+ goto err_data_remap;
+
return 1;
+
+ err_data_remap:
+ iounmap(status_remap);
+ err_status_remap:
+ free_irq(irq, do_seagate_reconnect_intr);
+ err_request_irq:
+ scsi_unregister(instance);
+ err_scsi_register:
+ return 0;
}
const char *seagate_st0x_info (struct Scsi_Host *shpnt)
-- Rasmus(rasmus@jaquet.dk)It is wonderful to be here in the great state of Chicago. -Former U.S. Vice-President Dan Quayle - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Fri Feb 23 2001 - 21:00:23 EST