[Top] [All Lists]

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

To: Cal Peake <cp@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [PATCH] Fix readw/writew warnings in drivers/net/wireless/hermes.h
From: Pavel Roskin <proski@xxxxxxx>
Date: Mon, 11 Oct 2004 09:12:03 -0400 (EDT)
Cc: linux-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx, David Gibson <hermes@xxxxxxxxxxxxxxxxxxxxx>
In-reply-to: <Pine.LNX.4.61.0410110702590.7899@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <Pine.LNX.4.61.0410110702590.7899@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
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? */

Pavel Roskin

<Prev in Thread] Current Thread [Next in Thread>