Commit b1940451 authored by Alex Maftei (amaftei)'s avatar Alex Maftei (amaftei) Committed by David S. Miller

sfc: further preparation for code split

Added more arguments for a couple of functions.
Also moved a function to the common header.
Signed-off-by: default avatarAlexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e1253f39
...@@ -233,16 +233,6 @@ static int efx_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **xdpfs, ...@@ -233,16 +233,6 @@ static int efx_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **xdpfs,
ASSERT_RTNL(); \ ASSERT_RTNL(); \
} while (0) } while (0)
int efx_check_disabled(struct efx_nic *efx)
{
if (efx->state == STATE_DISABLED || efx->state == STATE_RECOVERY) {
netif_err(efx, drv, efx->net_dev,
"device is disabled due to earlier errors\n");
return -EIO;
}
return 0;
}
/************************************************************************** /**************************************************************************
* *
* Event queue processing * Event queue processing
...@@ -1283,17 +1273,14 @@ static void efx_dissociate(struct efx_nic *efx) ...@@ -1283,17 +1273,14 @@ static void efx_dissociate(struct efx_nic *efx)
} }
/* This configures the PCI device to enable I/O and DMA. */ /* This configures the PCI device to enable I/O and DMA. */
int efx_init_io(struct efx_nic *efx) int efx_init_io(struct efx_nic *efx, int bar, dma_addr_t dma_mask,
unsigned int mem_map_size)
{ {
struct pci_dev *pci_dev = efx->pci_dev; struct pci_dev *pci_dev = efx->pci_dev;
dma_addr_t dma_mask = efx->type->max_dma_mask; int rc;
unsigned int mem_map_size = efx->type->mem_map_size(efx);
int rc, bar;
netif_dbg(efx, probe, efx->net_dev, "initialising I/O\n"); netif_dbg(efx, probe, efx->net_dev, "initialising I/O\n");
bar = efx->type->mem_bar(efx);
rc = pci_enable_device(pci_dev); rc = pci_enable_device(pci_dev);
if (rc) { if (rc) {
netif_err(efx, probe, efx->net_dev, netif_err(efx, probe, efx->net_dev,
...@@ -1354,10 +1341,8 @@ int efx_init_io(struct efx_nic *efx) ...@@ -1354,10 +1341,8 @@ int efx_init_io(struct efx_nic *efx)
return rc; return rc;
} }
void efx_fini_io(struct efx_nic *efx) void efx_fini_io(struct efx_nic *efx, int bar)
{ {
int bar;
netif_dbg(efx, drv, efx->net_dev, "shutting down I/O\n"); netif_dbg(efx, drv, efx->net_dev, "shutting down I/O\n");
if (efx->membase) { if (efx->membase) {
...@@ -1366,7 +1351,6 @@ void efx_fini_io(struct efx_nic *efx) ...@@ -1366,7 +1351,6 @@ void efx_fini_io(struct efx_nic *efx)
} }
if (efx->membase_phys) { if (efx->membase_phys) {
bar = efx->type->mem_bar(efx);
pci_release_region(efx->pci_dev, bar); pci_release_region(efx->pci_dev, bar);
efx->membase_phys = 0; efx->membase_phys = 0;
} }
...@@ -3548,7 +3532,7 @@ static void efx_pci_remove(struct pci_dev *pci_dev) ...@@ -3548,7 +3532,7 @@ static void efx_pci_remove(struct pci_dev *pci_dev)
efx_pci_remove_main(efx); efx_pci_remove_main(efx);
efx_fini_io(efx); efx_fini_io(efx, efx->type->mem_bar(efx));
netif_dbg(efx, drv, efx->net_dev, "shutdown successful\n"); netif_dbg(efx, drv, efx->net_dev, "shutdown successful\n");
efx_fini_struct(efx); efx_fini_struct(efx);
...@@ -3771,7 +3755,8 @@ static int efx_pci_probe(struct pci_dev *pci_dev, ...@@ -3771,7 +3755,8 @@ static int efx_pci_probe(struct pci_dev *pci_dev,
efx_probe_vpd_strings(efx); efx_probe_vpd_strings(efx);
/* Set up basic I/O (BAR mappings etc) */ /* Set up basic I/O (BAR mappings etc) */
rc = efx_init_io(efx); rc = efx_init_io(efx, efx->type->mem_bar(efx), efx->type->max_dma_mask,
efx->type->mem_map_size(efx));
if (rc) if (rc)
goto fail2; goto fail2;
...@@ -3815,7 +3800,7 @@ static int efx_pci_probe(struct pci_dev *pci_dev, ...@@ -3815,7 +3800,7 @@ static int efx_pci_probe(struct pci_dev *pci_dev,
return 0; return 0;
fail3: fail3:
efx_fini_io(efx); efx_fini_io(efx, efx->type->mem_bar(efx));
fail2: fail2:
efx_fini_struct(efx); efx_fini_struct(efx);
fail1: fail1:
......
...@@ -11,8 +11,9 @@ ...@@ -11,8 +11,9 @@
#ifndef EFX_COMMON_H #ifndef EFX_COMMON_H
#define EFX_COMMON_H #define EFX_COMMON_H
int efx_init_io(struct efx_nic *efx); int efx_init_io(struct efx_nic *efx, int bar, dma_addr_t dma_mask,
void efx_fini_io(struct efx_nic *efx); unsigned int mem_map_size);
void efx_fini_io(struct efx_nic *efx, int bar);
int efx_init_struct(struct efx_nic *efx, struct pci_dev *pci_dev, int efx_init_struct(struct efx_nic *efx, struct pci_dev *pci_dev,
struct net_device *net_dev); struct net_device *net_dev);
void efx_fini_struct(struct efx_nic *efx); void efx_fini_struct(struct efx_nic *efx);
...@@ -44,7 +45,15 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok); ...@@ -44,7 +45,15 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok);
int efx_reset(struct efx_nic *efx, enum reset_type method); int efx_reset(struct efx_nic *efx, enum reset_type method);
void efx_schedule_reset(struct efx_nic *efx, enum reset_type type); void efx_schedule_reset(struct efx_nic *efx, enum reset_type type);
int efx_check_disabled(struct efx_nic *efx); static inline int efx_check_disabled(struct efx_nic *efx)
{
if (efx->state == STATE_DISABLED || efx->state == STATE_RECOVERY) {
netif_err(efx, drv, efx->net_dev,
"device is disabled due to earlier errors\n");
return -EIO;
}
return 0;
}
void efx_mac_reconfigure(struct efx_nic *efx); void efx_mac_reconfigure(struct efx_nic *efx);
void efx_link_status_changed(struct efx_nic *efx); void efx_link_status_changed(struct efx_nic *efx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment