public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Andersen <rasmus@jaquet.dk>
To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: make drivers/scsi/seagate.c use ioremap instead of isa_{read,write} (242p4)
Date: Tue, 20 Feb 2001 22:43:44 +0100	[thread overview]
Message-ID: <20010220224344.D786@jaquet.dk> (raw)

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

                 reply	other threads:[~2001-02-20 21:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010220224344.D786@jaquet.dk \
    --to=rasmus@jaquet.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox