* Warning Fix drivers/net/wireless in Kernel 2.6.9
@ 2004-11-10 20:51 Bryan Batten
2004-11-10 23:48 ` David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Bryan Batten @ 2004-11-10 20:51 UTC (permalink / raw)
Cc: Pavel Roskin, David Gibson, Trivial Patch Monkey, linux-kernel
The patch removes the "makes pointer from integer without a cast"
warnings in orinoco code by casting the appropriate parameter to
readw, writew as (void *) in the header file hermes.h.
The underlying problem is that readw/writes boil down to low level
calls that take a pointer, while inw/outw boil down (eventually) to
low level calls that take an int. So the choice was to either cast
inw, outw parameters as (int)'s, or cast readw, writew parameters as
(void *). I chose the latter.
I suspect the truly "best" fix would be to change the underlying
inx/outx definitions to accept a pointer, so's to be consistent
with the definitions of readx/writex, but that would probably break
other stuff.
Anyway, here's the patch to hermes.h:
--- ./linux-2.6.9orig/drivers/net/wireless/hermes.h Thu Nov 4 11:33:23 2004
+++ ./linux-2.6/drivers/net/wireless/hermes.h Wed Nov 10 09:35:55 2004
@@ -364,12 +364,12 @@ typedef struct hermes {
/* Register access convenience macros */
#define hermes_read_reg(hw, off) ((hw)->io_space ? \
inw((hw)->iobase + ( (off) << (hw)->reg_spacing )) : \
- readw((hw)->iobase + ( (off) << (hw)->reg_spacing )))
+ readw((void *)(hw)->iobase + ( (off) << (hw)->reg_spacing )))
#define hermes_write_reg(hw, off, val) do { \
if ((hw)->io_space) \
outw_p((val), (hw)->iobase + ((off) << (hw)->reg_spacing)); \
else \
- writew((val), (hw)->iobase + ((off) << (hw)->reg_spacing)); \
+ writew((val), (void *)(hw)->iobase + ((off) << (hw)->reg_spacing)); \
} while (0)
#define hermes_read_regn(hw, name) hermes_read_reg((hw), HERMES_##name)
#define hermes_write_regn(hw, name, val) hermes_write_reg((hw), HERMES_##name, (val))
@@ -442,7 +442,7 @@ static inline void hermes_read_words(str
* gcc is smart enough to fold away the two swaps on
* big-endian platforms. */
for (i = 0, p = buf; i < count; i++) {
- *p++ = cpu_to_le16(readw(hw->iobase + off));
+ *p++ = cpu_to_le16(readw((void *)hw->iobase + off));
}
}
}
@@ -462,7 +462,7 @@ static inline void hermes_write_words(st
* hope gcc is smart enough to fold away the two swaps
* on big-endian platforms. */
for (i = 0, p = buf; i < count; i++) {
- writew(le16_to_cpu(*p++), hw->iobase + off);
+ writew(le16_to_cpu(*p++), (void *)hw->iobase + off);
}
}
}
@@ -478,7 +478,7 @@ static inline void hermes_clear_words(st
outw(0, hw->iobase + off);
} else {
for (i = 0; i < count; i++)
- writew(0, hw->iobase + off);
+ writew(0, (void *)hw->iobase + off);
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Warning Fix drivers/net/wireless in Kernel 2.6.9
2004-11-10 20:51 Warning Fix drivers/net/wireless in Kernel 2.6.9 Bryan Batten
@ 2004-11-10 23:48 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2004-11-10 23:48 UTC (permalink / raw)
To: Bryan Batten; +Cc: Pavel Roskin, Trivial Patch Monkey, linux-kernel
On Wed, Nov 10, 2004 at 12:51:43PM -0800, Bryan Batten wrote:
> The patch removes the "makes pointer from integer without a cast"
> warnings in orinoco code by casting the appropriate parameter to
> readw, writew as (void *) in the header file hermes.h.
>
> The underlying problem is that readw/writes boil down to low level
> calls that take a pointer, while inw/outw boil down (eventually) to
> low level calls that take an int. So the choice was to either cast
> inw, outw parameters as (int)'s, or cast readw, writew parameters as
> (void *). I chose the latter.
>
> I suspect the truly "best" fix would be to change the underlying
> inx/outx definitions to accept a pointer, so's to be consistent
> with the definitions of readx/writex, but that would probably break
> other stuff.
That's what the new ioread*() and iowrite*() functions are for. Al
Viro has already made a fix to use these, and it is in the netdev bk
tree.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist. NOT _the_ _other_ _way_
| _around_!
http://www.ozlabs.org/people/dgibson
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-11-11 0:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-10 20:51 Warning Fix drivers/net/wireless in Kernel 2.6.9 Bryan Batten
2004-11-10 23:48 ` David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox