sfc: Make board information explicitly Falcon-specific
Subsystems (2)
PATCH 9/17 sfc: Make board information explicitly Falcon-specific
Rename struct efx_board to struct falcon_board.
Introduce and use inline function to look up board info from struct efx_nic, in preparation for moving it.
Move board init and fini calls into NIC probe and remove functions.
Signed-off-by Ben Hutchings <[email protected]>
--- drivers/net/sfc/efx.c | 25 ++------- drivers/net/sfc/ethtool.c | 6 +- drivers/net/sfc/falcon.c | 11 ++++ drivers/net/sfc/falcon.h | 5 ++ drivers/net/sfc/falcon_boards.c | 106 +++++++++++++++++++++------------------ drivers/net/sfc/net_driver.h | 6 +- drivers/net/sfc/qt202x_phy.c | 2 +- drivers/net/sfc/tenxpress.c | 2 +- 8 files changed, 88 insertions(+), 75 deletions(-)
drivers/net/sfc/efx.c +6 -19
@@ -1265,7 +1265,7 @@ static void efx_monitor(struct work_struct *data) goto out_requeue;if (!efx->port_enabled) goto out_unlock; - rc = efx->board_info.monitor (efx); + rc =falcon_board (efx)->monitor (efx);if (rc) {EFX_ERR (efx,"Board sensor %s; shutting down PHY\n" , (rc == -ERANGE ) ?"reported fault" :"failed" );
@@ -1908,7 +1908,7 @@ static struct efx_phy_operations efx_dummy_phy_operations = { .clear_interrupt = efx_port_dummy_op_void, }; -static struct efx_board efx_dummy_board_info = { +static struct falcon_board efx_dummy_board_info = { .init = efx_port_dummy_op_int, .init_phy = efx_port_dummy_op_void, .set_id_led = efx_port_dummy_op_set_id_led,
@@ -2026,10 +2026,6 @@ static void efx_pci_remove_main(struct efx_nic *efx)falcon_fini_interrupt (efx);efx_fini_channels (efx);efx_fini_port (efx); - -/* Shutdown the board, then the NIC and board state */ - efx->board_info.fini (efx); -efx_fini_napi (efx);efx_remove_all (efx); }
@@ -2089,39 +2085,30 @@ static int efx_pci_probe_main(struct efx_nic *efx)if (rc) goto fail2; -/* Initialise the board */ - rc = efx->board_info.init (efx); -if (rc) { -EFX_ERR (efx,"failed to initialise board\n" ); - goto fail3; - } - rc =falcon_init_nic (efx);if (rc) {EFX_ERR (efx,"failed to initialise NIC\n" ); - goto fail4; + goto fail3; } rc =efx_init_port (efx);if (rc) {EFX_ERR (efx,"failed to initialise port\n" ); - goto fail5; + goto fail4; }efx_init_channels (efx); rc =falcon_init_interrupt (efx);if (rc) - goto fail6; + goto fail5;return 0 ; - fail6: + fail5:efx_fini_channels (efx);efx_fini_port (efx); - fail5: fail4: - efx->board_info.fini (efx); fail3:efx_fini_napi (efx); fail2:
drivers/net/sfc/ethtool.c +3 -3
@@ -188,14 +188,14 @@ static int efx_ethtool_phys_id(struct net_device *net_dev, u32 count)struct efx_nic *efx =netdev_priv (net_dev);do { - efx->board_info.set_id_led (efx,EFX_LED_ON ); +falcon_board (efx)->set_id_led (efx,EFX_LED_ON );schedule_timeout_interruptible (HZ /2 ); - efx->board_info.set_id_led (efx,EFX_LED_OFF ); +falcon_board (efx)->set_id_led (efx,EFX_LED_OFF );schedule_timeout_interruptible (HZ /2 ); }while (!signal_pending (current) && --count !=0 ); - efx->board_info.set_id_led (efx,EFX_LED_DEFAULT ); +falcon_board (efx)->set_id_led (efx,EFX_LED_DEFAULT );return 0 ; }
drivers/net/sfc/falcon.c +11 -0
@@ -2877,8 +2877,17 @@ int falcon_probe_nic(struct efx_nic *efx)if (rc) goto fail5; + rc =falcon_board (efx)->init (efx); +if (rc) { +EFX_ERR (efx,"failed to initialise board\n" ); + goto fail6; + } +return 0 ; + fail6: +BUG_ON (i2c_del_adapter (&efx->i2c_adap)); +memset (&efx->i2c_adap,0 ,sizeof (efx->i2c_adap)); fail5:falcon_remove_spi_devices (efx);falcon_free_buffer (efx, &efx->irq_status);
@@ -3070,6 +3079,8 @@ void falcon_remove_nic(struct efx_nic *efx)struct falcon_nic_data *nic_data = efx->nic_data;int rc; +falcon_board (efx)->fini (efx); +/* Remove I2C adapter and clear it in preparation for a retry */ rc =i2c_del_adapter (&efx->i2c_adap);BUG_ON (rc);
drivers/net/sfc/falcon.h +5 -0
@@ -29,6 +29,11 @@ static inline int falcon_rev(struct efx_nic *efx)return efx->pci_dev->revision; } +static inline struct falcon_board *falcon_board (struct efx_nic *efx) +{ +return &efx->board_info; +} +extern struct efx_nic_type falcon_a_nic_type;extern struct efx_nic_type falcon_b_nic_type;
drivers/net/sfc/falcon_boards.c +58 -48
265 lines not on this page · raw message
drivers/net/sfc/net_driver.h +3 -3
@@ -395,7 +395,7 @@ enum efx_led_mode { };/** -* struct efx_board - board information +* struct falcon_board - board information * @type: Board model type * @major: Major rev. ('A', 'B' ...) * @minor: Minor rev. (0, 1, ...)
@@ -407,7 +407,7 @@ enum efx_led_mode {* @hwmon_client: I2C client for hardware monitor * @ioexp_client: I2C client for power/port control */ -struct efx_board { +struct falcon_board {int type;int major;int minor;
@@ -752,7 +752,7 @@ struct efx_nic {unsigned int irq_rx_moderation;struct i2c_adapter i2c_adap; -struct efx_board board_info; +struct falcon_board board_info;enum nic_state state;enum reset_type reset_pending;
drivers/net/sfc/qt202x_phy.c +1 -1
@@ -126,7 +126,7 @@ static int qt202x_reset_phy(struct efx_nic *efx)if (rc <0 ) goto fail; - efx->board_info.init_phy (efx); +falcon_board (efx)->init_phy (efx);return rc;
drivers/net/sfc/tenxpress.c +1 -1
@@ -303,7 +303,7 @@ static int tenxpress_phy_init(struct efx_nic *efx)u16 old_adv, adv;int rc =0 ; - efx->board_info.init_phy (efx); +falcon_board (efx)->init_phy (efx); phy_data =kzalloc (sizeof (*phy_data),GFP_KERNEL );if (!phy_data)
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.