From: <Ajay.Kathat@microchip.com>
To: <linux-wireless@vger.kernel.org>
Cc: <devel@driverdev.osuosl.org>, <gregkh@linuxfoundation.org>,
<Adham.Abozaeid@microchip.com>, <johannes@sipsolutions.net>,
<Ajay.Kathat@microchip.com>
Subject: [PATCH 5/8] staging: wilc1000: remove unnecessary loop to traverse vif interfaces
Date: Wed, 26 Jun 2019 12:40:58 +0000 [thread overview]
Message-ID: <1561552810-8933-6-git-send-email-ajay.kathat@microchip.com> (raw)
In-Reply-To: <1561552810-8933-1-git-send-email-ajay.kathat@microchip.com>
From: Ajay Singh <ajay.kathat@microchip.com>
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>
---
drivers/staging/wilc1000/host_interface.c | 7 +------
drivers/staging/wilc1000/wilc_netdev.c | 16 +++++-----------
2 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 389f9f8c..3688088 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -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)
diff --git a/drivers/staging/wilc1000/wilc_netdev.c b/drivers/staging/wilc1000/wilc_netdev.c
index ad04744..0af60b2 100644
--- a/drivers/staging/wilc1000/wilc_netdev.c
+++ b/drivers/staging/wilc1000/wilc_netdev.c
@@ -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");
--
2.7.4
next prev parent reply other threads:[~2019-06-26 12:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-26 12:40 [PATCH 0/8] staging: wilc1000: dynamically add/delete interfaces & cleanup fixes Ajay.Kathat
2019-06-26 12:40 ` [PATCH 1/8] staging: wilc1000: handle p2p operations in caller context Ajay.Kathat
2019-06-26 12:40 ` [PATCH 2/8] staging: wilc1000: fix error path cleanup in wilc_wlan_initialize() Ajay.Kathat
2019-06-26 12:40 ` [PATCH 3/8] staging: wilc1000: added support to dynamically add/remove interfaces Ajay.Kathat
2019-06-26 12:40 ` [PATCH 4/8] staging: wilc1000: remove use of driver_handler_id & ifc_id Ajay.Kathat
2019-06-26 12:40 ` Ajay.Kathat [this message]
2019-06-26 12:41 ` [PATCH 6/8] staging: wilc1000: remove use of 'src_addr' element in 'wilc_vif' struct Ajay.Kathat
2019-06-26 12:41 ` [PATCH 7/8] staging: wilc1000: remove extra argument passing to wilc_send_config_pkt() Ajay.Kathat
2019-06-26 12:41 ` [PATCH 8/8] staging: wilc1000: rename 'host_interface' source and header Ajay.Kathat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1561552810-8933-6-git-send-email-ajay.kathat@microchip.com \
--to=ajay.kathat@microchip.com \
--cc=Adham.Abozaeid@microchip.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox