From 901937707229abf86d2b976d30bb2285056fce8a Mon Sep 17 00:00:00 2001 From: Henry Ptasinski Date: Mon, 9 May 2011 16:33:09 +0200 Subject: [PATCH] staging: brcm80211: move functions only used by brcmsmac out of utils The functions gitvar() and getintvar() are only used by brcmsmac, so move them out of the bcmutils.c file, which is shared by both brcmsmac and brcmfmac. Cc: devel@linuxdriverproject.org Cc: linux-wireless@vger.kernel.org Reviewed-by: Brett Rudley Signed-off-by: Arend van Spriel Signed-off-by: Greg Kroah-Hartman --- drivers/staging/brcm80211/brcmsmac/nicpci.c | 1 + drivers/staging/brcm80211/brcmsmac/nvram.c | 43 +++++++++++++++++ .../brcm80211/brcmsmac/phy/wlc_phy_lcn.c | 1 + .../staging/brcm80211/brcmsmac/wl_mac80211.c | 1 + .../staging/brcm80211/brcmsmac/wlc_antsel.c | 1 + drivers/staging/brcm80211/brcmsmac/wlc_bmac.c | 1 + .../staging/brcm80211/brcmsmac/wlc_channel.c | 1 + drivers/staging/brcm80211/brcmsmac/wlc_main.c | 1 + drivers/staging/brcm80211/brcmsmac/wlc_pmu.c | 1 + drivers/staging/brcm80211/brcmsmac/wlc_stf.c | 1 + drivers/staging/brcm80211/include/bcmnvram.h | 4 ++ drivers/staging/brcm80211/include/bcmutils.h | 3 -- drivers/staging/brcm80211/util/bcmutils.c | 47 ------------------- 13 files changed, 56 insertions(+), 50 deletions(-) diff --git a/drivers/staging/brcm80211/brcmsmac/nicpci.c b/drivers/staging/brcm80211/brcmsmac/nicpci.c index 5a127d253d02..18b844a8d2fb 100644 --- a/drivers/staging/brcm80211/brcmsmac/nicpci.c +++ b/drivers/staging/brcm80211/brcmsmac/nicpci.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/staging/brcm80211/brcmsmac/nvram.c b/drivers/staging/brcm80211/brcmsmac/nvram.c index 0e93a55d728e..830e30f39966 100644 --- a/drivers/staging/brcm80211/brcmsmac/nvram.c +++ b/drivers/staging/brcm80211/brcmsmac/nvram.c @@ -108,6 +108,49 @@ static char *findvar(char *vars, char *lim, const char *name) return NULL; } +/* + * 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++) + ; + } + /* then query nvram */ + return nvram_get(name); +} + +/* + * 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; + + val = getvar(vars, name); + if (val == NULL) + return 0; + + return simple_strtoul(val, NULL, 0); +} + char *nvram_get(const char *name) { char *v = NULL; diff --git a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c index 8fc1bef5c0a2..a28633c97699 100644 --- a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c +++ b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include diff --git a/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c b/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c index 9f2e5a294c7e..2dd7c7b5ae5e 100644 --- a/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c +++ b/drivers/staging/brcm80211/brcmsmac/wl_mac80211.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_antsel.c b/drivers/staging/brcm80211/brcmsmac/wlc_antsel.c index a8037e999cdd..3d9485ac2a95 100644 --- a/drivers/staging/brcm80211/brcmsmac/wlc_antsel.c +++ b/drivers/staging/brcm80211/brcmsmac/wlc_antsel.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c b/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c index 91d366dd18c0..cf0d2bf7b902 100644 --- a/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c +++ b/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_channel.c b/drivers/staging/brcm80211/brcmsmac/wlc_channel.c index bde82bd277da..fe3e3927cbfb 100644 --- a/drivers/staging/brcm80211/brcmsmac/wlc_channel.c +++ b/drivers/staging/brcm80211/brcmsmac/wlc_channel.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_main.c b/drivers/staging/brcm80211/brcmsmac/wlc_main.c index 4d8fa34c60e1..3eaabe9c1f00 100644 --- a/drivers/staging/brcm80211/brcmsmac/wlc_main.c +++ b/drivers/staging/brcm80211/brcmsmac/wlc_main.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_pmu.c b/drivers/staging/brcm80211/brcmsmac/wlc_pmu.c index 5b1697a2d899..82986bd1ccfa 100644 --- a/drivers/staging/brcm80211/brcmsmac/wlc_pmu.c +++ b/drivers/staging/brcm80211/brcmsmac/wlc_pmu.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "wlc_pmu.h" /* diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_stf.c b/drivers/staging/brcm80211/brcmsmac/wlc_stf.c index aa8d42deb269..c4f58172182d 100644 --- a/drivers/staging/brcm80211/brcmsmac/wlc_stf.c +++ b/drivers/staging/brcm80211/brcmsmac/wlc_stf.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "wlc_types.h" diff --git a/drivers/staging/brcm80211/include/bcmnvram.h b/drivers/staging/brcm80211/include/bcmnvram.h index e194131a750e..e58151c0ec44 100644 --- a/drivers/staging/brcm80211/include/bcmnvram.h +++ b/drivers/staging/brcm80211/include/bcmnvram.h @@ -147,6 +147,10 @@ u8 nvram_calc_crc(struct nvram_header *nvh); #endif /* _LANGUAGE_ASSEMBLY */ +/* variable access */ +extern char *getvar(char *vars, const char *name); +extern int getintvar(char *vars, const char *name); + /* The NVRAM version number stored as an NVRAM variable */ #define NVRAM_SOFTWARE_VERSION "1" diff --git a/drivers/staging/brcm80211/include/bcmutils.h b/drivers/staging/brcm80211/include/bcmutils.h index d83a50451878..905e3cef7a4c 100644 --- a/drivers/staging/brcm80211/include/bcmutils.h +++ b/drivers/staging/brcm80211/include/bcmutils.h @@ -141,9 +141,6 @@ extern struct sk_buff *pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out); struct ipv4_addr; extern char *bcm_ip_ntoa(struct ipv4_addr *ia, char *buf); -/* variable access */ - extern char *getvar(char *vars, const char *name); - extern int getintvar(char *vars, const char *name); #ifdef BCMDBG extern void prpkt(const char *msg, struct sk_buff *p0); #else diff --git a/drivers/staging/brcm80211/util/bcmutils.c b/drivers/staging/brcm80211/util/bcmutils.c index 95214cf27710..0c21e43e3add 100644 --- a/drivers/staging/brcm80211/util/bcmutils.c +++ b/drivers/staging/brcm80211/util/bcmutils.c @@ -353,53 +353,6 @@ int bcm_ether_atoe(char *p, u8 *ea) return i == 6; } -/* - * 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++) - ; - } -#ifdef BRCM_FULLMAC - return NULL; -#else - /* then query nvram */ - return nvram_get(name); -#endif -} - -/* - * 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; - - val = getvar(vars, name); - if (val == NULL) - return 0; - - return simple_strtoul(val, NULL, 0); -} - #if defined(BCMDBG) /* pretty hex print a pkt buffer chain */ void prpkt(const char *msg, struct sk_buff *p0) -- 2.30.2