Skip to contentSkip to conversation

staging: brcm80211: use native ctype library

PATCH New Andy Shevchenko 1 participant 2 messages Sep 15, 2010 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 staging: brcm80211: use native ctype library

---
 drivers/staging/brcm80211/include/bcmutils.h |   27 ------------
 drivers/staging/brcm80211/sys/wlc_mac80211.c |    4 +-
 drivers/staging/brcm80211/util/bcmutils.c    |   56 +++-----------------------
 drivers/staging/brcm80211/util/bcmwifi.c     |    3 +-
 4 files changed, 11 insertions(+), 79 deletions(-)
drivers/staging/brcm80211/include/bcmutils.h +0 -27
index 321071b..f17dbb1 100644
@@ -21,33 +21,6 @@
 extern "C" {
 #endif
 
-/* ctype replacement */
-#define _BCM_U	0x01		/* upper */
-#define _BCM_L	0x02		/* lower */
-#define _BCM_D	0x04		/* digit */
-#define _BCM_C	0x08		/* cntrl */
-#define _BCM_P	0x10		/* punct */
-#define _BCM_S	0x20		/* white space (space/lf/tab) */
-#define _BCM_X	0x40		/* hex digit */
-#define _BCM_SP	0x80		/* hard space (0x20) */
-
-	extern const unsigned char bcm_ctype[];
-#define bcm_ismask(x)	(bcm_ctype[(int)(unsigned char)(x)])
-
-#define bcm_isalnum(c)	((bcm_ismask(c)&(_BCM_U|_BCM_L|_BCM_D)) != 0)
-#define bcm_isalpha(c)	((bcm_ismask(c)&(_BCM_U|_BCM_L)) != 0)
-#define bcm_iscntrl(c)	((bcm_ismask(c)&(_BCM_C)) != 0)
-#define bcm_isdigit(c)	((bcm_ismask(c)&(_BCM_D)) != 0)
-#define bcm_isgraph(c)	((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D)) != 0)
-#define bcm_islower(c)	((bcm_ismask(c)&(_BCM_L)) != 0)
-#define bcm_isprint(c)	((bcm_ismask(c)&(_BCM_P|_BCM_U|_BCM_L|_BCM_D|_BCM_SP)) != 0)
-#define bcm_ispunct(c)	((bcm_ismask(c)&(_BCM_P)) != 0)
-#define bcm_isspace(c)	((bcm_ismask(c)&(_BCM_S)) != 0)
-#define bcm_isupper(c)	((bcm_ismask(c)&(_BCM_U)) != 0)
-#define bcm_isxdigit(c)	((bcm_ismask(c)&(_BCM_D|_BCM_X)) != 0)
-#define bcm_tolower(c)	(bcm_isupper((c)) ? ((c) + 'a' - 'A') : (c))
-#define bcm_toupper(c)	(bcm_islower((c)) ? ((c) + 'A' - 'a') : (c))
-
 /* Buffer structure for collecting string-formatted data
 * using bcm_bprintf() API.
 * Use bcm_binit() to initialize before use
drivers/staging/brcm80211/sys/wlc_mac80211.c +3 -1
index 27ddc23..db9a7c2 100644
@@ -75,6 +75,8 @@
 #define W_REG(osh, r, v) RPC_WRITE_REG(osh, r, v)
 #endif
 
+#include <linux/ctype.h>
+
 /*
  * buffer length needed for wlc_format_ssid
  * 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL.
@@ -5486,7 +5488,7 @@ int wlc_format_ssid(char *buf, const uchar ssid[], uint ssid_len)
 		if (c == '\\') {
 			*p++ = '\\';
 			*p++ = '\\';
-		} else if (bcm_isprint((uchar) c)) {
+		} else if (isprint((uchar) c)) {
 			*p++ = (char)c;
 		} else {
 			p += snprintf(p, (endp - p), "\\x%02X", c);
drivers/staging/brcm80211/util/bcmutils.c +6 -50

87 lines not on this page · raw message

drivers/staging/brcm80211/util/bcmwifi.c +2 -1
index 5eced8e..cb41d10 100644
@@ -19,9 +19,10 @@
 #include <osl.h>
 #include <bcmutils.h>
 #define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base))
-#define tolower(c) (bcm_isupper((c)) ? ((c) + 'a' - 'A') : (c))
 #include <bcmwifi.h>
 
+#include <linux/ctype.h>
+
 /* Chanspec ASCII representation:
  * <channel><band><bandwidth><ctl-sideband>
  *   digit   [AB]     [N]        [UL]
Signature · 1 line
1.7.2.2
#1 lore raw

PATCH 2/2 staging: brcm80211: use string native library

---
 drivers/staging/brcm80211/include/bcmutils.h |   13 --
 drivers/staging/brcm80211/phy/wlc_phy_cmn.c  |    3 +-
 drivers/staging/brcm80211/sys/wl_mac80211.c  |    4 +-
 drivers/staging/brcm80211/sys/wlc_bmac.c     |    5 +-
 drivers/staging/brcm80211/sys/wlc_mac80211.c |    3 +-
 drivers/staging/brcm80211/util/bcmsrom.c     |    3 +-
 drivers/staging/brcm80211/util/bcmutils.c    |  268 +-------------------------
 drivers/staging/brcm80211/util/bcmwifi.c     |    7 +-
 drivers/staging/brcm80211/util/hndpmu.c      |    9 +-
 9 files changed, 23 insertions(+), 292 deletions(-)
drivers/staging/brcm80211/include/bcmutils.h +0 -13
index f17dbb1..4aa3800 100644
@@ -165,19 +165,6 @@ extern "C" {
 #define	PKTPRIO_UPD	0x400	/* DSCP used to update VLAN prio */
 #define	PKTPRIO_DSCP	0x800	/* DSCP prio found */
 
-/* string */
-	extern int BCMROMFN(bcm_atoi) (char *s);
-	extern ulong BCMROMFN(bcm_strtoul) (char *cp, char **endp, uint base);
-	extern char *BCMROMFN(bcmstrstr) (char *haystack, char *needle);
-	extern char *BCMROMFN(bcmstrcat) (char *dest, const char *src);
-	extern char *BCMROMFN(bcmstrncat) (char *dest, const char *src,
-					   uint size);
-	extern ulong wchar2ascii(char *abuf, ushort *wbuf, ushort wbuflen,
-				 ulong abuflen);
-	char *bcmstrtok(char **string, const char *delimiters, char *tokdelim);
-	int bcmstricmp(const char *s1, const char *s2);
-	int bcmstrnicmp(const char *s1, const char *s2, int cnt);
-
 /* ethernet address */
 	extern char *bcm_ether_ntoa(const struct ether_addr *ea, char *buf);
 	extern int BCMROMFN(bcm_ether_atoe) (char *p, struct ether_addr *ea);
drivers/staging/brcm80211/phy/wlc_phy_cmn.c +2 -1
index f2e504e..18b9849 100644
@@ -17,6 +17,7 @@
 #include <wlc_cfg.h>
 
 #include <osl.h>
+#include <linux/kernel.h>
 #include <bcmendian.h>
 #include <bcmnvram.h>
 #include <sbchipc.h>
@@ -177,7 +178,7 @@ int phy_getintvar(phy_info_t *pi, const char *name)
 	if (val == NULL)
 		return 0;
 
-	return bcm_strtoul(val, NULL, 0);
+	return simple_strtoul(val, NULL, 0);
 }
 
 void wlc_phyreg_enter(wlc_phy_t *pih)
drivers/staging/brcm80211/sys/wl_mac80211.c +2 -2
index 71bd463..5400360 100644
@@ -1639,7 +1639,7 @@ static int __init wl_module_init(void)
 	else {
 		char *var = getvar(NULL, "wl_msglevel");
 		if (var)
-			wl_msg_level = bcm_strtoul(var, NULL, 0);
+			wl_msg_level = simple_strtoul(var, NULL, 0);
 	}
 #ifndef WLC_HIGH_ONLY
 	{
@@ -1650,7 +1650,7 @@ static int __init wl_module_init(void)
 		else {
 			char *var = getvar(NULL, "phy_msglevel");
 			if (var)
-				phyhal_msg_level = bcm_strtoul(var, NULL, 0);
+				phyhal_msg_level = simple_strtoul(var, NULL, 0);
 		}
 	}
 #endif				/* WLC_HIGH_ONLY */
drivers/staging/brcm80211/sys/wlc_bmac.c +3 -2
index c22394d..eea1ffb 100644
@@ -22,6 +22,7 @@
 #include <typedefs.h>
 #include <bcmdefs.h>
 #include <osl.h>
+#include <linux/kernel.h>
 #include <proto/802.11.h>
 #include <bcmwifi.h>
 #include <bcmutils.h>
@@ -760,12 +761,12 @@ BCMATTACHFN(wlc_bmac_attach) (wlc_info_t *wlc, uint16 vendor, uint16 device,
 
 		var = getvar(vars, "vendid");
 		if (var) {
-			vendor = (uint16) bcm_strtoul(var, NULL, 0);
+			vendor = (uint16) simple_strtoul(var, NULL, 0);
 			WL_ERROR(("Overriding vendor id = 0x%x\n", vendor));
 		}
 		var = getvar(vars, "devid");
 		if (var) {
-			uint16 devid = (uint16) bcm_strtoul(var, NULL, 0);
+			uint16 devid = (uint16) simple_strtoul(var, NULL, 0);
 			if (devid != 0xffff) {
 				device = devid;
 				WL_ERROR(("Overriding device id = 0x%x\n",
drivers/staging/brcm80211/sys/wlc_mac80211.c +1 -2
index db9a7c2..1488a56 100644
@@ -18,6 +18,7 @@
 #include <typedefs.h>
 #include <bcmdefs.h>
 #include <osl.h>
+#include <linux/ctype.h>
 #include <bcmutils.h>
 #include <bcmwifi.h>
 #include <siutils.h>
@@ -75,8 +76,6 @@
 #define W_REG(osh, r, v) RPC_WRITE_REG(osh, r, v)
 #endif
 
-#include <linux/ctype.h>
-
 /*
  * buffer length needed for wlc_format_ssid
  * 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL.
drivers/staging/brcm80211/util/bcmsrom.c +2 -1
index a295ecb..2637a53 100644
@@ -17,6 +17,7 @@
 #include <typedefs.h>
 #include <bcmdefs.h>
 #include <osl.h>
+#include <linux/kernel.h>
 #include <stdarg.h>
 #include <bcmutils.h>
 #include <hndsoc.h>
@@ -1924,7 +1925,7 @@ BCMATTACHFN(initvars_srom_pci) (si_t *sih, void *curmap, char **vars,
 
 		value = si_getdevpathvar(sih, "sromrev");
 		if (value) {
-			sromrev = (uint8) bcm_strtoul(value, NULL, 0);
+			sromrev = (uint8) simple_strtoul(value, NULL, 0);
 			flash = TRUE;
 			goto varscont;
 		}
drivers/staging/brcm80211/util/bcmutils.c +5 -263

304 lines not on this page · raw message

drivers/staging/brcm80211/util/bcmwifi.c +3 -4
index cb41d10..b69c12b 100644
@@ -17,12 +17,11 @@
 #include <typedefs.h>
 
 #include <osl.h>
+#include <linux/ctype.h>
+#include <linux/kernel.h>
 #include <bcmutils.h>
-#define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base))
 #include <bcmwifi.h>
 
-#include <linux/ctype.h>
-
 /* Chanspec ASCII representation:
  * <channel><band><bandwidth><ctl-sideband>
  *   digit   [AB]     [N]        [UL]
@@ -92,7 +91,7 @@ chanspec_t wf_chspec_aton(char *a)
 	uint channel, band, bw, ctl_sb;
 	char c;
 
-	channel = strtoul(a, &endp, 10);
+	channel = simple_strtoul(a, &endp, 10);
 
 	/* check for no digits parsed */
 	if (endp == a)
drivers/staging/brcm80211/util/hndpmu.c +5 -4
index daa0198..1db1b16 100644
@@ -17,6 +17,7 @@
 #include <typedefs.h>
 #include <bcmdefs.h>
 #include <osl.h>
+#include <linux/kernel.h>
 #include <bcmutils.h>
 #include <siutils.h>
 #include <bcmdevs.h>
@@ -663,13 +664,13 @@ static void si_pmu_res_masks(si_t *sih, uint32 * pmin, uint32 * pmax)
 	val = getvar(NULL, "rmin");
 	if (val != NULL) {
 		PMU_MSG(("Applying rmin=%s to min_mask\n", val));
-		min_mask = (uint32) bcm_strtoul(val, NULL, 0);
+		min_mask = (uint32) simple_strtoul(val, NULL, 0);
 	}
 	/* Apply nvram override to max mask */
 	val = getvar(NULL, "rmax");
 	if (val != NULL) {
 		PMU_MSG(("Applying rmax=%s to max_mask\n", val));
-		max_mask = (uint32) bcm_strtoul(val, NULL, 0);
+		max_mask = (uint32) simple_strtoul(val, NULL, 0);
 	}
 
 	*pmin = min_mask;
@@ -787,7 +788,7 @@ void BCMATTACHFN(si_pmu_res_init) (si_t *sih, osl_t *osh)
 			 val, i));
 		W_REG(osh, &cc->res_table_sel, (uint32) i);
 		W_REG(osh, &cc->res_updn_timer,
-		      (uint32) bcm_strtoul(val, NULL, 0));
+		      (uint32) simple_strtoul(val, NULL, 0));
 	}
 
 	/* Program resource dependencies table */
@@ -838,7 +839,7 @@ void BCMATTACHFN(si_pmu_res_init) (si_t *sih, osl_t *osh)
 			 i));
 		W_REG(osh, &cc->res_table_sel, (uint32) i);
 		W_REG(osh, &cc->res_dep_mask,
-		      (uint32) bcm_strtoul(val, NULL, 0));
+		      (uint32) simple_strtoul(val, NULL, 0));
 	}
 
 	/* Determine min/max rsrc masks */
Signature · 1 line
1.7.2.2