diff mbox

[1/2] smc91x: always use 8-bit access if necessary

Message ID 20160825144633.1850889-1-arnd@arndb.de (mailing list archive)
State New, archived
Headers show

Commit Message

Arnd Bergmann Aug. 25, 2016, 2:46 p.m. UTC
As Russell King found out the hard way, a change I did to fix multiplatform
builds with this driver broke the old Assabet/Neponset platform: It turns
out that while the driver is runtime configurable in principle, the
runtime configuration does not cover the specific case of machines that
can not do any 16-bit I/O on the smc91x registers.

The driver currently provides helpers to access 16-bit registers for
architectures that are known at compile-time to only have 8-bit I/O,
but my patch changed it to a runtime flag that never gets consulted
most register accesses.

This introduces new SMC_out16()/SMC_in16 helpers (if anyone can suggest
a better name, I'm glad to modify this) that behaves like SMC_outw()/SMC_inw()
most of the time, but uses a pair of 8-bit accesses on platforms that
have no support for wider register accesses.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reported-by: Russell King <linux@armlinux.org.uk>
Fixes: b70661c70830d ("net: smc91x: use run-time configuration on all ARM machines")
---
 drivers/net/ethernet/smsc/smc91x.h | 125 ++++++++++++++++++++-----------------
 1 file changed, 66 insertions(+), 59 deletions(-)


While this patch fixes one bug on Neponset, it probably doesn't address
the one that Russell ran into first, so this is for review only for now,
until the remaining problem(s) have been worked out.

Please ignore the first submission, I accidentally only sent out patch 2/2,
which does not actually fix a bug.

Comments

kernel test robot Aug. 25, 2016, 4:32 p.m. UTC | #1
Hi Arnd,

[auto build test WARNING on net-next/master]
[also build test WARNING on v4.8-rc3 next-20160825]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:    https://github.com/0day-ci/linux/commits/Arnd-Bergmann/smc91x-always-use-8-bit-access-if-necessary/20160825-225929
config: m32r-defconfig (attached as .config)
compiler: m32r-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=m32r 

All warnings (new ones prefixed by >>):

   In file included from drivers/net/ethernet/smsc/smc91x.c:92:0:
   drivers/net/ethernet/smsc/smc91x.h:444:0: warning: "SMC_insw" redefined
    #define SMC_insw(a, r, p, l)  BUG()
    ^
   drivers/net/ethernet/smsc/smc91x.h:110:0: note: this is the location of the previous definition
    #define SMC_insw(a, r, p, l) insw(((u32)a) + (r), p, l)
    ^
   drivers/net/ethernet/smsc/smc91x.h:445:0: warning: "SMC_outsw" redefined
    #define SMC_outsw(a, r, p, l)  BUG()
    ^
   drivers/net/ethernet/smsc/smc91x.h:111:0: note: this is the location of the previous definition
    #define SMC_outsw(a, r, p, l) outsw(((u32)a) + (r), p, l)
    ^
   drivers/net/ethernet/smsc/smc91x.h:455:0: warning: "SMC_inb" redefined
    #define SMC_inb(ioaddr, reg)  ({ BUG(); 0; })
    ^
   drivers/net/ethernet/smsc/smc91x.h:106:0: note: this is the location of the previous definition
    #define SMC_inb(a, r)  inb(((u32)a) + (r))
    ^
   drivers/net/ethernet/smsc/smc91x.h:456:0: warning: "SMC_outb" redefined
    #define SMC_outb(x, ioaddr, reg) BUG()
    ^
   drivers/net/ethernet/smsc/smc91x.h:108:0: note: this is the location of the previous definition
    #define SMC_outb(v, a, r) outb(v, ((u32)a) + (r))
    ^
   drivers/net/ethernet/smsc/smc91x.h:1128:2: error: #endif without #if
    #endif  /* _SMC91X_H_ */
     ^
   drivers/net/ethernet/smsc/smc91x.c: In function 'smc_reset':
>> drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
>> drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:261:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 2);
     ^
>> drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
>> drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:278:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 0);
     ^
>> drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:999:28: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_RCR(lp, x) SMC_out16(x, ioaddr, RCR_REG(lp))
                               ^
   drivers/net/ethernet/smsc/smc91x.c:279:2: note: in expansion of macro 'SMC_SET_RCR'
     SMC_SET_RCR(lp, RCR_SOFTRST);
     ^
>> drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
>> drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:286:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 1);
     ^
>> drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:953:31: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_CONFIG(lp, x) SMC_out16(x, ioaddr, CONFIG_REG(lp))
                                  ^
   drivers/net/ethernet/smsc/smc91x.c:304:2: note: in expansion of macro 'SMC_SET_CONFIG'
     SMC_SET_CONFIG(lp, cfg);
     ^
>> drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
>> drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:317:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 0);
     ^
>> drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:999:28: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_RCR(lp, x) SMC_out16(x, ioaddr, RCR_REG(lp))
                               ^
   drivers/net/ethernet/smsc/smc91x.c:318:2: note: in expansion of macro 'SMC_SET_RCR'
     SMC_SET_RCR(lp, RCR_CLEAR);
     ^
>> drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:1015:28: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_TCR(lp, x) SMC_out16(x, ioaddr, TCR_REG(lp))
                               ^
   drivers/net/ethernet/smsc/smc91x.c:319:2: note: in expansion of macro 'SMC_SET_TCR'
     SMC_SET_TCR(lp, TCR_CLEAR);
     ^
>> drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
>> drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:321:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 1);
     ^
>> drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:959:28: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_CTL(lp, x) SMC_out16(x, ioaddr, CTL_REG(lp))
                               ^
   drivers/net/ethernet/smsc/smc91x.c:333:2: note: in expansion of macro 'SMC_SET_CTL'
     SMC_SET_CTL(lp, ctl);
     ^
>> drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
>> drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:336:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 2);
     ^
>> drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:981:32: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_MMU_CMD(lp, x) SMC_out16(x, ioaddr, MMU_CMD_REG(lp))
                                   ^
   drivers/net/ethernet/smsc/smc91x.c:337:2: note: in expansion of macro 'SMC_SET_MMU_CMD'
     SMC_SET_MMU_CMD(lp, MC_RESET);
     ^
   drivers/net/ethernet/smsc/smc91x.c: In function 'smc_enable':
>> drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
>> drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:353:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 0);
     ^

vim +/__val16 +424 drivers/net/ethernet/smsc/smc91x.h

09779c6d drivers/net/smc91x.h               Nicolas Pitre 2006-03-20  408  #define SMC_insl(a, r, p, l)		BUG()
09779c6d drivers/net/smc91x.h               Nicolas Pitre 2006-03-20  409  #define SMC_outsl(a, r, p, l)		BUG()
09779c6d drivers/net/smc91x.h               Nicolas Pitre 2006-03-20  410  #endif
09779c6d drivers/net/smc91x.h               Nicolas Pitre 2006-03-20  411  
09779c6d drivers/net/smc91x.h               Nicolas Pitre 2006-03-20  412  #if !defined(SMC_insl) || !defined(SMC_outsl)
09779c6d drivers/net/smc91x.h               Nicolas Pitre 2006-03-20  413  #define SMC_insl(a, r, p, l)		BUG()
09779c6d drivers/net/smc91x.h               Nicolas Pitre 2006-03-20  414  #define SMC_outsl(a, r, p, l)		BUG()
09779c6d drivers/net/smc91x.h               Nicolas Pitre 2006-03-20  415  #endif
09779c6d drivers/net/smc91x.h               Nicolas Pitre 2006-03-20  416  
09779c6d drivers/net/smc91x.h               Nicolas Pitre 2006-03-20  417  /*
39e82d37 drivers/net/ethernet/smsc/smc91x.h Arnd Bergmann 2016-08-25  418   * Any 16-bit register access is performed with two 8-bit accesses if the
39e82d37 drivers/net/ethernet/smsc/smc91x.h Arnd Bergmann 2016-08-25  419   * hardware can't do it directly.
09779c6d drivers/net/smc91x.h               Nicolas Pitre 2006-03-20  420   */
39e82d37 drivers/net/ethernet/smsc/smc91x.h Arnd Bergmann 2016-08-25  421  #define SMC_out16(x, ioaddr, reg)					     \
09779c6d drivers/net/smc91x.h               Nicolas Pitre 2006-03-20  422  do {									     \
39e82d37 drivers/net/ethernet/smsc/smc91x.h Arnd Bergmann 2016-08-25  423  	if (SMC_CAN_USE_8BIT && !SMC_16BIT(lp)) {			     \
09779c6d drivers/net/smc91x.h               Nicolas Pitre 2006-03-20 @424  		unsigned int __val16 = (x);				     \
09779c6d drivers/net/smc91x.h               Nicolas Pitre 2006-03-20  425  		SMC_outb(__val16, ioaddr, reg );			     \
09779c6d drivers/net/smc91x.h               Nicolas Pitre 2006-03-20  426  		SMC_outb(__val16 >> 8, ioaddr, reg + (1 << SMC_IO_SHIFT));   \
39e82d37 drivers/net/ethernet/smsc/smc91x.h Arnd Bergmann 2016-08-25  427  	} else {							     \
39e82d37 drivers/net/ethernet/smsc/smc91x.h Arnd Bergmann 2016-08-25  428  		SMC_outw(x, ioaddr, reg);				     \
39e82d37 drivers/net/ethernet/smsc/smc91x.h Arnd Bergmann 2016-08-25  429  	}								     \
09779c6d drivers/net/smc91x.h               Nicolas Pitre 2006-03-20  430  } while (0)
39e82d37 drivers/net/ethernet/smsc/smc91x.h Arnd Bergmann 2016-08-25  431  
39e82d37 drivers/net/ethernet/smsc/smc91x.h Arnd Bergmann 2016-08-25  432  #define SMC_in16(ioaddr, reg)						     \

:::::: The code at line 424 was first introduced by commit
:::::: 09779c6df2dbe95483269d194b327d41fe2cc57e [PATCH] smc91x: allow for dynamic bus access configs

:::::: TO: Nicolas Pitre <nico@cam.org>
:::::: CC: Jeff Garzik <jeff@garzik.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Nicolas Pitre Aug. 25, 2016, 5:59 p.m. UTC | #2
On Thu, 25 Aug 2016, Arnd Bergmann wrote:

> The ARM specific I/O operations are almost the same as the generic
> ones, with the exception of the SMC_outw macro that works around
> a problem of some platforms that cannot write to 16-bit registers
> at an address that is not 32-bit aligned.
> 
> By inspection, I found that this is handled already in the
> register abstractions for almost all cases, the exceptions being
> SMC_SET_MAC_ADDR() and SMC_SET_MCAST(). I assume that all
> platforms that require the hack for the other registers also
> need it here, so the ones listed explictly here are the only
> ones that work correctly, while the other ones either don't
> need the hack at all, or they will set an incorrect MAC
> address (which can often go unnoticed).

Probably that all PXA based platforms that use the SMC91x with 32-bit 
accesses need this.  The others simply wired only 16 data lines, or 
only 8 like the Neponset.

However I no longer have the concerned hardware and can't test it.

> This changes the two macros that set the unaligned registers
> to use 32-bit writes if possible, which should do the right
> thing in all combinations. The ARM specific SMC_outw gets removed
> as a consequence.
> 
> The only difference between the ARM behavior and the default is
> the selection of the LED settings. The fact that we have different
> defaults based on the CPU architectures here is a bit suspicious,
> but probably harmless, and I have no plan of touching that.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/net/ethernet/smsc/smc91x.h | 50 +++++++++++++++++++++++---------------
>  1 file changed, 30 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h
> index 22333477d0b5..908473d9ede0 100644
> --- a/drivers/net/ethernet/smsc/smc91x.h
> +++ b/drivers/net/ethernet/smsc/smc91x.h
> @@ -58,6 +58,7 @@
>  #define SMC_inw(a, r)		readw((a) + (r))
>  #define SMC_inl(a, r)		readl((a) + (r))
>  #define SMC_outb(v, a, r)	writeb(v, (a) + (r))
> +#define SMC_outw(v, a, r)	writew(v, (a) + (r))
>  #define SMC_outl(v, a, r)	writel(v, (a) + (r))
>  #define SMC_insw(a, r, p, l)	readsw((a) + (r), p, l)
>  #define SMC_outsw(a, r, p, l)	writesw((a) + (r), p, l)
> @@ -65,19 +66,6 @@
>  #define SMC_outsl(a, r, p, l)	writesl((a) + (r), p, l)
>  #define SMC_IRQ_FLAGS		(-1)	/* from resource */
>  
> -/* We actually can't write halfwords properly if not word aligned */
> -static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg)
> -{
> -	if ((machine_is_mainstone() || machine_is_stargate2() ||
> -	     machine_is_pxa_idp()) && reg & 2) {
> -		unsigned int v = val << 16;
> -		v |= readl(ioaddr + (reg & ~2)) & 0xffff;
> -		writel(v, ioaddr + (reg & ~2));
> -	} else {
> -		writew(val, ioaddr + reg);
> -	}
> -}
> -
>  #elif	defined(CONFIG_SH_SH4202_MICRODEV)
>  
>  #define SMC_CAN_USE_8BIT	0
> @@ -1029,18 +1017,40 @@ static const char * chip_ids[ 16 ] =  {
>  
>  #define SMC_SET_MAC_ADDR(lp, addr)					\
>  	do {								\
> -		SMC_out16(addr[0]|(addr[1] << 8), ioaddr, ADDR0_REG(lp)); \
> -		SMC_out16(addr[2]|(addr[3] << 8), ioaddr, ADDR1_REG(lp)); \
> -		SMC_out16(addr[4]|(addr[5] << 8), ioaddr, ADDR2_REG(lp)); \
> +		if (SMC_32BIT(lp)) {					\
> +			SMC_outl((addr[0]      )|(addr[1] <<  8) |	\
> +				 (addr[2] << 16)|(addr[3] << 24),	\
> +				 ioaddr, ADDR0_REG(lp));		\
> +		} else {						\
> +			SMC_out16(addr[0]|(addr[1] << 8), ioaddr,	\
> +				  ADDR0_REG(lp));			\
> +			SMC_out16(addr[2]|(addr[3] << 8), ioaddr,	\
> +				  ADDR1_REG(lp));			\
> +		}							\
> +		SMC_out16(addr[4]|(addr[5] << 8), ioaddr,		\
> +			  ADDR2_REG(lp)); \
>  	} while (0)
>  
>  #define SMC_SET_MCAST(lp, x)						\
>  	do {								\
>  		const unsigned char *mt = (x);				\
> -		SMC_out16(mt[0] | (mt[1] << 8), ioaddr, MCAST_REG1(lp)); \
> -		SMC_out16(mt[2] | (mt[3] << 8), ioaddr, MCAST_REG2(lp)); \
> -		SMC_out16(mt[4] | (mt[5] << 8), ioaddr, MCAST_REG3(lp)); \
> -		SMC_out16(mt[6] | (mt[7] << 8), ioaddr, MCAST_REG4(lp)); \
> +		if (SMC_32BIT(lp)) {					\
> +			SMC_outl((mt[0]      ) | (mt[1] <<  8) |	\
> +				 (mt[2] << 16) | (mt[3] << 24),		\
> +				 ioaddr, MCAST_REG1(lp));		\
> +			SMC_outl((mt[4]      ) | (mt[5] <<  8) |	\
> +				 (mt[6] << 16) | (mt[7] << 24),		\
> +				 ioaddr, MCAST_REG3(lp));		\
> +		} else {						\
> +			SMC_out16(mt[0] | (mt[1] << 8),			\
> +				  ioaddr, MCAST_REG1(lp));		\
> +			SMC_out16(mt[2] | (mt[3] << 8),			\
> +				  ioaddr, MCAST_REG2(lp));		\
> +			SMC_out16(mt[4] | (mt[5] << 8),			\
> +				  ioaddr, MCAST_REG3(lp));		\
> +			SMC_out16(mt[6] | (mt[7] << 8),			\
> +				  ioaddr, MCAST_REG4(lp));		\
> +		}							\
>  	} while (0)
>  
>  #define SMC_PUT_PKT_HDR(lp, status, length)				\
> -- 
> 2.9.0
> 
>
Russell King (Oracle) Aug. 25, 2016, 10:33 p.m. UTC | #3
On Thu, Aug 25, 2016 at 04:46:20PM +0200, Arnd Bergmann wrote:
> +#define SMC_out16(x, ioaddr, reg)					     \
> +do {									     \
> +	if (SMC_CAN_USE_8BIT && !SMC_16BIT(lp)) {			     \
> +		unsigned int __val16 = (x);				     \
> +		SMC_outb(__val16, ioaddr, reg );			     \
> +		SMC_outb(__val16 >> 8, ioaddr, reg + (1 << SMC_IO_SHIFT));   \
> +	} else {							     \
> +		SMC_outw(x, ioaddr, reg);				     \
> +	}								     \

This is insufficient.  If you look at how SMC_REG works, you'll notice
that it has side effects which can disrupt other accesses (it reads
the bank register if debugging is enabled.)

In any case, please wait for my tested patch for this.
Arnd Bergmann Aug. 26, 2016, 9:42 a.m. UTC | #4
On Thursday, August 25, 2016 11:33:08 PM CEST Russell King - ARM Linux wrote:
> 
> This is insufficient.  If you look at how SMC_REG works, you'll notice
> that it has side effects which can disrupt other accesses (it reads
> the bank register if debugging is enabled.)

Ok, got it.

	Arnd
kernel test robot Aug. 26, 2016, 10:39 p.m. UTC | #5
Hi Arnd,

[auto build test WARNING on net-next/master]
[also build test WARNING on v4.8-rc3 next-20160825]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:    https://github.com/0day-ci/linux/commits/Arnd-Bergmann/smc91x-always-use-8-bit-access-if-necessary/20160825-225929
config: sh-microdev_defconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 5.4.0-6) 5.4.0 20160609
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sh 

All warnings (new ones prefixed by >>):

                    from drivers/net/ethernet/smsc/smc91x.c:72:
   arch/sh/include/asm/io.h:159:25: note: expected 'long unsigned int' but argument is of type 'void *'
    static inline void pfx##out##bwlq##p(type val, unsigned long port) \
                            ^
   arch/sh/include/asm/io.h:181:2: note: in expansion of macro '__BUILD_IOPORT_SINGLE'
     __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,)   \
     ^
   arch/sh/include/asm/io.h:185:2: note: in expansion of macro '__BUILD_IOPORT_PFX'
     __BUILD_IOPORT_PFX(, bwlq, type)
     ^
   arch/sh/include/asm/io.h:188:1: note: in expansion of macro 'BUILDIO_IOPORT'
    BUILDIO_IOPORT(w, u16)
    ^
   In file included from drivers/net/ethernet/smsc/smc91x.c:92:0:
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:1015:28: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_TCR(lp, x) SMC_out16(x, ioaddr, TCR_REG(lp))
                               ^
   drivers/net/ethernet/smsc/smc91x.c:319:2: note: in expansion of macro 'SMC_SET_TCR'
     SMC_SET_TCR(lp, TCR_CLEAR);
     ^
   drivers/net/ethernet/smsc/smc91x.h:91:35: warning: passing argument 2 of 'outw' makes integer from pointer without a cast [-Wint-conversion]
    #define SMC_outw(v, a, r) outw(v, (a) + (r) - 0xa0000000)
                                      ^
   drivers/net/ethernet/smsc/smc91x.h:428:3: note: in expansion of macro 'SMC_outw'
      SMC_outw(x, ioaddr, reg);         \
      ^
   drivers/net/ethernet/smsc/smc91x.h:1015:28: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_TCR(lp, x) SMC_out16(x, ioaddr, TCR_REG(lp))
                               ^
   drivers/net/ethernet/smsc/smc91x.c:319:2: note: in expansion of macro 'SMC_SET_TCR'
     SMC_SET_TCR(lp, TCR_CLEAR);
     ^
   In file included from include/linux/io.h:25:0,
                    from include/linux/irq.h:24,
                    from arch/sh/include/asm/hardirq.h:5,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from drivers/net/ethernet/smsc/smc91x.c:72:
   arch/sh/include/asm/io.h:159:25: note: expected 'long unsigned int' but argument is of type 'void *'
    static inline void pfx##out##bwlq##p(type val, unsigned long port) \
                            ^
   arch/sh/include/asm/io.h:181:2: note: in expansion of macro '__BUILD_IOPORT_SINGLE'
     __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,)   \
     ^
   arch/sh/include/asm/io.h:185:2: note: in expansion of macro '__BUILD_IOPORT_PFX'
     __BUILD_IOPORT_PFX(, bwlq, type)
     ^
   arch/sh/include/asm/io.h:188:1: note: in expansion of macro 'BUILDIO_IOPORT'
    BUILDIO_IOPORT(w, u16)
    ^
   In file included from drivers/net/ethernet/smsc/smc91x.c:92:0:
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:321:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 1);
     ^
   drivers/net/ethernet/smsc/smc91x.h:91:35: warning: passing argument 2 of 'outw' makes integer from pointer without a cast [-Wint-conversion]
    #define SMC_outw(v, a, r) outw(v, (a) + (r) - 0xa0000000)
                                      ^
   drivers/net/ethernet/smsc/smc91x.h:428:3: note: in expansion of macro 'SMC_outw'
      SMC_outw(x, ioaddr, reg);         \
      ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:321:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 1);
     ^
   In file included from include/linux/io.h:25:0,
                    from include/linux/irq.h:24,
                    from arch/sh/include/asm/hardirq.h:5,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from drivers/net/ethernet/smsc/smc91x.c:72:
   arch/sh/include/asm/io.h:159:25: note: expected 'long unsigned int' but argument is of type 'void *'
    static inline void pfx##out##bwlq##p(type val, unsigned long port) \
                            ^
   arch/sh/include/asm/io.h:181:2: note: in expansion of macro '__BUILD_IOPORT_SINGLE'
     __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,)   \
     ^
   arch/sh/include/asm/io.h:185:2: note: in expansion of macro '__BUILD_IOPORT_PFX'
     __BUILD_IOPORT_PFX(, bwlq, type)
     ^
   arch/sh/include/asm/io.h:188:1: note: in expansion of macro 'BUILDIO_IOPORT'
    BUILDIO_IOPORT(w, u16)
    ^
   In file included from drivers/net/ethernet/smsc/smc91x.c:92:0:
   drivers/net/ethernet/smsc/smc91x.h:88:28: warning: passing argument 1 of 'inw' makes integer from pointer without a cast [-Wint-conversion]
    #define SMC_inw(a, r)  inw((a) + (r) - 0xa0000000)
                               ^
   drivers/net/ethernet/smsc/smc91x.h:439:13: note: in expansion of macro 'SMC_inw'
      __val16 = SMC_inw(ioaddr, reg);         \
                ^
>> drivers/net/ethernet/smsc/smc91x.h:957:26: note: in expansion of macro 'SMC_in16'
    #define SMC_GET_CTL(lp)  SMC_in16(ioaddr, CTL_REG(lp))
                             ^
   drivers/net/ethernet/smsc/smc91x.c:322:8: note: in expansion of macro 'SMC_GET_CTL'
     ctl = SMC_GET_CTL(lp) | CTL_LE_ENABLE;
           ^
   In file included from include/linux/io.h:25:0,
                    from include/linux/irq.h:24,
                    from arch/sh/include/asm/hardirq.h:5,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from drivers/net/ethernet/smsc/smc91x.c:72:
   arch/sh/include/asm/io.h:168:25: note: expected 'long unsigned int' but argument is of type 'void *'
    static inline type pfx##in##bwlq##p(unsigned long port)   \
                            ^
   arch/sh/include/asm/io.h:181:2: note: in expansion of macro '__BUILD_IOPORT_SINGLE'
     __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,)   \
     ^
   arch/sh/include/asm/io.h:185:2: note: in expansion of macro '__BUILD_IOPORT_PFX'
     __BUILD_IOPORT_PFX(, bwlq, type)
     ^
   arch/sh/include/asm/io.h:188:1: note: in expansion of macro 'BUILDIO_IOPORT'
    BUILDIO_IOPORT(w, u16)
    ^
   In file included from drivers/net/ethernet/smsc/smc91x.c:92:0:
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:959:28: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_CTL(lp, x) SMC_out16(x, ioaddr, CTL_REG(lp))
                               ^
   drivers/net/ethernet/smsc/smc91x.c:333:2: note: in expansion of macro 'SMC_SET_CTL'
     SMC_SET_CTL(lp, ctl);
     ^
   drivers/net/ethernet/smsc/smc91x.h:91:35: warning: passing argument 2 of 'outw' makes integer from pointer without a cast [-Wint-conversion]
    #define SMC_outw(v, a, r) outw(v, (a) + (r) - 0xa0000000)
                                      ^
   drivers/net/ethernet/smsc/smc91x.h:428:3: note: in expansion of macro 'SMC_outw'
      SMC_outw(x, ioaddr, reg);         \
      ^
   drivers/net/ethernet/smsc/smc91x.h:959:28: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_CTL(lp, x) SMC_out16(x, ioaddr, CTL_REG(lp))
                               ^
   drivers/net/ethernet/smsc/smc91x.c:333:2: note: in expansion of macro 'SMC_SET_CTL'
     SMC_SET_CTL(lp, ctl);
     ^
   In file included from include/linux/io.h:25:0,
                    from include/linux/irq.h:24,
                    from arch/sh/include/asm/hardirq.h:5,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from drivers/net/ethernet/smsc/smc91x.c:72:
   arch/sh/include/asm/io.h:159:25: note: expected 'long unsigned int' but argument is of type 'void *'
    static inline void pfx##out##bwlq##p(type val, unsigned long port) \
                            ^
   arch/sh/include/asm/io.h:181:2: note: in expansion of macro '__BUILD_IOPORT_SINGLE'
     __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,)   \
     ^
   arch/sh/include/asm/io.h:185:2: note: in expansion of macro '__BUILD_IOPORT_PFX'
     __BUILD_IOPORT_PFX(, bwlq, type)
     ^
   arch/sh/include/asm/io.h:188:1: note: in expansion of macro 'BUILDIO_IOPORT'
    BUILDIO_IOPORT(w, u16)
    ^
   In file included from drivers/net/ethernet/smsc/smc91x.c:92:0:
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:336:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 2);
     ^
   drivers/net/ethernet/smsc/smc91x.h:91:35: warning: passing argument 2 of 'outw' makes integer from pointer without a cast [-Wint-conversion]
    #define SMC_outw(v, a, r) outw(v, (a) + (r) - 0xa0000000)
                                      ^
   drivers/net/ethernet/smsc/smc91x.h:428:3: note: in expansion of macro 'SMC_outw'
      SMC_outw(x, ioaddr, reg);         \
      ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:336:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 2);
     ^
   In file included from include/linux/io.h:25:0,
                    from include/linux/irq.h:24,
                    from arch/sh/include/asm/hardirq.h:5,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from drivers/net/ethernet/smsc/smc91x.c:72:
   arch/sh/include/asm/io.h:159:25: note: expected 'long unsigned int' but argument is of type 'void *'
    static inline void pfx##out##bwlq##p(type val, unsigned long port) \
                            ^
   arch/sh/include/asm/io.h:181:2: note: in expansion of macro '__BUILD_IOPORT_SINGLE'
     __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,)   \
     ^
   arch/sh/include/asm/io.h:185:2: note: in expansion of macro '__BUILD_IOPORT_PFX'
     __BUILD_IOPORT_PFX(, bwlq, type)
     ^
--
   arch/sh/include/asm/io.h:168:25: note: expected 'long unsigned int' but argument is of type 'void *'
    static inline type pfx##in##bwlq##p(unsigned long port)   \
                            ^
   arch/sh/include/asm/io.h:181:2: note: in expansion of macro '__BUILD_IOPORT_SINGLE'
     __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,)   \
     ^
   arch/sh/include/asm/io.h:185:2: note: in expansion of macro '__BUILD_IOPORT_PFX'
     __BUILD_IOPORT_PFX(, bwlq, type)
     ^
   arch/sh/include/asm/io.h:188:1: note: in expansion of macro 'BUILDIO_IOPORT'
    BUILDIO_IOPORT(w, u16)
    ^
   In file included from drivers/net/ethernet/smsc/smc91x.c:92:0:
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1178:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 2);
     ^
   drivers/net/ethernet/smsc/smc91x.h:91:35: warning: passing argument 2 of 'outw' makes integer from pointer without a cast [-Wint-conversion]
    #define SMC_outw(v, a, r) outw(v, (a) + (r) - 0xa0000000)
                                      ^
   drivers/net/ethernet/smsc/smc91x.h:428:3: note: in expansion of macro 'SMC_outw'
      SMC_outw(x, ioaddr, reg);         \
      ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1178:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 2);
     ^
   In file included from include/linux/io.h:25:0,
                    from include/linux/irq.h:24,
                    from arch/sh/include/asm/hardirq.h:5,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from drivers/net/ethernet/smsc/smc91x.c:72:
   arch/sh/include/asm/io.h:159:25: note: expected 'long unsigned int' but argument is of type 'void *'
    static inline void pfx##out##bwlq##p(type val, unsigned long port) \
                            ^
   arch/sh/include/asm/io.h:181:2: note: in expansion of macro '__BUILD_IOPORT_SINGLE'
     __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,)   \
     ^
   arch/sh/include/asm/io.h:185:2: note: in expansion of macro '__BUILD_IOPORT_PFX'
     __BUILD_IOPORT_PFX(, bwlq, type)
     ^
   arch/sh/include/asm/io.h:188:1: note: in expansion of macro 'BUILDIO_IOPORT'
    BUILDIO_IOPORT(w, u16)
    ^
   In file included from drivers/net/ethernet/smsc/smc91x.c:92:0:
   drivers/net/ethernet/smsc/smc91x.c: In function 'smc_eph_interrupt':
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1200:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 1);
     ^
   drivers/net/ethernet/smsc/smc91x.h:91:35: warning: passing argument 2 of 'outw' makes integer from pointer without a cast [-Wint-conversion]
    #define SMC_outw(v, a, r) outw(v, (a) + (r) - 0xa0000000)
                                      ^
   drivers/net/ethernet/smsc/smc91x.h:428:3: note: in expansion of macro 'SMC_outw'
      SMC_outw(x, ioaddr, reg);         \
      ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1200:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 1);
     ^
   In file included from include/linux/io.h:25:0,
                    from include/linux/irq.h:24,
                    from arch/sh/include/asm/hardirq.h:5,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from drivers/net/ethernet/smsc/smc91x.c:72:
   arch/sh/include/asm/io.h:159:25: note: expected 'long unsigned int' but argument is of type 'void *'
    static inline void pfx##out##bwlq##p(type val, unsigned long port) \
                            ^
   arch/sh/include/asm/io.h:181:2: note: in expansion of macro '__BUILD_IOPORT_SINGLE'
     __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,)   \
     ^
   arch/sh/include/asm/io.h:185:2: note: in expansion of macro '__BUILD_IOPORT_PFX'
     __BUILD_IOPORT_PFX(, bwlq, type)
     ^
   arch/sh/include/asm/io.h:188:1: note: in expansion of macro 'BUILDIO_IOPORT'
    BUILDIO_IOPORT(w, u16)
    ^
   In file included from drivers/net/ethernet/smsc/smc91x.c:92:0:
   drivers/net/ethernet/smsc/smc91x.h:88:28: warning: passing argument 1 of 'inw' makes integer from pointer without a cast [-Wint-conversion]
    #define SMC_inw(a, r)  inw((a) + (r) - 0xa0000000)
                               ^
   drivers/net/ethernet/smsc/smc91x.h:439:13: note: in expansion of macro 'SMC_inw'
      __val16 = SMC_inw(ioaddr, reg);         \
                ^
>> drivers/net/ethernet/smsc/smc91x.h:957:26: note: in expansion of macro 'SMC_in16'
    #define SMC_GET_CTL(lp)  SMC_in16(ioaddr, CTL_REG(lp))
                             ^
   drivers/net/ethernet/smsc/smc91x.c:1201:8: note: in expansion of macro 'SMC_GET_CTL'
     ctl = SMC_GET_CTL(lp);
           ^
   In file included from include/linux/io.h:25:0,
                    from include/linux/irq.h:24,
                    from arch/sh/include/asm/hardirq.h:5,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from drivers/net/ethernet/smsc/smc91x.c:72:
   arch/sh/include/asm/io.h:168:25: note: expected 'long unsigned int' but argument is of type 'void *'
    static inline type pfx##in##bwlq##p(unsigned long port)   \
                            ^
   arch/sh/include/asm/io.h:181:2: note: in expansion of macro '__BUILD_IOPORT_SINGLE'
     __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,)   \
     ^
   arch/sh/include/asm/io.h:185:2: note: in expansion of macro '__BUILD_IOPORT_PFX'
     __BUILD_IOPORT_PFX(, bwlq, type)
     ^
   arch/sh/include/asm/io.h:188:1: note: in expansion of macro 'BUILDIO_IOPORT'
    BUILDIO_IOPORT(w, u16)
    ^
   In file included from drivers/net/ethernet/smsc/smc91x.c:92:0:
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:959:28: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_CTL(lp, x) SMC_out16(x, ioaddr, CTL_REG(lp))
                               ^
   drivers/net/ethernet/smsc/smc91x.c:1202:2: note: in expansion of macro 'SMC_SET_CTL'
     SMC_SET_CTL(lp, ctl & ~CTL_LE_ENABLE);
     ^
   drivers/net/ethernet/smsc/smc91x.h:91:35: warning: passing argument 2 of 'outw' makes integer from pointer without a cast [-Wint-conversion]
    #define SMC_outw(v, a, r) outw(v, (a) + (r) - 0xa0000000)
                                      ^
   drivers/net/ethernet/smsc/smc91x.h:428:3: note: in expansion of macro 'SMC_outw'
      SMC_outw(x, ioaddr, reg);         \
      ^
   drivers/net/ethernet/smsc/smc91x.h:959:28: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_CTL(lp, x) SMC_out16(x, ioaddr, CTL_REG(lp))
                               ^
   drivers/net/ethernet/smsc/smc91x.c:1202:2: note: in expansion of macro 'SMC_SET_CTL'
     SMC_SET_CTL(lp, ctl & ~CTL_LE_ENABLE);
     ^
   In file included from include/linux/io.h:25:0,
                    from include/linux/irq.h:24,
                    from arch/sh/include/asm/hardirq.h:5,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from drivers/net/ethernet/smsc/smc91x.c:72:
   arch/sh/include/asm/io.h:159:25: note: expected 'long unsigned int' but argument is of type 'void *'
    static inline void pfx##out##bwlq##p(type val, unsigned long port) \
                            ^
   arch/sh/include/asm/io.h:181:2: note: in expansion of macro '__BUILD_IOPORT_SINGLE'
     __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,)   \
     ^
   arch/sh/include/asm/io.h:185:2: note: in expansion of macro '__BUILD_IOPORT_PFX'
     __BUILD_IOPORT_PFX(, bwlq, type)
     ^
   arch/sh/include/asm/io.h:188:1: note: in expansion of macro 'BUILDIO_IOPORT'
    BUILDIO_IOPORT(w, u16)
    ^
   In file included from drivers/net/ethernet/smsc/smc91x.c:92:0:
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:959:28: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_CTL(lp, x) SMC_out16(x, ioaddr, CTL_REG(lp))
                               ^
   drivers/net/ethernet/smsc/smc91x.c:1203:2: note: in expansion of macro 'SMC_SET_CTL'
     SMC_SET_CTL(lp, ctl);
     ^
   drivers/net/ethernet/smsc/smc91x.h:91:35: warning: passing argument 2 of 'outw' makes integer from pointer without a cast [-Wint-conversion]
    #define SMC_outw(v, a, r) outw(v, (a) + (r) - 0xa0000000)
                                      ^
   drivers/net/ethernet/smsc/smc91x.h:428:3: note: in expansion of macro 'SMC_outw'
      SMC_outw(x, ioaddr, reg);         \
      ^
   drivers/net/ethernet/smsc/smc91x.h:959:28: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_CTL(lp, x) SMC_out16(x, ioaddr, CTL_REG(lp))
                               ^
   drivers/net/ethernet/smsc/smc91x.c:1203:2: note: in expansion of macro 'SMC_SET_CTL'
     SMC_SET_CTL(lp, ctl);
     ^
   In file included from include/linux/io.h:25:0,
                    from include/linux/irq.h:24,
                    from arch/sh/include/asm/hardirq.h:5,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from drivers/net/ethernet/smsc/smc91x.c:72:
   arch/sh/include/asm/io.h:159:25: note: expected 'long unsigned int' but argument is of type 'void *'
    static inline void pfx##out##bwlq##p(type val, unsigned long port) \
                            ^
   arch/sh/include/asm/io.h:181:2: note: in expansion of macro '__BUILD_IOPORT_SINGLE'
     __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,)   \
     ^
   arch/sh/include/asm/io.h:185:2: note: in expansion of macro '__BUILD_IOPORT_PFX'
     __BUILD_IOPORT_PFX(, bwlq, type)
     ^
..

vim +/SMC_in16 +957 drivers/net/ethernet/smsc/smc91x.h

   941			if (SMC_MUST_ALIGN_WRITE(lp))				\
   942				SMC_outl((x)<<16, ioaddr, 12<<SMC_IO_SHIFT);	\
   943			else							\
   944				SMC_out16(x, ioaddr, BANK_SELECT);		\
   945		} while (0)
   946	
   947	#define SMC_GET_BASE(lp)	SMC_in16(ioaddr, BASE_REG(lp))
   948	
   949	#define SMC_SET_BASE(lp, x)	SMC_out16(x, ioaddr, BASE_REG(lp))
   950	
   951	#define SMC_GET_CONFIG(lp)	SMC_in16(ioaddr, CONFIG_REG(lp))
   952	
   953	#define SMC_SET_CONFIG(lp, x)	SMC_out16(x, ioaddr, CONFIG_REG(lp))
   954	
   955	#define SMC_GET_COUNTER(lp)	SMC_in16(ioaddr, COUNTER_REG(lp))
   956	
 > 957	#define SMC_GET_CTL(lp)		SMC_in16(ioaddr, CTL_REG(lp))
   958	
   959	#define SMC_SET_CTL(lp, x)	SMC_out16(x, ioaddr, CTL_REG(lp))
   960	
   961	#define SMC_GET_MII(lp)		SMC_in16(ioaddr, MII_REG(lp))
   962	
   963	#define SMC_GET_GP(lp)		SMC_in16(ioaddr, GP_REG(lp))
   964	
   965	#define SMC_SET_GP(lp, x)						\

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Aug. 27, 2016, 11:37 a.m. UTC | #6
Hi Arnd,

[auto build test WARNING on net-next/master]
[also build test WARNING on v4.8-rc3 next-20160825]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:    https://github.com/0day-ci/linux/commits/Arnd-Bergmann/smc91x-always-use-8-bit-access-if-necessary/20160825-225929
config: m32r-allyesconfig (attached as .config)
compiler: m32r-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=m32r 

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:1015:28: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_TCR(lp, x) SMC_out16(x, ioaddr, TCR_REG(lp))
                               ^
   drivers/net/ethernet/smsc/smc91x.c:1028:3: note: in expansion of macro 'SMC_SET_TCR'
      SMC_SET_TCR(lp, lp->tcr_cur_mode);
      ^
   drivers/net/ethernet/smsc/smc91x.c: In function 'smc_phy_configure':
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1077:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 0);
     ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:1010:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, RPC_REG(lp));  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1078:2: note: in expansion of macro 'SMC_SET_RPC'
     SMC_SET_RPC(lp, lp->rpc_cur_mode);
     ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1135:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 2);
     ^
   drivers/net/ethernet/smsc/smc91x.c: In function 'smc_10bt_check_media':
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1176:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 0);
     ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1178:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 2);
     ^
   drivers/net/ethernet/smsc/smc91x.c: In function 'smc_eph_interrupt':
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1200:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 1);
     ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:959:28: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_CTL(lp, x) SMC_out16(x, ioaddr, CTL_REG(lp))
                               ^
   drivers/net/ethernet/smsc/smc91x.c:1202:2: note: in expansion of macro 'SMC_SET_CTL'
     SMC_SET_CTL(lp, ctl & ~CTL_LE_ENABLE);
     ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:959:28: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_CTL(lp, x) SMC_out16(x, ioaddr, CTL_REG(lp))
                               ^
   drivers/net/ethernet/smsc/smc91x.c:1203:2: note: in expansion of macro 'SMC_SET_CTL'
     SMC_SET_CTL(lp, ctl);
     ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1204:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 2);
     ^
   drivers/net/ethernet/smsc/smc91x.c: In function 'smc_interrupt':
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
>> include/linux/dynamic_debug.h:143:12: note: in expansion of macro 'SMC_SELECT_BANK'
             ##__VA_ARGS__);  \
               ^
>> include/linux/netdevice.h:4276:2: note: in expansion of macro 'dynamic_netdev_dbg'
     dynamic_netdev_dbg(__dev, format, ##args);  \
     ^
   drivers/net/ethernet/smsc/smc91x.c:159:4: note: in expansion of macro 'netdev_dbg'
       netdev_dbg(dev, fmt, ##__VA_ARGS__); \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1238:3: note: in expansion of macro 'DBG'
      DBG(2, dev, "INT 0x%02x MASK 0x%02x MEM 0x%04x FIFO 0x%04x\n",
      ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
>> include/linux/dynamic_debug.h:143:12: note: in expansion of macro 'SMC_SELECT_BANK'
             ##__VA_ARGS__);  \
               ^
>> include/linux/netdevice.h:4276:2: note: in expansion of macro 'dynamic_netdev_dbg'
     dynamic_netdev_dbg(__dev, format, ##args);  \
     ^
   drivers/net/ethernet/smsc/smc91x.c:159:4: note: in expansion of macro 'netdev_dbg'
       netdev_dbg(dev, fmt, ##__VA_ARGS__); \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1238:3: note: in expansion of macro 'DBG'
      DBG(2, dev, "INT 0x%02x MASK 0x%02x MEM 0x%04x FIFO 0x%04x\n",
      ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1268:4: note: in expansion of macro 'SMC_SELECT_BANK'
       SMC_SELECT_BANK(lp, 0);
       ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1270:4: note: in expansion of macro 'SMC_SELECT_BANK'
       SMC_SELECT_BANK(lp, 2);
       ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
>> include/linux/dynamic_debug.h:143:12: note: in expansion of macro 'SMC_SELECT_BANK'
             ##__VA_ARGS__);  \
               ^
>> include/linux/netdevice.h:4276:2: note: in expansion of macro 'dynamic_netdev_dbg'
     dynamic_netdev_dbg(__dev, format, ##args);  \
     ^
   drivers/net/ethernet/smsc/smc91x.c:159:4: note: in expansion of macro 'netdev_dbg'
       netdev_dbg(dev, fmt, ##__VA_ARGS__); \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1279:4: note: in expansion of macro 'DBG'
       DBG(1, dev, "RX overrun (EPH_ST 0x%04x)\n",
       ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
>> include/linux/dynamic_debug.h:143:12: note: in expansion of macro 'SMC_SELECT_BANK'
             ##__VA_ARGS__);  \
               ^
>> include/linux/netdevice.h:4276:2: note: in expansion of macro 'dynamic_netdev_dbg'
     dynamic_netdev_dbg(__dev, format, ##args);  \
     ^
   drivers/net/ethernet/smsc/smc91x.c:159:4: note: in expansion of macro 'netdev_dbg'
       netdev_dbg(dev, fmt, ##__VA_ARGS__); \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1279:4: note: in expansion of macro 'DBG'
       DBG(1, dev, "RX overrun (EPH_ST 0x%04x)\n",
       ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:992:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, PTR_REG(lp));  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1298:2: note: in expansion of macro 'SMC_SET_PTR'
     SMC_SET_PTR(lp, saved_pointer);
     ^
   drivers/net/ethernet/smsc/smc91x.c: In function 'smc_timeout':
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1347:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 0);
     ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1350:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 2);
     ^
   drivers/net/ethernet/smsc/smc91x.c: In function 'smc_set_multicast_list':
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1456:2: note: in expansion of macro 'SMC_SELECT_BANK'
     SMC_SELECT_BANK(lp, 0);
     ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:999:28: note: in expansion of macro 'SMC_out16'
    #define SMC_SET_RCR(lp, x) SMC_out16(x, ioaddr, RCR_REG(lp))
                               ^
   drivers/net/ethernet/smsc/smc91x.c:1457:2: note: in expansion of macro 'SMC_SET_RCR'
     SMC_SET_RCR(lp, lp->rcr_cur_mode);
     ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:944:4: note: in expansion of macro 'SMC_out16'
       SMC_out16(x, ioaddr, BANK_SELECT);  \
       ^
   drivers/net/ethernet/smsc/smc91x.c:1459:3: note: in expansion of macro 'SMC_SELECT_BANK'
      SMC_SELECT_BANK(lp, 3);
      ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:1040:3: note: in expansion of macro 'SMC_out16'
      SMC_out16(mt[0] | (mt[1] << 8), ioaddr, MCAST_REG1(lp)); \
      ^
   drivers/net/ethernet/smsc/smc91x.c:1460:3: note: in expansion of macro 'SMC_SET_MCAST'
      SMC_SET_MCAST(lp, multicast_table);
      ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:1041:3: note: in expansion of macro 'SMC_out16'
      SMC_out16(mt[2] | (mt[3] << 8), ioaddr, MCAST_REG2(lp)); \
      ^
   drivers/net/ethernet/smsc/smc91x.c:1460:3: note: in expansion of macro 'SMC_SET_MCAST'
      SMC_SET_MCAST(lp, multicast_table);
      ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:1042:3: note: in expansion of macro 'SMC_out16'
      SMC_out16(mt[4] | (mt[5] << 8), ioaddr, MCAST_REG3(lp)); \
      ^
   drivers/net/ethernet/smsc/smc91x.c:1460:3: note: in expansion of macro 'SMC_SET_MCAST'
      SMC_SET_MCAST(lp, multicast_table);
      ^
   drivers/net/ethernet/smsc/smc91x.h:424:16: warning: unused variable '__val16' [-Wunused-variable]
      unsigned int __val16 = (x);         \
                   ^
   drivers/net/ethernet/smsc/smc91x.h:1043:3: note: in expansion of macro 'SMC_out16'
      SMC_out16(mt[6] | (mt[7] << 8), ioaddr, MCAST_REG4(lp)); \
      ^
   drivers/net/ethernet/smsc/smc91x.c:1460:3: note: in expansion of macro 'SMC_SET_MCAST'
      SMC_SET_MCAST(lp, multicast_table);
      ^

vim +/SMC_SELECT_BANK +143 include/linux/dynamic_debug.h

07613b0b5 Jason Baron         2011-10-04  127  				   ##__VA_ARGS__);		\
e9d376f0f Jason Baron         2009-02-05  128  } while (0)
e9d376f0f Jason Baron         2009-02-05  129  
07613b0b5 Jason Baron         2011-10-04  130  #define dynamic_dev_dbg(dev, fmt, ...)				\
07613b0b5 Jason Baron         2011-10-04  131  do {								\
07613b0b5 Jason Baron         2011-10-04  132  	DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);		\
9049fc745 Jason Baron         2016-08-03  133  	if (DYNAMIC_DEBUG_BRANCH(descriptor))			\
07613b0b5 Jason Baron         2011-10-04  134  		__dynamic_dev_dbg(&descriptor, dev, fmt,	\
07613b0b5 Jason Baron         2011-10-04  135  				  ##__VA_ARGS__);		\
e9d376f0f Jason Baron         2009-02-05  136  } while (0)
e9d376f0f Jason Baron         2009-02-05  137  
07613b0b5 Jason Baron         2011-10-04  138  #define dynamic_netdev_dbg(dev, fmt, ...)			\
07613b0b5 Jason Baron         2011-10-04  139  do {								\
07613b0b5 Jason Baron         2011-10-04  140  	DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);		\
9049fc745 Jason Baron         2016-08-03  141  	if (DYNAMIC_DEBUG_BRANCH(descriptor))			\
07613b0b5 Jason Baron         2011-10-04  142  		__dynamic_netdev_dbg(&descriptor, dev, fmt,	\
07613b0b5 Jason Baron         2011-10-04 @143  				     ##__VA_ARGS__);		\
ffa10cb47 Jason Baron         2011-08-11  144  } while (0)
ffa10cb47 Jason Baron         2011-08-11  145  
7a555613e Vladimir Kondratiev 2012-12-05  146  #define dynamic_hex_dump(prefix_str, prefix_type, rowsize,	\
7a555613e Vladimir Kondratiev 2012-12-05  147  			 groupsize, buf, len, ascii)		\
7a555613e Vladimir Kondratiev 2012-12-05  148  do {								\
7a555613e Vladimir Kondratiev 2012-12-05  149  	DEFINE_DYNAMIC_DEBUG_METADATA(descriptor,		\
7a555613e Vladimir Kondratiev 2012-12-05  150  		__builtin_constant_p(prefix_str) ? prefix_str : "hexdump");\
9049fc745 Jason Baron         2016-08-03  151  	if (DYNAMIC_DEBUG_BRANCH(descriptor))			\

:::::: The code at line 143 was first introduced by commit
:::::: 07613b0b5ef8570033aa806d1731dce599862223 dynamic_debug: consolidate repetitive struct _ddebug descriptor definitions

:::::: TO: Jason Baron <jbaron@redhat.com>
:::::: CC: Greg Kroah-Hartman <gregkh@suse.de>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h
index 1a55c7976df0..22333477d0b5 100644
--- a/drivers/net/ethernet/smsc/smc91x.h
+++ b/drivers/net/ethernet/smsc/smc91x.h
@@ -414,25 +414,32 @@  smc_pxa_dma_insw(void __iomem *ioaddr, struct smc_local *lp, int reg, int dma,
 #define SMC_outsl(a, r, p, l)		BUG()
 #endif
 
-#if ! SMC_CAN_USE_16BIT
-
 /*
- * Any 16-bit access is performed with two 8-bit accesses if the hardware
- * can't do it directly. Most registers are 16-bit so those are mandatory.
+ * Any 16-bit register access is performed with two 8-bit accesses if the
+ * hardware can't do it directly.
  */
-#define SMC_outw(x, ioaddr, reg)					\
-	do {								\
-		unsigned int __val16 = (x);				\
-		SMC_outb( __val16, ioaddr, reg );			\
-		SMC_outb( __val16 >> 8, ioaddr, reg + (1 << SMC_IO_SHIFT));\
-	} while (0)
-#define SMC_inw(ioaddr, reg)						\
-	({								\
-		unsigned int __val16;					\
-		__val16 =  SMC_inb( ioaddr, reg );			\
+#define SMC_out16(x, ioaddr, reg)					     \
+do {									     \
+	if (SMC_CAN_USE_8BIT && !SMC_16BIT(lp)) {			     \
+		unsigned int __val16 = (x);				     \
+		SMC_outb(__val16, ioaddr, reg );			     \
+		SMC_outb(__val16 >> 8, ioaddr, reg + (1 << SMC_IO_SHIFT));   \
+	} else {							     \
+		SMC_outw(x, ioaddr, reg);				     \
+	}								     \
+} while (0)
+
+#define SMC_in16(ioaddr, reg)						     \
+({									     \
+	unsigned int __val16;					   	     \
+	if (SMC_CAN_USE_8BIT && !SMC_16BIT(lp)) {			     \
+		__val16 =  SMC_inb( ioaddr, reg );			     \
 		__val16 |= SMC_inb( ioaddr, reg + (1 << SMC_IO_SHIFT)) << 8; \
-		__val16;						\
-	})
+	} else {							     \
+		__val16 = SMC_inw(ioaddr, reg);				     \
+	}								     \
+	__val16;							     \
+})
 
 #define SMC_insw(a, r, p, l)		BUG()
 #define SMC_outsw(a, r, p, l)		BUG()
@@ -927,113 +934,113 @@  static const char * chip_ids[ 16 ] =  {
 			SMC_outw((x) << 8, ioaddr, INT_REG(lp));	\
 	} while (0)
 
-#define SMC_CURRENT_BANK(lp)	SMC_inw(ioaddr, BANK_SELECT)
+#define SMC_CURRENT_BANK(lp)	SMC_in16(ioaddr, BANK_SELECT)
 
 #define SMC_SELECT_BANK(lp, x)					\
 	do {								\
 		if (SMC_MUST_ALIGN_WRITE(lp))				\
 			SMC_outl((x)<<16, ioaddr, 12<<SMC_IO_SHIFT);	\
 		else							\
-			SMC_outw(x, ioaddr, BANK_SELECT);		\
+			SMC_out16(x, ioaddr, BANK_SELECT);		\
 	} while (0)
 
-#define SMC_GET_BASE(lp)		SMC_inw(ioaddr, BASE_REG(lp))
+#define SMC_GET_BASE(lp)	SMC_in16(ioaddr, BASE_REG(lp))
 
-#define SMC_SET_BASE(lp, x)		SMC_outw(x, ioaddr, BASE_REG(lp))
+#define SMC_SET_BASE(lp, x)	SMC_out16(x, ioaddr, BASE_REG(lp))
 
-#define SMC_GET_CONFIG(lp)	SMC_inw(ioaddr, CONFIG_REG(lp))
+#define SMC_GET_CONFIG(lp)	SMC_in16(ioaddr, CONFIG_REG(lp))
 
-#define SMC_SET_CONFIG(lp, x)	SMC_outw(x, ioaddr, CONFIG_REG(lp))
+#define SMC_SET_CONFIG(lp, x)	SMC_out16(x, ioaddr, CONFIG_REG(lp))
 
-#define SMC_GET_COUNTER(lp)	SMC_inw(ioaddr, COUNTER_REG(lp))
+#define SMC_GET_COUNTER(lp)	SMC_in16(ioaddr, COUNTER_REG(lp))
 
-#define SMC_GET_CTL(lp)		SMC_inw(ioaddr, CTL_REG(lp))
+#define SMC_GET_CTL(lp)		SMC_in16(ioaddr, CTL_REG(lp))
 
-#define SMC_SET_CTL(lp, x)		SMC_outw(x, ioaddr, CTL_REG(lp))
+#define SMC_SET_CTL(lp, x)	SMC_out16(x, ioaddr, CTL_REG(lp))
 
-#define SMC_GET_MII(lp)		SMC_inw(ioaddr, MII_REG(lp))
+#define SMC_GET_MII(lp)		SMC_in16(ioaddr, MII_REG(lp))
 
-#define SMC_GET_GP(lp)		SMC_inw(ioaddr, GP_REG(lp))
+#define SMC_GET_GP(lp)		SMC_in16(ioaddr, GP_REG(lp))
 
 #define SMC_SET_GP(lp, x)						\
 	do {								\
 		if (SMC_MUST_ALIGN_WRITE(lp))				\
 			SMC_outl((x)<<16, ioaddr, SMC_REG(lp, 8, 1));	\
 		else							\
-			SMC_outw(x, ioaddr, GP_REG(lp));		\
+			SMC_out16(x, ioaddr, GP_REG(lp));		\
 	} while (0)
 
-#define SMC_SET_MII(lp, x)		SMC_outw(x, ioaddr, MII_REG(lp))
+#define SMC_SET_MII(lp, x)	SMC_out16(x, ioaddr, MII_REG(lp))
 
-#define SMC_GET_MIR(lp)		SMC_inw(ioaddr, MIR_REG(lp))
+#define SMC_GET_MIR(lp)		SMC_in16(ioaddr, MIR_REG(lp))
 
-#define SMC_SET_MIR(lp, x)		SMC_outw(x, ioaddr, MIR_REG(lp))
+#define SMC_SET_MIR(lp, x)	SMC_out16(x, ioaddr, MIR_REG(lp))
 
-#define SMC_GET_MMU_CMD(lp)	SMC_inw(ioaddr, MMU_CMD_REG(lp))
+#define SMC_GET_MMU_CMD(lp)	SMC_in16(ioaddr, MMU_CMD_REG(lp))
 
-#define SMC_SET_MMU_CMD(lp, x)	SMC_outw(x, ioaddr, MMU_CMD_REG(lp))
+#define SMC_SET_MMU_CMD(lp, x)	SMC_out16(x, ioaddr, MMU_CMD_REG(lp))
 
-#define SMC_GET_FIFO(lp)		SMC_inw(ioaddr, FIFO_REG(lp))
+#define SMC_GET_FIFO(lp)	SMC_in16(ioaddr, FIFO_REG(lp))
 
-#define SMC_GET_PTR(lp)		SMC_inw(ioaddr, PTR_REG(lp))
+#define SMC_GET_PTR(lp)		SMC_in16(ioaddr, PTR_REG(lp))
 
 #define SMC_SET_PTR(lp, x)						\
 	do {								\
 		if (SMC_MUST_ALIGN_WRITE(lp))				\
 			SMC_outl((x)<<16, ioaddr, SMC_REG(lp, 4, 2));	\
 		else							\
-			SMC_outw(x, ioaddr, PTR_REG(lp));		\
+			SMC_out16(x, ioaddr, PTR_REG(lp));		\
 	} while (0)
 
-#define SMC_GET_EPH_STATUS(lp)	SMC_inw(ioaddr, EPH_STATUS_REG(lp))
+#define SMC_GET_EPH_STATUS(lp)	SMC_in16(ioaddr, EPH_STATUS_REG(lp))
 
-#define SMC_GET_RCR(lp)		SMC_inw(ioaddr, RCR_REG(lp))
+#define SMC_GET_RCR(lp)		SMC_in16(ioaddr, RCR_REG(lp))
 
-#define SMC_SET_RCR(lp, x)		SMC_outw(x, ioaddr, RCR_REG(lp))
+#define SMC_SET_RCR(lp, x)	SMC_out16(x, ioaddr, RCR_REG(lp))
 
-#define SMC_GET_REV(lp)		SMC_inw(ioaddr, REV_REG(lp))
+#define SMC_GET_REV(lp)		SMC_in16(ioaddr, REV_REG(lp))
 
-#define SMC_GET_RPC(lp)		SMC_inw(ioaddr, RPC_REG(lp))
+#define SMC_GET_RPC(lp)		SMC_in16(ioaddr, RPC_REG(lp))
 
 #define SMC_SET_RPC(lp, x)						\
 	do {								\
 		if (SMC_MUST_ALIGN_WRITE(lp))				\
 			SMC_outl((x)<<16, ioaddr, SMC_REG(lp, 8, 0));	\
 		else							\
-			SMC_outw(x, ioaddr, RPC_REG(lp));		\
+			SMC_out16(x, ioaddr, RPC_REG(lp));		\
 	} while (0)
 
-#define SMC_GET_TCR(lp)		SMC_inw(ioaddr, TCR_REG(lp))
+#define SMC_GET_TCR(lp)		SMC_in16(ioaddr, TCR_REG(lp))
 
-#define SMC_SET_TCR(lp, x)		SMC_outw(x, ioaddr, TCR_REG(lp))
+#define SMC_SET_TCR(lp, x)	SMC_out16(x, ioaddr, TCR_REG(lp))
 
 #ifndef SMC_GET_MAC_ADDR
 #define SMC_GET_MAC_ADDR(lp, addr)					\
 	do {								\
 		unsigned int __v;					\
-		__v = SMC_inw(ioaddr, ADDR0_REG(lp));			\
+		__v = SMC_in16(ioaddr, ADDR0_REG(lp));			\
 		addr[0] = __v; addr[1] = __v >> 8;			\
-		__v = SMC_inw(ioaddr, ADDR1_REG(lp));			\
+		__v = SMC_in16(ioaddr, ADDR1_REG(lp));			\
 		addr[2] = __v; addr[3] = __v >> 8;			\
-		__v = SMC_inw(ioaddr, ADDR2_REG(lp));			\
+		__v = SMC_in16(ioaddr, ADDR2_REG(lp));			\
 		addr[4] = __v; addr[5] = __v >> 8;			\
 	} while (0)
 #endif
 
 #define SMC_SET_MAC_ADDR(lp, addr)					\
 	do {								\
-		SMC_outw(addr[0]|(addr[1] << 8), ioaddr, ADDR0_REG(lp)); \
-		SMC_outw(addr[2]|(addr[3] << 8), ioaddr, ADDR1_REG(lp)); \
-		SMC_outw(addr[4]|(addr[5] << 8), ioaddr, ADDR2_REG(lp)); \
+		SMC_out16(addr[0]|(addr[1] << 8), ioaddr, ADDR0_REG(lp)); \
+		SMC_out16(addr[2]|(addr[3] << 8), ioaddr, ADDR1_REG(lp)); \
+		SMC_out16(addr[4]|(addr[5] << 8), ioaddr, ADDR2_REG(lp)); \
 	} while (0)
 
 #define SMC_SET_MCAST(lp, x)						\
 	do {								\
 		const unsigned char *mt = (x);				\
-		SMC_outw(mt[0] | (mt[1] << 8), ioaddr, MCAST_REG1(lp)); \
-		SMC_outw(mt[2] | (mt[3] << 8), ioaddr, MCAST_REG2(lp)); \
-		SMC_outw(mt[4] | (mt[5] << 8), ioaddr, MCAST_REG3(lp)); \
-		SMC_outw(mt[6] | (mt[7] << 8), ioaddr, MCAST_REG4(lp)); \
+		SMC_out16(mt[0] | (mt[1] << 8), ioaddr, MCAST_REG1(lp)); \
+		SMC_out16(mt[2] | (mt[3] << 8), ioaddr, MCAST_REG2(lp)); \
+		SMC_out16(mt[4] | (mt[5] << 8), ioaddr, MCAST_REG3(lp)); \
+		SMC_out16(mt[6] | (mt[7] << 8), ioaddr, MCAST_REG4(lp)); \
 	} while (0)
 
 #define SMC_PUT_PKT_HDR(lp, status, length)				\
@@ -1042,8 +1049,8 @@  static const char * chip_ids[ 16 ] =  {
 			SMC_outl((status) | (length)<<16, ioaddr,	\
 				 DATA_REG(lp));			\
 		else {							\
-			SMC_outw(status, ioaddr, DATA_REG(lp));	\
-			SMC_outw(length, ioaddr, DATA_REG(lp));	\
+			SMC_out16(status, ioaddr, DATA_REG(lp));	\
+			SMC_out16(length, ioaddr, DATA_REG(lp));	\
 		}							\
 	} while (0)
 
@@ -1053,9 +1060,9 @@  static const char * chip_ids[ 16 ] =  {
 			unsigned int __val = SMC_inl(ioaddr, DATA_REG(lp)); \
 			(status) = __val & 0xffff;			\
 			(length) = __val >> 16;				\
-		} else {						\
-			(status) = SMC_inw(ioaddr, DATA_REG(lp));	\
-			(length) = SMC_inw(ioaddr, DATA_REG(lp));	\
+		} else if (SMC_16BIT(lp) {						\
+			(status) = SMC_in16(ioaddr, DATA_REG(lp));	\
+			(length) = SMC_in16(ioaddr, DATA_REG(lp));	\
 		}							\
 	} while (0)