* [PATCH] make drivers/scsi/seagate.c use ioremap instead of isa_{read,write} (241p11)
@ 2001-01-29 21:59 Rasmus Andersen
2001-01-29 22:08 ` Brian Gerst
0 siblings, 1 reply; 2+ messages in thread
From: Rasmus Andersen @ 2001-01-29 21:59 UTC (permalink / raw)
To: linux-scsi, linux-kernel
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}.
It applies against ac12 and 241p11.
Please comment, esp. on the size of the remappings.
--- linux-ac12-clean/drivers/scsi/seagate.c Sun Nov 12 04:01:11 2000
+++ linux-ac12/drivers/scsi/seagate.c Sun Jan 28 21:52:39 2001
@@ -256,10 +256,31 @@
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) read_data(st0x_cr_sr))
+#define DATA ((u8) read_data(st0x_dr))
+#define WRITE_CONTROL(d) write_data(d, st0x_cr_sr)
+#define WRITE_DATA(d) write_data(d, st0x_dr)
+
+static inline u8 read_data(unsigned long offset) {
+ void *ptr = ioremap(offset, sizeof(u8));
+ u8 ret;
+
+ if (!ptr)
+ return 1;
+ ret = readb(ptr);
+ iounmap(ptr);
+ return ret;
+}
+
+static inline int write_data(int data, unsigned long offset) {
+ void *ptr = ioremap(offset, sizeof(u8));
+
+ if (!ptr)
+ return 1;
+ writeb(data, ptr);
+ iounmap(ptr);
+ return 0;
+}
void st0x_setup (char *str, int *ints)
{
--
Regards,
Rasmus(rasmus@jaquet.dk)
I've never had major knee surgery on any other part of my body.
-Winston Bennett, University of Kentucky basketball forward
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] make drivers/scsi/seagate.c use ioremap instead of isa_{read,write} (241p11)
2001-01-29 21:59 [PATCH] make drivers/scsi/seagate.c use ioremap instead of isa_{read,write} (241p11) Rasmus Andersen
@ 2001-01-29 22:08 ` Brian Gerst
0 siblings, 0 replies; 2+ messages in thread
From: Brian Gerst @ 2001-01-29 22:08 UTC (permalink / raw)
To: Rasmus Andersen; +Cc: linux-scsi, linux-kernel
Rasmus Andersen wrote:
>
> 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}.
>
> It applies against ac12 and 241p11.
>
> Please comment, esp. on the size of the remappings.
This isn't the proper way to use ioremap. You should only ioremap once
when the driver is loaded and save the mapped address. Since ioremap
special cases ISA addresses, it doesn't add much overhead the way you
are doing it, but it is still not consistent with normal non-ISA usage
of ioremap.
--
Brian Gerst
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-01-29 22:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-29 21:59 [PATCH] make drivers/scsi/seagate.c use ioremap instead of isa_{read,write} (241p11) Rasmus Andersen
2001-01-29 22:08 ` Brian Gerst
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.