]> git.baikalelectronics.ru Git - kernel.git/commit
net: via-rhine: Convert #ifdef USE_MMIO to a runtime flag
authorAlexey Charkov <alchark@gmail.com>
Sat, 3 May 2014 12:40:53 +0000 (16:40 +0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 May 2014 19:36:41 +0000 (15:36 -0400)
commit7fa600eb512876aea252bda38e3064a90b79d09e
tree3d2bbe24b1c6ffce7faa2fd0b8f5f262ed0326ca
parentc6bbb5d330d90c2aa0ab9ca1159b9c0847e6088c
net: via-rhine: Convert #ifdef USE_MMIO to a runtime flag

This introduces another flag in 'quirks' to replace the preprocessor
define (USE_MMIO) used to indicate whether the device needs a
separate enable routine to operate in MMIO mode.

All of the currently known platform Rhine cores operate in MMIO
mode by default, and on PCI it is preferred over PIO for performance
reasons. However, a comment in code suggests that some (?) early
Rhine cores only work in PIO mode, so they should not be switched
to MMIO.

Enabling MMIO on PCI is still triggered by the same Kconfig option
to avoid breaking user configs needlessly, but this can be changed
going forward towards automatic runtime detection in case a list of
PIO-only Rhine revisions can be compiled.

This also fixes a couple of compiler warnings detected by Fengguang
Wu's test bot (!USE_MMIO case):

   drivers/net/ethernet/via/via-rhine.c: In function 'rhine_init_one_pci':
   drivers/net/ethernet/via/via-rhine.c:1108:1: warning: label 'err_out_unmap' defined but not used [-Wunused-label]
    err_out_unmap:
    ^
   drivers/net/ethernet/via/via-rhine.c:1022:6: warning: unused variable 'i' [-Wunused-variable]
     int i, rc;
         ^
   drivers/net/ethernet/via/via-rhine.c:916:22: warning: 'quirks' may be used uninitialized in this function [-Wmaybe-uninitialized]
     phy_id = rp->quirks & rqIntPHY ? 1 : 0;
                         ^
   drivers/net/ethernet/via/via-rhine.c:1026:6: note: 'quirks' was declared here
     u32 quirks;
         ^

Signed-off-by: Alexey Charkov <alchark@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/via/via-rhine.c