From: Sathya Perla Date: Mon, 23 Feb 2015 09:20:16 +0000 (-0500) Subject: be2net: move be_func_init() call inside be_setup() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f962f840f81f5b9f2df136dd44872f18a82def38;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git be2net: move be_func_init() call inside be_setup() Every time be_setup() is called, the driver will have to wait for the function/FW to be properly initialized. So, it make sense to move this call inside be_setup(). Signed-off-by: Sathya Perla Signed-off-by: Kalesh AP Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 7aa1a4dd2df9..b2277a4c7ddf 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -3944,11 +3944,53 @@ static inline int fw_major_num(const char *fw_ver) return fw_major; } +/* If any VFs are already enabled don't FLR the PF */ +static bool be_reset_required(struct be_adapter *adapter) +{ + return pci_num_vf(adapter->pdev) ? false : true; +} + +/* Wait for the FW to be ready and perform the required initialization */ +static int be_func_init(struct be_adapter *adapter) +{ + int status; + + status = be_fw_wait_ready(adapter); + if (status) + return status; + + if (be_reset_required(adapter)) { + status = be_cmd_reset_function(adapter); + if (status) + return status; + + /* Wait for interrupts to quiesce after an FLR */ + msleep(100); + + /* We can clear all errors when function reset succeeds */ + be_clear_all_error(adapter); + } + + /* Tell FW we're ready to fire cmds */ + status = be_cmd_fw_init(adapter); + if (status) + return status; + + /* Allow interrupts for other ULPs running on NIC function */ + be_intr_set(adapter, true); + + return 0; +} + static int be_setup(struct be_adapter *adapter) { struct device *dev = &adapter->pdev->dev; int status; + status = be_func_init(adapter); + if (status) + return status; + be_setup_init(adapter); if (!lancer_chip(adapter)) @@ -4903,44 +4945,6 @@ static void be_netdev_init(struct net_device *netdev) netdev->ethtool_ops = &be_ethtool_ops; } -/* If any VFs are already enabled don't FLR the PF */ -static bool be_reset_required(struct be_adapter *adapter) -{ - return pci_num_vf(adapter->pdev) ? false : true; -} - -/* Wait for the FW to be ready and perform the required initialization */ -static int be_func_init(struct be_adapter *adapter) -{ - int status; - - status = be_fw_wait_ready(adapter); - if (status) - return status; - - if (be_reset_required(adapter)) { - status = be_cmd_reset_function(adapter); - if (status) - return status; - - /* Wait for interrupts to quiesce after an FLR */ - msleep(100); - - /* We can clear all errors when function reset succeeds */ - be_clear_all_error(adapter); - } - - /* Tell FW we're ready to fire cmds */ - status = be_cmd_fw_init(adapter); - if (status) - return status; - - /* Allow interrupts for other ULPs running on NIC function */ - be_intr_set(adapter, true); - - return 0; -} - static void be_cleanup(struct be_adapter *adapter) { struct net_device *netdev = adapter->netdev; @@ -4959,10 +4963,6 @@ static int be_resume(struct be_adapter *adapter) struct net_device *netdev = adapter->netdev; int status; - status = be_func_init(adapter); - if (status) - return status; - status = be_setup(adapter); if (status) return status; @@ -5365,10 +5365,6 @@ static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id) if (status) goto unmap_bars; - status = be_func_init(adapter); - if (status) - goto drv_cleanup; - status = be_setup(adapter); if (status) goto drv_cleanup;