Skip to content

Commit

Permalink
staging: brcm80211: move functions only used by brcmsmac out of utils
Browse files Browse the repository at this point in the history
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 <brudley@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Henry Ptasinski authored and Greg Kroah-Hartman committed May 10, 2011
1 parent 192f25a commit 9019377
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 50 deletions.
1 change: 1 addition & 0 deletions drivers/staging/brcm80211/brcmsmac/nicpci.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/pci.h>
#include <bcmdefs.h>
#include <bcmutils.h>
#include <bcmnvram.h>
#include <aiutils.h>
#include <hndsoc.h>
#include <bcmdevs.h>
Expand Down
43 changes: 43 additions & 0 deletions drivers/staging/brcm80211/brcmsmac/nvram.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/pci.h>
#include <aiutils.h>
#include <wlc_pmu.h>
#include <bcmnvram.h>

#include <bcmdevs.h>
#include <sbhnddma.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <bcmdefs.h>
#include <bcmwifi.h>
#include <bcmutils.h>
#include <bcmnvram.h>
#include <pcicfg.h>
#include <wlioctl.h>
#include <sbhnddma.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/brcm80211/brcmsmac/wlc_antsel.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <bcmdefs.h>
#include <bcmutils.h>
#include <bcmnvram.h>
#include <aiutils.h>
#include <bcmdevs.h>
#include <sbhnddma.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/brcm80211/brcmsmac/wlc_bmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <bcmsrom.h>
#include <bcmotp.h>
#include <bcmutils.h>
#include <bcmnvram.h>
#include <wlioctl.h>
#include <sbconfig.h>
#include <sbchipc.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/brcm80211/brcmsmac/wlc_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <bcmdefs.h>
#include <bcmutils.h>
#include <bcmnvram.h>
#include <aiutils.h>
#include <sbhnddma.h>
#include <wlioctl.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/brcm80211/brcmsmac/wlc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <bcmdevs.h>
#include <bcmutils.h>
#include <bcmwifi.h>
#include <bcmnvram.h>
#include <aiutils.h>
#include <pcicfg.h>
#include <bcmsrom.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/brcm80211/brcmsmac/wlc_pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <bcmdevs.h>
#include <sbchipc.h>
#include <bcmutils.h>
#include <bcmnvram.h>
#include "wlc_pmu.h"

/*
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/brcm80211/brcmsmac/wlc_stf.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <aiutils.h>
#include <wlioctl.h>
#include <bcmwifi.h>
#include <bcmnvram.h>
#include <sbhnddma.h>

#include "wlc_types.h"
Expand Down
4 changes: 4 additions & 0 deletions drivers/staging/brcm80211/include/bcmnvram.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 0 additions & 3 deletions drivers/staging/brcm80211/include/bcmutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
47 changes: 0 additions & 47 deletions drivers/staging/brcm80211/util/bcmutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9019377

Please sign in to comment.