[PATCH] readb/writeb pointer from integer without a cast fixes -correct way to fix?

From: Jesper Juhl
Date: Mon Sep 20 2004 - 14:35:19 EST



Hi, here's a patch attempting to fix the following warnings :

CC drivers/isdn/hisax/teles0.o
drivers/isdn/hisax/teles0.c: In function `readisac':
drivers/isdn/hisax/teles0.c:35: warning: passing arg 1 of `readb' makes pointer from integer without a cast
drivers/isdn/hisax/teles0.c: In function `writeisac':
drivers/isdn/hisax/teles0.c:41: warning: passing arg 2 of `writeb' makes pointer from integer without a cast
drivers/isdn/hisax/teles0.c: In function `readhscx':
drivers/isdn/hisax/teles0.c:49: warning: passing arg 1 of `readb' makes pointer from integer without a cast
drivers/isdn/hisax/teles0.c: In function `writehscx':
drivers/isdn/hisax/teles0.c:56: warning: passing arg 2 of `writeb' makes pointer from integer without a cast
drivers/isdn/hisax/teles0.c: In function `reset_teles0':
drivers/isdn/hisax/teles0.c:236: warning: passing arg 2 of `writeb' makes pointer from integer without a cast
drivers/isdn/hisax/teles0.c:238: warning: passing arg 2 of `writeb' makes pointer from integer without a cast

I hope I got it right. It builds fine, but I don't have the hardware to
test and I would like some confirmation that this is the correct way to
fix these warnings before I get started on the rest of them.

Signed-off-by: Jesper Juhl <juhl-lkml@xxxxxx>


diff -up linux-2.6.9-rc2-bk5-orig/drivers/isdn/hisax/teles0.c linux-2.6.9-rc2-bk5/drivers/isdn/hisax/teles0.c
--- linux-2.6.9-rc2-bk5-orig/drivers/isdn/hisax/teles0.c 2004-08-14 07:36:58.000000000 +0200
+++ linux-2.6.9-rc2-bk5/drivers/isdn/hisax/teles0.c 2004-09-20 21:33:05.000000000 +0200
@@ -32,28 +32,28 @@ const char *teles0_revision = "$Revision
static inline u_char
readisac(unsigned long adr, u_char off)
{
- return readb(adr + ((off & 1) ? 0x2ff : 0x100) + off);
+ return readb((u_char *)(adr + ((off & 1) ? 0x2ff : 0x100) + off));
}

static inline void
writeisac(unsigned long adr, u_char off, u_char data)
{
- writeb(data, adr + ((off & 1) ? 0x2ff : 0x100) + off); mb();
+ writeb(data, (u_char *)(adr + ((off & 1) ? 0x2ff : 0x100) + off)); mb();
}


static inline u_char
readhscx(unsigned long adr, int hscx, u_char off)
{
- return readb(adr + (hscx ? 0x1c0 : 0x180) +
- ((off & 1) ? 0x1ff : 0) + off);
+ return readb((u_char *)(adr + (hscx ? 0x1c0 : 0x180) +
+ ((off & 1) ? 0x1ff : 0) + off));
}

static inline void
writehscx(unsigned long adr, int hscx, u_char off, u_char data)
{
- writeb(data, adr + (hscx ? 0x1c0 : 0x180) +
- ((off & 1) ? 0x1ff : 0) + off); mb();
+ writeb(data, (u_char *)(adr + (hscx ? 0x1c0 : 0x180) +
+ ((off & 1) ? 0x1ff : 0) + off)); mb();
}

static inline void
@@ -233,9 +233,9 @@ reset_teles0(struct IsdnCardState *cs)
byteout(cs->hw.teles0.cfg_reg + 4, cfval | 1);
HZDELAY(HZ / 10 + 1);
}
- writeb(0, cs->hw.teles0.membase + 0x80); mb();
+ writeb(0, (unsigned long *)(cs->hw.teles0.membase + 0x80)); mb();
HZDELAY(HZ / 5 + 1);
- writeb(1, cs->hw.teles0.membase + 0x80); mb();
+ writeb(1, (unsigned long *)(cs->hw.teles0.membase + 0x80)); mb();
HZDELAY(HZ / 5 + 1);
return(0);
}



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/