staging/wilc1000: use device pointer for phy creation
authorArnd Bergmann <arnd@arndb.de>
Mon, 16 Nov 2015 14:05:03 +0000 (15:05 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Dec 2015 22:19:20 +0000 (14:19 -0800)
wilc_create_wiphy tries to get a pointer to a device from the
global wilc_sdio_func variable. This is a layering violation
and we can use the wilc_dev->dev pointer instead.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/linux_wlan.c
drivers/staging/wilc1000/linux_wlan_sdio.c
drivers/staging/wilc1000/linux_wlan_sdio.h
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h

index b1707147aa7d0bb6496ebae3a66cf4308c4bbad0..08c3be8728b230a1320f1dc2f7c26f511870cb6b 100644 (file)
@@ -1457,7 +1457,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type)
 
                {
                        struct wireless_dev *wdev;
-                       wdev = wilc_create_wiphy(ndev);
+                       wdev = wilc_create_wiphy(ndev, dev);
 
                        if (dev)
                                SET_NETDEV_DEV(ndev, dev);
index d2843b949a1b7801b20f7dce48d43bdecd5e9948..874a859cad21fc4bd69522b20eff1ad912ad6afc 100644 (file)
@@ -22,7 +22,7 @@
  #define MAX_SPEED (6 * 1000000) /* Max 50M */
 #endif
 
-struct sdio_func *wilc_sdio_func;
+static struct sdio_func *wilc_sdio_func;
 static unsigned int sdio_default_speed;
 
 #define SDIO_VENDOR_ID_WILC 0x0296
index 3e1618526e78a60418e55f6b5812d804e9d656fe..df733c25e77020ad6729362810a74b2021bfbe7d 100644 (file)
@@ -1,7 +1,5 @@
 #include <linux/mmc/sdio_func.h>
 
-extern struct sdio_func *wilc_sdio_func;
-
 int wilc_sdio_init(void);
 int wilc_sdio_cmd52(sdio_cmd52_t *cmd);
 int wilc_sdio_cmd53(sdio_cmd53_t *cmd);
index 46c3f578a6fdc8a26bbcb8e9eded116c0c6b70b3..cc279c654e53bdcebfcf560553b4db8994830f55 100644 (file)
@@ -11,9 +11,6 @@
  */
 
 #include "wilc_wfi_cfgoperations.h"
-#ifdef WILC_SDIO
-#include "linux_wlan_sdio.h"
-#endif
 #include "host_interface.h"
 #include <linux/errno.h>
 
@@ -3414,7 +3411,7 @@ _fail_:
  *  @date      01 MAR 2012
  *  @version   1.0
  */
-struct wireless_dev *wilc_create_wiphy(struct net_device *net)
+struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev)
 {
        struct wilc_priv *priv;
        struct wireless_dev *wdev;
@@ -3466,9 +3463,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net)
                   wdev->wiphy->max_scan_ssids, wdev->wiphy->max_scan_ie_len, wdev->wiphy->signal_type,
                   wdev->wiphy->interface_modes, wdev->iftype);
 
-       #ifdef WILC_SDIO
-       set_wiphy_dev(wdev->wiphy, &wilc_sdio_func->dev);
-       #endif
+       set_wiphy_dev(wdev->wiphy, dev);
 
        /*Register wiphy structure*/
        s32Error = wiphy_register(wdev->wiphy);
index 158d98c0eb87e125746709ef8ef854999edf2882..ab53d9d5908113405deceb383a9a0308f278e17e 100644 (file)
@@ -10,7 +10,7 @@
 #define NM_WFI_CFGOPERATIONS
 #include "wilc_wfi_netdevice.h"
 
-struct wireless_dev *wilc_create_wiphy(struct net_device *net);
+struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev);
 void wilc_free_wiphy(struct net_device *net);
 int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed);
 int wilc_deinit_host_int(struct net_device *net);