@@ -7974,31 +7974,27 @@ static const struct net_device_ops rtl_netdev_ops = {
7974
7974
7975
7975
static const struct rtl_cfg_info {
7976
7976
void (* hw_start )(struct rtl8169_private * tp );
7977
- unsigned int region ;
7978
7977
u16 event_slow ;
7979
7978
unsigned int has_gmii :1 ;
7980
7979
const struct rtl_coalesce_info * coalesce_info ;
7981
7980
u8 default_ver ;
7982
7981
} rtl_cfg_infos [] = {
7983
7982
[RTL_CFG_0 ] = {
7984
7983
.hw_start = rtl_hw_start_8169 ,
7985
- .region = 1 ,
7986
7984
.event_slow = SYSErr | LinkChg | RxOverflow | RxFIFOOver ,
7987
7985
.has_gmii = 1 ,
7988
7986
.coalesce_info = rtl_coalesce_info_8169 ,
7989
7987
.default_ver = RTL_GIGA_MAC_VER_01 ,
7990
7988
},
7991
7989
[RTL_CFG_1 ] = {
7992
7990
.hw_start = rtl_hw_start_8168 ,
7993
- .region = 2 ,
7994
7991
.event_slow = SYSErr | LinkChg | RxOverflow ,
7995
7992
.has_gmii = 1 ,
7996
7993
.coalesce_info = rtl_coalesce_info_8168_8136 ,
7997
7994
.default_ver = RTL_GIGA_MAC_VER_11 ,
7998
7995
},
7999
7996
[RTL_CFG_2 ] = {
8000
7997
.hw_start = rtl_hw_start_8101 ,
8001
- .region = 2 ,
8002
7998
.event_slow = SYSErr | LinkChg | RxOverflow | RxFIFOOver |
8003
7999
PCSTimeout ,
8004
8000
.coalesce_info = rtl_coalesce_info_8168_8136 ,
@@ -8098,11 +8094,10 @@ static void rtl_hw_initialize(struct rtl8169_private *tp)
8098
8094
static int rtl_init_one (struct pci_dev * pdev , const struct pci_device_id * ent )
8099
8095
{
8100
8096
const struct rtl_cfg_info * cfg = rtl_cfg_infos + ent -> driver_data ;
8101
- const unsigned int region = cfg -> region ;
8102
8097
struct rtl8169_private * tp ;
8103
8098
struct mii_if_info * mii ;
8104
8099
struct net_device * dev ;
8105
- int chipset , i ;
8100
+ int chipset , region , i ;
8106
8101
int rc ;
8107
8102
8108
8103
if (netif_msg_drv (& debug )) {
@@ -8144,11 +8139,10 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
8144
8139
if (pcim_set_mwi (pdev ) < 0 )
8145
8140
netif_info (tp , probe , dev , "Mem-Wr-Inval unavailable\n" );
8146
8141
8147
- /* make sure PCI base addr 1 is MMIO */
8148
- if (!(pci_resource_flags (pdev , region ) & IORESOURCE_MEM )) {
8149
- netif_err (tp , probe , dev ,
8150
- "region #%d not an MMIO resource, aborting\n" ,
8151
- region );
8142
+ /* use first MMIO region */
8143
+ region = ffs (pci_select_bars (pdev , IORESOURCE_MEM )) - 1 ;
8144
+ if (region < 0 ) {
8145
+ netif_err (tp , probe , dev , "no MMIO resource found\n" );
8152
8146
return - ENODEV ;
8153
8147
}
8154
8148
0 commit comments