Re: [PATCH] Fix readw/writew warnings in drivers/net/wireless/hermes.h

From: Pavel Roskin
Date: Mon Oct 11 2004 - 08:50:49 EST


On Mon, 11 Oct 2004, Cal Peake wrote:

This patch fixes several dozen warnings spit out when compiling the hermes
wireless driver.

I noticed them too.

By the way, it would be nice to move the discussion to the mailing list of the driver, orinoco-devel@xxxxxxxxxxxxxxxxxxxxxx Sorry that it wasn't mentioned in the MAINTAINERS file. I've just submitted a patch to add the mailing lists to that file.

@@ -364,12 +364,12 @@
/* 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 __iomem *)(hw)->iobase + ( (off) << (hw)->reg_spacing )))

The HEAD version of the driver aims to support Linux starting with version 2.4.10, so you need to add some magic in kcompat.h to define __iomem.

HostAP driver uses cast to (void *), which compiles without warnings. I believe it's sufficient because the call to readw() would cast the argument to whatever readw() needs.

Another, more sophisticated solution would be to use union for iobase:

typedef struct hermes {
union {
unsigned long io;
void *mem;
} base;
int io_space; /* 1 if we IO-mapped IO, 0 for memory-mapped IO? */
...
}

--
Regards,
Pavel Roskin
-
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/