]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: wilc1000: remove unnecessary loop to traverse vif interfaces
authorAjay Singh <ajay.kathat@microchip.com>
Wed, 26 Jun 2019 12:40:58 +0000 (12:40 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jul 2019 07:01:41 +0000 (09:01 +0200)
Cleanup patch to avoid loop to traverse the interfaces instead make use
of vif received from net_device priv data.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/host_interface.c
drivers/staging/wilc1000/wilc_netdev.c

index 389f9f8c2f8c5f3f09287ac6cda0d53e9e30391c..368808838fa2c28cba4620c3ed0d70e2e9c8e1a0 100644 (file)
@@ -1634,19 +1634,14 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
        struct host_if_drv *hif_drv;
        struct wilc_vif *vif = netdev_priv(dev);
        struct wilc *wilc = vif->wilc;
-       int i;
 
        hif_drv  = kzalloc(sizeof(*hif_drv), GFP_KERNEL);
        if (!hif_drv)
                return -ENOMEM;
 
        *hif_drv_handler = hif_drv;
-       for (i = 0; i < wilc->vif_num; i++)
-               if (dev == wilc->vif[i]->ndev) {
-                       wilc->vif[i]->hif_drv = hif_drv;
-                       break;
-               }
 
+       vif->hif_drv = hif_drv;
        vif->obtaining_ip = false;
 
        if (wilc->clients_count == 0)
index ad04744c4e4f219309f835eb265a5d64a2d9455b..0af60b2f9f6dc9ea9a4a55a0e577e20fe5ff2c06 100644 (file)
@@ -614,7 +614,6 @@ static int wilc_mac_open(struct net_device *ndev)
        struct wilc_priv *priv = wdev_priv(vif->ndev->ieee80211_ptr);
        unsigned char mac_add[ETH_ALEN] = {0};
        int ret = 0;
-       int i = 0;
 
        if (!wl || !wl->dev) {
                netdev_err(ndev, "device not ready\n");
@@ -633,19 +632,14 @@ static int wilc_mac_open(struct net_device *ndev)
                return ret;
        }
 
-       for (i = 0; i < wl->vif_num; i++) {
-               if (ndev == wl->vif[i]->ndev) {
-                       wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif),
-                                                vif->iftype, vif->idx);
-                       wilc_set_operation_mode(vif, vif->iftype);
-                       break;
-               }
-       }
+       wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif), vif->iftype,
+                                vif->idx);
+       wilc_set_operation_mode(vif, vif->iftype);
 
        wilc_get_mac_address(vif, mac_add);
        netdev_dbg(ndev, "Mac address: %pM\n", mac_add);
-       memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN);
-       memcpy(ndev->dev_addr, wl->vif[i]->src_addr, ETH_ALEN);
+       memcpy(vif->src_addr, mac_add, ETH_ALEN);
+       memcpy(ndev->dev_addr, vif->src_addr, ETH_ALEN);
 
        if (!is_valid_ether_addr(ndev->dev_addr)) {
                netdev_err(ndev, "Wrong MAC address\n");