Linux wireless drivers development
 help / color / mirror / Atom feed
From: "Franky Lin" <frankyl@broadcom.com>
To: gregkh@suse.de
Cc: devel@linuxdriverproject.org, linux-wireless@vger.kernel.org
Subject: [PATCH v2 19/19] staging: brcm80211: simplified internal ioctl function once more
Date: Thu, 22 Sep 2011 17:07:56 -0700	[thread overview]
Message-ID: <1316736476-23725-20-git-send-email-frankyl@broadcom.com> (raw)
In-Reply-To: <1316736476-23725-1-git-send-email-frankyl@broadcom.com>

From: Roland Vossen <rvossen@broadcom.com>

Code cleanup. Merged two functions.

Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/staging/brcm80211/brcmfmac/dhd.h         |    3 +-
 drivers/staging/brcm80211/brcmfmac/dhd_linux.c   |   40 ++++++++++++---------
 drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c |   16 ---------
 3 files changed, 24 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index a16f731..514f779 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -724,8 +724,7 @@ extern struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus,
 extern int brcmf_net_attach(struct brcmf_pub *drvr, int idx);
 extern int brcmf_netdev_wait_pend8021x(struct net_device *ndev);
 
-extern int brcmf_netdev_ioctl_priv(struct net_device *ndev,
-				   struct brcmf_ioctl *ioc);
+extern s32 brcmf_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len);
 
 /* Indication from bus module regarding removal/absence of dongle */
 extern void brcmf_detach(struct brcmf_pub *drvr);
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index 827022e..3ae0d43 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -849,30 +849,36 @@ static int brcmf_netdev_ioctl_entry(struct net_device *ndev, struct ifreq *ifr,
 	return -EOPNOTSUPP;
 }
 
-/* called only from within this driver */
-int brcmf_netdev_ioctl_priv(struct net_device *ndev, struct brcmf_ioctl *ioc)
+/* called only from within this driver. Sends an ioctl to the dongle. */
+s32 brcmf_dev_ioctl(struct net_device *ndev, u32 cmd, void *arg, u32 len)
 {
-	int bcmerror = 0;
+	struct brcmf_ioctl ioc;
+	s32 err = 0;
 	int buflen = 0;
 	bool is_set_key_cmd;
 	struct brcmf_info *drvr_priv = *(struct brcmf_info **)
-			  netdev_priv(ndev);
+					netdev_priv(ndev);
 	int ifidx;
 
+	memset(&ioc, 0, sizeof(ioc));
+	ioc.cmd = cmd;
+	ioc.buf = arg;
+	ioc.len = len;
+
 	ifidx = brcmf_net2idx(drvr_priv, ndev);
 
-	if (ioc->buf != NULL)
-		buflen = min_t(uint, ioc->len, BRCMF_IOCTL_MAXLEN);
+	if (ioc.buf != NULL)
+		buflen = min_t(uint, ioc.len, BRCMF_IOCTL_MAXLEN);
 
 	/* send to dongle (must be up, and wl) */
 	if ((drvr_priv->pub.busstate != BRCMF_BUS_DATA)) {
 		brcmf_dbg(ERROR, "DONGLE_DOWN\n");
-		bcmerror = -EIO;
+		err = -EIO;
 		goto done;
 	}
 
 	if (!drvr_priv->pub.iswl) {
-		bcmerror = -EIO;
+		err = -EIO;
 		goto done;
 	}
 
@@ -880,21 +886,21 @@ int brcmf_netdev_ioctl_priv(struct net_device *ndev, struct brcmf_ioctl *ioc)
 	 * Intercept BRCMF_C_SET_KEY IOCTL - serialize M4 send and
 	 * set key IOCTL to prevent M4 encryption.
 	 */
-	is_set_key_cmd = ((ioc->cmd == BRCMF_C_SET_KEY) ||
-			  ((ioc->cmd == BRCMF_C_SET_VAR) &&
-			   !(strncmp("wsec_key", ioc->buf, 9))) ||
-			  ((ioc->cmd == BRCMF_C_SET_VAR) &&
-			   !(strncmp("bsscfg:wsec_key", ioc->buf, 15))));
+	is_set_key_cmd = ((ioc.cmd == BRCMF_C_SET_KEY) ||
+			  ((ioc.cmd == BRCMF_C_SET_VAR) &&
+			   !(strncmp("wsec_key", ioc.buf, 9))) ||
+			  ((ioc.cmd == BRCMF_C_SET_VAR) &&
+			   !(strncmp("bsscfg:wsec_key", ioc.buf, 15))));
 	if (is_set_key_cmd)
 		brcmf_netdev_wait_pend8021x(ndev);
 
-	bcmerror = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, ioc, buflen);
+	err = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, buflen);
 
 done:
-	if (bcmerror > 0)
-		bcmerror = 0;
+	if (err > 0)
+		err = 0;
 
-	return bcmerror;
+	return err;
 }
 
 static int brcmf_netdev_stop(struct net_device *ndev)
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index b707bc0..b956c90 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -249,22 +249,6 @@ static const u32 __wl_cipher_suites[] = {
 	WLAN_CIPHER_SUITE_AES_CMAC,
 };
 
-static s32
-brcmf_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
-{
-	struct brcmf_ioctl ioc;
-	s32 err = 0;
-
-	memset(&ioc, 0, sizeof(ioc));
-	ioc.cmd = cmd;
-	ioc.buf = arg;
-	ioc.len = len;
-
-	err = brcmf_netdev_ioctl_priv(dev, &ioc);
-
-	return err;
-}
-
 /* function for reading/writing a single u32 from/to the dongle */
 static int
 brcmf_dev_ioctl_u32(struct net_device *ndev, u32 cmd, u32 *par)
-- 
1.7.1



      parent reply	other threads:[~2011-09-23  0:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-23  0:07 [PATCH v2 00/19] staging: brcm80211: 7th reaction for mainline patch #2 Franky Lin
2011-09-23  0:07 ` [PATCH v2 01/19] staging: brcm80211: sparse endianness warnings on dongle events Franky Lin
2011-09-23  0:07 ` [PATCH v2 02/19] staging: brcm80211: various fulmac sparse endianness fixes Franky Lin
2011-09-23  0:07 ` [PATCH v2 03/19] staging: brcm80211: sparse endianness warnings for struct brcmf_proto_cdc_ioctl Franky Lin
2011-09-23  0:07 ` [PATCH v2 04/19] staging: brcm80211: sparse endianness warnings for struct sdpcm_shared Franky Lin
2011-09-23  0:07 ` [PATCH v2 05/19] staging: brcm80211: more fullmac sparse endianness scan related changes Franky Lin
2011-09-23  0:07 ` [PATCH v2 06/19] staging: brcm80211: remove unconditional code blocks from brcmfmac Franky Lin
2011-09-23  0:07 ` [PATCH v2 07/19] staging: brcm80211: remove event handler thread from fullmac Franky Lin
2011-09-23  0:07 ` [PATCH v2 08/19] staging: brcm80211: remove fullmac module_param brcmf_dongle_memsize Franky Lin
2011-09-23  0:07 ` [PATCH v2 09/19] staging: brcm80211: remove fullmac module_param brcmf_sdiod_drive_strength Franky Lin
2011-09-23  0:07 ` [PATCH v2 10/19] staging: brcm80211: remove fullmac module_param for watchdog Franky Lin
2011-09-23  0:07 ` [PATCH v2 11/19] staging: brcm80211: remove fullmac module_param brcmf_idletime Franky Lin
2011-09-23  0:07 ` [PATCH v2 12/19] staging: brcm80211: remove global variables for data frame boundary Franky Lin
2011-09-23  0:07 ` [PATCH v2 13/19] staging: brcm80211: removed two fullmac sparse spinlock warnings Franky Lin
2011-09-23  0:07 ` [PATCH v2 14/19] staging: brcm80211: added endianness check flag to fullmac Makefile Franky Lin
2011-09-23  0:07 ` [PATCH v2 15/19] staging: brcm80211: removed likely/unlikely calls Franky Lin
2011-09-23  0:07 ` [PATCH v2 16/19] staging: brcm80211: removed log after kzalloc()/kmalloc() failure Franky Lin
2011-09-23  0:07 ` [PATCH v2 17/19] staging: brcm80211: clarified fullmac io and event codes Franky Lin
2011-09-23  0:07 ` [PATCH v2 18/19] staging: brcm80211: consistent naming of struct net_device *ndev Franky Lin
2011-09-23  0:07 ` Franky Lin [this message]

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=1316736476-23725-20-git-send-email-frankyl@broadcom.com \
    --to=frankyl@broadcom.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@suse.de \
    --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