staging: wilc1000: linux_wlan_get_firmware: change argument p_nic with dev
authorGlen Lee <glen.lee@atmel.com>
Thu, 29 Oct 2015 03:18:49 +0000 (12:18 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Nov 2015 04:02:47 +0000 (20:02 -0800)
This patch changes argument perInterface_wlan_t *p_nic with struct net_device
*dev and use netdev private data nic and it's member wilc instead of
g_linux_wlan.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/linux_wlan.c
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
drivers/staging/wilc1000/wilc_wfi_netdevice.h

index fee8c61385b2a2cf87973a722641be8cae6deba9..2103e8c0d6f9c9d9cebd3a37f2b67fad414fdc97 100644 (file)
@@ -517,14 +517,17 @@ void linux_wlan_rx_complete(void)
        PRINT_D(RX_DBG, "RX completed\n");
 }
 
-int linux_wlan_get_firmware(perInterface_wlan_t *p_nic)
+int linux_wlan_get_firmware(struct net_device *dev)
 {
-
-       perInterface_wlan_t *nic = p_nic;
+       perInterface_wlan_t *nic;
+       struct wilc *wilc;
        int ret = 0;
        const struct firmware *wilc_firmware;
        char *firmware;
 
+       nic = netdev_priv(dev);
+       wilc = nic->wilc;
+
        if (nic->iftype == AP_MODE)
                firmware = AP_FIRMWARE;
        else if (nic->iftype == STATION_MODE)
@@ -549,19 +552,19 @@ int linux_wlan_get_firmware(perInterface_wlan_t *p_nic)
         *      root file system with the name specified above */
 
 #ifdef WILC_SDIO
-       if (request_firmware(&wilc_firmware, firmware, &g_linux_wlan->wilc_sdio_func->dev) != 0) {
+       if (request_firmware(&wilc_firmware, firmware, &wilc->wilc_sdio_func->dev) != 0) {
                PRINT_ER("%s - firmare not available\n", firmware);
                ret = -1;
                goto _fail_;
        }
 #else
-       if (request_firmware(&wilc_firmware, firmware, &g_linux_wlan->wilc_spidev->dev) != 0) {
+       if (request_firmware(&wilc_firmware, firmware, &wilc->wilc_spidev->dev) != 0) {
                PRINT_ER("%s - firmare not available\n", firmware);
                ret = -1;
                goto _fail_;
        }
 #endif
-       g_linux_wlan->firmware = wilc_firmware;
+       wilc->firmware = wilc_firmware;
 
 _fail_:
 
@@ -1125,7 +1128,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
                }
 #endif
 
-               if (linux_wlan_get_firmware(nic)) {
+               if (linux_wlan_get_firmware(dev)) {
                        PRINT_ER("Can't get firmware\n");
                        ret = -EIO;
                        goto _fail_irq_enable_;
index cdcf134c314a300e500b35fd7880ae8c4825e9da..32b93d3f806da61332d033c07125c5d60eee8eac 100644 (file)
@@ -21,8 +21,6 @@
 #define IS_MGMT_STATUS_SUCCES                  0x040
 #define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
 
-extern int linux_wlan_get_firmware(perInterface_wlan_t *p_nic);
-
 extern int mac_open(struct net_device *ndev);
 extern int mac_close(struct net_device *ndev);
 
@@ -2737,7 +2735,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
                PRINT_D(CORECONFIG_DBG, "priv->hWILCWFIDrv[%p]\n", priv->hWILCWFIDrv);
 
                PRINT_D(HOSTAPD_DBG, "Downloading AP firmware\n");
-               linux_wlan_get_firmware(nic);
+               linux_wlan_get_firmware(dev);
                /*If wilc is running, then close-open to actually get new firmware running (serves P2P)*/
                if (wl->initialized)    {
                        nic->iftype = AP_MODE;
index 0bfe7626ad2d22a5f0db9007d3700b6e8511c5ed..0435cb571227298564678d94e42043ffcd413bed 100644 (file)
@@ -218,4 +218,5 @@ int wilc_netdev_init(struct wilc **wilc);
 void wilc1000_wlan_deinit(struct net_device *dev);
 void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
 u16 Set_machw_change_vir_if(struct net_device *dev, bool bValue);
+int linux_wlan_get_firmware(struct net_device *dev);
 #endif