From: "Arend van Spriel" <arend@broadcom.com>
To: gregkh@suse.de
Cc: devel@linuxdriverproject.org, linux-wireless@vger.kernel.org,
"Arend van Spriel" <arend@broadcom.com>
Subject: [PATCH 01/15] staging: brcm80211: move driver variable functions to srom.c
Date: Wed, 5 Oct 2011 15:20:00 +0200 [thread overview]
Message-ID: <1317820814-7083-2-git-send-email-arend@broadcom.com> (raw)
In-Reply-To: <1317820814-7083-1-git-send-email-arend@broadcom.com>
The driver uses variables which are stored in string format. Using
strings as variable identifiers is disliked by the community. The
driver has been cleaned up and the only module providing these
variables is srom.c. The variable retrieval functions have been
moved to srom.c in preparation of a more likable way to store and
lookup these driver variables.
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
drivers/staging/brcm80211/brcmsmac/main.c | 44 -----------------------------
drivers/staging/brcm80211/brcmsmac/srom.c | 44 +++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmsmac/main.c b/drivers/staging/brcm80211/brcmsmac/main.c
index 9fa8485..100e6ec 100644
--- a/drivers/staging/brcm80211/brcmsmac/main.c
+++ b/drivers/staging/brcm80211/brcmsmac/main.c
@@ -8881,47 +8881,3 @@ void brcms_c_set_radio_mpc(struct brcms_c_info *wlc, bool mpc)
wlc->mpc = mpc;
brcms_c_radio_mpc_upd(wlc);
}
-
-/*
- * Search the name=value vars for a specific one and return its value.
- * Returns NULL if not found.
- */
-char *getvar(char *vars, const char *name)
-{
- char *s;
- int len;
-
- if (!name)
- return NULL;
-
- len = strlen(name);
- if (len == 0)
- return NULL;
-
- /* first look in vars[] */
- for (s = vars; s && *s;) {
- if ((memcmp(s, name, len) == 0) && (s[len] == '='))
- return &s[len + 1];
-
- while (*s++)
- ;
- }
- /* nothing found */
- return NULL;
-}
-
-/*
- * Search the vars for a specific one and return its value as
- * an integer. Returns 0 if not found.
- */
-int getintvar(char *vars, const char *name)
-{
- char *val;
- unsigned long res;
-
- val = getvar(vars, name);
- if (val && !kstrtoul(val, 0, &res))
- return res;
-
- return 0;
-}
diff --git a/drivers/staging/brcm80211/brcmsmac/srom.c b/drivers/staging/brcm80211/brcmsmac/srom.c
index 13d17eb..02dbd98 100644
--- a/drivers/staging/brcm80211/brcmsmac/srom.c
+++ b/drivers/staging/brcm80211/brcmsmac/srom.c
@@ -1242,3 +1242,47 @@ int srom_var_init(struct si_pub *sih, void __iomem *curmap, char **vars,
return -EINVAL;
}
+
+/*
+ * Search the name=value vars for a specific one and return its value.
+ * Returns NULL if not found.
+ */
+char *getvar(char *vars, const char *name)
+{
+ char *s;
+ int len;
+
+ if (!name)
+ return NULL;
+
+ len = strlen(name);
+ if (len == 0)
+ return NULL;
+
+ /* first look in vars[] */
+ for (s = vars; s && *s;) {
+ if ((memcmp(s, name, len) == 0) && (s[len] == '='))
+ return &s[len + 1];
+
+ while (*s++)
+ ;
+ }
+ /* nothing found */
+ return NULL;
+}
+
+/*
+ * Search the vars for a specific one and return its value as
+ * an integer. Returns 0 if not found.
+ */
+int getintvar(char *vars, const char *name)
+{
+ char *val;
+ unsigned long res;
+
+ val = getvar(vars, name);
+ if (val && !kstrtoul(val, 0, &res))
+ return res;
+
+ return 0;
+}
--
1.7.4.1
next prev parent reply other threads:[~2011-10-06 14:10 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-05 13:19 [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Arend van Spriel
2011-10-05 13:20 ` Arend van Spriel [this message]
2011-10-06 14:15 ` [PATCH 01/15] staging: brcm80211: move driver variable functions to srom.c Arend Van Spriel
2011-10-05 13:20 ` [PATCH 02/15] staging: brcm80211: remove threads_only code from fullmac Arend van Spriel
2011-10-05 13:20 ` [PATCH 03/15] staging: brcm80211: remove redundant bus register layer " Arend van Spriel
2011-10-05 13:20 ` [PATCH 04/15] staging: brcm80211: remove code duplication for driver variable lookup Arend van Spriel
2011-10-05 13:20 ` [PATCH 05/15] staging: brcm80211: change parameter in " Arend van Spriel
2011-10-05 13:20 ` [PATCH 06/15] staging: brcm80211: remove locking macro definitions Arend van Spriel
2011-10-05 13:20 ` [PATCH 07/15] staging: brcm80211: fix thread blocking issue in brcmf_sdbrcm_bus_stop() Arend van Spriel
2011-10-05 13:20 ` [PATCH 08/15] staging: brcm80211: remove invalid variable lookup from srom Arend van Spriel
2011-10-05 13:20 ` [PATCH 09/15] staging: brcm80211: use identifiers instead of string for srom lookup Arend van Spriel
2011-10-05 13:20 ` [PATCH 10/15] staging: brcm80211: use enum identifiers in srom variable tables Arend van Spriel
2011-10-05 13:20 ` [PATCH 11/15] staging: brcm80211: replace string based variable storage by linked list Arend van Spriel
2011-10-05 13:20 ` [PATCH 12/15] staging: brcm80211: remove parameter 'off' from _initvars_srom_pci() Arend van Spriel
2011-10-05 13:20 ` [PATCH 13/15] staging: brcm80211: cleanup driver variable references Arend van Spriel
2011-10-05 13:20 ` [PATCH 14/15] staging: brcm80211: clean up struct brcmf_if in fullmac Arend van Spriel
2011-10-05 13:20 ` [PATCH 15/15] staging: brcm80211: remove brcmf_op_if from fullmac Arend van Spriel
2011-10-05 14:40 ` [PATCH 00/15] staging: brcm80211: cleanup fullmac structs and softmac srom lookup Hauke Mehrtens
2011-10-05 16:56 ` Arend van Spriel
2011-10-05 20:47 ` Greg KH
2011-10-06 9:56 ` Arend van Spriel
-- strict thread matches above, loose matches on Subject: below --
2011-10-05 13:30 [PATCH 01/15] staging: brcm80211: move driver variable functions to srom.c Arend van Spriel
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=1317820814-7083-2-git-send-email-arend@broadcom.com \
--to=arend@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;
as well as URLs for NNTP newsgroup(s).