* [PATCH 1/3] staging: brcm80211: clean up custom ctype library again
@ 2010-10-10 10:20 Andy Shevchenko
2010-10-10 10:20 ` [PATCH 2/3] staging: brcm80211: remove custom string " Andy Shevchenko
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Andy Shevchenko @ 2010-10-10 10:20 UTC (permalink / raw)
To: linux-wireless, devel, linux-kernel
Cc: Nohee Ko, Greg Kroah-Hartman, Andy Shevchenko
The similar cleanup was done before for softmac implementation. But the
fullmac driver brings this back. Remove it again.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/staging/brcm80211/brcmfmac/bcmutils.c | 56 ++----------------------
drivers/staging/brcm80211/brcmfmac/wl_iw.h | 1 -
drivers/staging/brcm80211/include/bcmutils.h | 30 -------------
3 files changed, 5 insertions(+), 82 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmutils.c b/drivers/staging/brcm80211/brcmfmac/bcmutils.c
index 7185943..f0685c1 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmutils.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmutils.c
@@ -28,8 +28,8 @@
#if defined(BCMEXTSUP)
#include <bcm_osl.h>
#endif
-
#endif /* BCMDRIVER */
+#include <linux/ctype.h>
#include <bcmendian.h>
#include <bcmdevs.h>
#include <bcmnvram.h>
@@ -484,52 +484,6 @@ void *pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out)
}
#endif /* BCMDRIVER */
-const unsigned char bcm_ctype[] = {
- _BCM_C, _BCM_C, _BCM_C, _BCM_C, _BCM_C, _BCM_C, _BCM_C, _BCM_C,
- _BCM_C, _BCM_C | _BCM_S, _BCM_C | _BCM_S, _BCM_C | _BCM_S,
- _BCM_C | _BCM_S, _BCM_C | _BCM_S, _BCM_C,
- _BCM_C, /* 8-15 */
- _BCM_C, _BCM_C, _BCM_C, _BCM_C, _BCM_C, _BCM_C, _BCM_C, _BCM_C,
- _BCM_C, _BCM_C, _BCM_C, _BCM_C, _BCM_C, _BCM_C, _BCM_C, _BCM_C,
- _BCM_S | _BCM_SP, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P,
- _BCM_P,
- _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P,
- _BCM_D, _BCM_D, _BCM_D, _BCM_D, _BCM_D, _BCM_D, _BCM_D, _BCM_D,
- _BCM_D, _BCM_D, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P,
- _BCM_P, _BCM_U | _BCM_X, _BCM_U | _BCM_X, _BCM_U | _BCM_X,
- _BCM_U | _BCM_X, _BCM_U | _BCM_X,
- _BCM_U | _BCM_X, _BCM_U,
- _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U,
- _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U,
- _BCM_U, _BCM_U, _BCM_U, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P,
- _BCM_P, _BCM_L | _BCM_X, _BCM_L | _BCM_X, _BCM_L | _BCM_X,
- _BCM_L | _BCM_X, _BCM_L | _BCM_X,
- _BCM_L | _BCM_X, _BCM_L,
- _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L,
- _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L,
- _BCM_L, _BCM_L, _BCM_L, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_C,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 128-143 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 144-159 */
- _BCM_S | _BCM_SP, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P,
- _BCM_P, _BCM_P, _BCM_P,
- _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, /* 160-175 */
- _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P,
- _BCM_P, _BCM_P,
- _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, /* 176-191 */
- _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U,
- _BCM_U, _BCM_U,
- _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, /* 192-207 */
- _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_P, _BCM_U,
- _BCM_U, _BCM_U,
- _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_L, /* 208-223 */
- _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L,
- _BCM_L, _BCM_L,
- _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, /* 224-239 */
- _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_P, _BCM_L,
- _BCM_L, _BCM_L,
- _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L /* 240-255 */
-};
-
unsigned long bcm_strtoul(char *cp, char **endp, uint base)
{
unsigned long result, last_result = 0, value;
@@ -537,7 +491,7 @@ unsigned long bcm_strtoul(char *cp, char **endp, uint base)
minus = FALSE;
- while (bcm_isspace(*cp))
+ while (isspace(*cp))
cp++;
if (cp[0] == '+')
@@ -565,9 +519,9 @@ unsigned long bcm_strtoul(char *cp, char **endp, uint base)
result = 0;
- while (bcm_isxdigit(*cp) &&
+ while (isxdigit(*cp) &&
(value =
- bcm_isdigit(*cp) ? *cp - '0' : bcm_toupper(*cp) - 'A' + 10) <
+ isdigit(*cp) ? *cp - '0' : toupper(*cp) - 'A' + 10) <
base) {
result = result * base + value;
/* Detected overflow */
@@ -1796,7 +1750,7 @@ int bcm_format_ssid(char *buf, const unsigned char ssid[], uint ssid_len)
if (c == '\\') {
*p++ = '\\';
*p++ = '\\';
- } else if (bcm_isprint((unsigned char) c)) {
+ } else if (isprint((unsigned char) c)) {
*p++ = (char)c;
} else {
p += snprintf(p, (endp - p), "\\x%02X", c);
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_iw.h b/drivers/staging/brcm80211/brcmfmac/wl_iw.h
index cca4fd7..3416597 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_iw.h
+++ b/drivers/staging/brcm80211/brcmfmac/wl_iw.h
@@ -58,7 +58,6 @@ typedef struct wl_iw_extra_params {
#define WL_IW_RSSI_EXCELLENT -57
#define WL_IW_RSSI_INVALID 0
#define MAX_WX_STRING 80
-#define isprint(c) bcm_isprint(c)
#define WL_IW_SET_ACTIVE_SCAN (SIOCIWFIRSTPRIV+1)
#define WL_IW_GET_RSSI (SIOCIWFIRSTPRIV+3)
#define WL_IW_SET_PASSIVE_SCAN (SIOCIWFIRSTPRIV+5)
diff --git a/drivers/staging/brcm80211/include/bcmutils.h b/drivers/staging/brcm80211/include/bcmutils.h
index 7dd9210..d0960b7 100644
--- a/drivers/staging/brcm80211/include/bcmutils.h
+++ b/drivers/staging/brcm80211/include/bcmutils.h
@@ -21,36 +21,6 @@
extern "C" {
#endif
-#ifdef BRCM_FULLMAC
-/* 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))
-#endif /* BRCM_FULLMAC */
-
/* Buffer structure for collecting string-formatted data
* using bcm_bprintf() API.
* Use bcm_binit() to initialize before use
--
1.7.2.3
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/3] staging: brcm80211: remove custom string library again
2010-10-10 10:20 [PATCH 1/3] staging: brcm80211: clean up custom ctype library again Andy Shevchenko
@ 2010-10-10 10:20 ` Andy Shevchenko
2010-10-10 10:20 ` [PATCH 3/3] staging: brcm80211: fix to use "%pM" flag to print MAC address Andy Shevchenko
2010-10-10 12:41 ` [PATCH 1/3] staging: brcm80211: clean up custom ctype library again Greg KH
2 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2010-10-10 10:20 UTC (permalink / raw)
To: linux-wireless, devel, linux-kernel
Cc: Nohee Ko, Greg Kroah-Hartman, Andy Shevchenko
There was a clean up commit for softmac driver. Do the same for fullmac
implementation.
Here:
- strtoul and bcm_strtoul are changed to simple_strtoul
- bcmstrcat -> strcat
- bcmstrtok -> strsep
All unused functions are deleted.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/staging/brcm80211/brcmfmac/bcmutils.c | 289 +---------------------
drivers/staging/brcm80211/brcmfmac/dhd_common.c | 24 +-
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 7 +-
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 4 +-
drivers/staging/brcm80211/include/bcmutils.h | 14 -
5 files changed, 20 insertions(+), 318 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmutils.c b/drivers/staging/brcm80211/brcmfmac/bcmutils.c
index f0685c1..f5c552d 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmutils.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmutils.c
@@ -30,6 +30,7 @@
#endif
#endif /* BCMDRIVER */
#include <linux/ctype.h>
+#include <linux/kernel.h>
#include <bcmendian.h>
#include <bcmdevs.h>
#include <bcmnvram.h>
@@ -484,271 +485,13 @@ void *pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out)
}
#endif /* BCMDRIVER */
-unsigned long bcm_strtoul(char *cp, char **endp, uint base)
-{
- unsigned long result, last_result = 0, value;
- bool minus;
-
- minus = FALSE;
-
- while (isspace(*cp))
- cp++;
-
- if (cp[0] == '+')
- cp++;
- else if (cp[0] == '-') {
- minus = TRUE;
- cp++;
- }
-
- if (base == 0) {
- if (cp[0] == '0') {
- if ((cp[1] == 'x') || (cp[1] == 'X')) {
- base = 16;
- cp = &cp[2];
- } else {
- base = 8;
- cp = &cp[1];
- }
- } else
- base = 10;
- } else if (base == 16 && (cp[0] == '0')
- && ((cp[1] == 'x') || (cp[1] == 'X'))) {
- cp = &cp[2];
- }
-
- result = 0;
-
- while (isxdigit(*cp) &&
- (value =
- isdigit(*cp) ? *cp - '0' : toupper(*cp) - 'A' + 10) <
- base) {
- result = result * base + value;
- /* Detected overflow */
- if (result < last_result && !minus)
- return (unsigned long)-1;
- last_result = result;
- cp++;
- }
-
- if (minus)
- result = (unsigned long) (-(long)result);
-
- if (endp)
- *endp = (char *)cp;
-
- return result;
-}
-
-int bcm_atoi(char *s)
-{
- return (int)bcm_strtoul(s, NULL, 10);
-}
-
-/* return pointer to location of substring 'needle' in 'haystack' */
-char *bcmstrstr(char *haystack, char *needle)
-{
- int len, nlen;
- int i;
-
- if ((haystack == NULL) || (needle == NULL))
- return haystack;
-
- nlen = strlen(needle);
- len = strlen(haystack) - nlen + 1;
-
- for (i = 0; i < len; i++)
- if (memcmp(needle, &haystack[i], nlen) == 0)
- return &haystack[i];
- return NULL;
-}
-
-char *bcmstrcat(char *dest, const char *src)
-{
- char *p;
-
- p = dest + strlen(dest);
-
- while ((*p++ = *src++) != '\0')
- ;
-
- return dest;
-}
-
-char *bcmstrncat(char *dest, const char *src, uint size)
-{
- char *endp;
- char *p;
-
- p = dest + strlen(dest);
- endp = p + size;
-
- while (p != endp && (*p++ = *src++) != '\0')
- ;
-
- return dest;
-}
-
-/****************************************************************************
-* Function: bcmstrtok
-*
-* Purpose:
-* Tokenizes a string. This function is conceptually similiar
-* to ANSI C strtok(),
-* but allows strToken() to be used by different strings or callers at the same
-* time. Each call modifies '*string' by substituting a NULL character for the
-* first delimiter that is encountered, and updates 'string' to point to
-* the char
-* after the delimiter. Leading delimiters are skipped.
-*
-* Parameters:
-* string (mod) Ptr to string ptr, updated by token.
-* delimiters (in) Set of delimiter characters.
-* tokdelim (out) Character that delimits the returned token. (May
-* be set to NULL if token delimiter is not required).
-*
-* Returns: Pointer to the next token found. NULL when no more tokens are found.
-*****************************************************************************
-*/
-char *bcmstrtok(char **string, const char *delimiters, char *tokdelim)
-{
- unsigned char *str;
- unsigned long map[8];
- int count;
- char *nextoken;
-
- if (tokdelim != NULL) {
- /* Prime the token delimiter */
- *tokdelim = '\0';
- }
-
- /* Clear control map */
- for (count = 0; count < 8; count++)
- map[count] = 0;
-
- /* Set bits in delimiter table */
- do {
- map[*delimiters >> 5] |= (1 << (*delimiters & 31));
- }
- while (*delimiters++)
- ;
-
- str = (unsigned char *)*string;
-
- /* Find beginning of token (skip over leading delimiters). Note that
- * there is no token iff this loop sets str to point to the terminal
- * null (*str == '\0')
- */
- while (((map[*str >> 5] & (1 << (*str & 31))) && *str) || (*str == ' '))
- str++;
-
- nextoken = (char *)str;
-
- /* Find the end of the token. If it is not the end of the string,
- * put a null there.
- */
- for (; *str; str++) {
- if (map[*str >> 5] & (1 << (*str & 31))) {
- if (tokdelim != NULL)
- *tokdelim = *str;
-
- *str++ = '\0';
- break;
- }
- }
-
- *string = (char *)str;
-
- /* Determine if a token has been found. */
- if (nextoken == (char *)str)
- return NULL;
- else
- return nextoken;
-}
-
-#define xToLower(C) \
- ((C >= 'A' && C <= 'Z') ? (char)((int)C - (int)'A' + (int)'a') : C)
-
-/****************************************************************************
-* Function: bcmstricmp
-*
-* Purpose: Compare to strings case insensitively.
-*
-* Parameters: s1 (in) First string to compare.
-* s2 (in) Second string to compare.
-*
-* Returns: Return 0 if the two strings are equal, -1 if t1 < t2 and 1 if
-* t1 > t2, when ignoring case sensitivity.
-*****************************************************************************
-*/
-int bcmstricmp(const char *s1, const char *s2)
-{
- char dc, sc;
-
- while (*s2 && *s1) {
- dc = xToLower(*s1);
- sc = xToLower(*s2);
- if (dc < sc)
- return -1;
- if (dc > sc)
- return 1;
- s1++;
- s2++;
- }
-
- if (*s1 && !*s2)
- return 1;
- if (!*s1 && *s2)
- return -1;
- return 0;
-}
-
-/****************************************************************************
-* Function: bcmstrnicmp
-*
-* Purpose: Compare to strings case insensitively, upto a max of 'cnt'
-* characters.
-*
-* Parameters: s1 (in) First string to compare.
-* s2 (in) Second string to compare.
-* cnt (in) Max characters to compare.
-*
-* Returns: Return 0 if the two strings are equal, -1 if t1 < t2 and 1 if
-* t1 > t2, when ignoring case sensitivity.
-*****************************************************************************
-*/
-int bcmstrnicmp(const char *s1, const char *s2, int cnt)
-{
- char dc, sc;
-
- while (*s2 && *s1 && cnt) {
- dc = xToLower(*s1);
- sc = xToLower(*s2);
- if (dc < sc)
- return -1;
- if (dc > sc)
- return 1;
- s1++;
- s2++;
- cnt--;
- }
-
- if (!cnt)
- return 0;
- if (*s1 && !*s2)
- return 1;
- if (!*s1 && *s2)
- return -1;
- return 0;
-}
-
/* parse a xx:xx:xx:xx:xx:xx format ethernet address */
int bcm_ether_atoe(char *p, struct ether_addr *ea)
{
int i = 0;
for (;;) {
- ea->octet[i++] = (char)bcm_strtoul(p, &p, 16);
+ ea->octet[i++] = (char)simple_strtoul(p, &p, 16);
if (!*p++ || i == 6)
break;
}
@@ -756,34 +499,6 @@ int bcm_ether_atoe(char *p, struct ether_addr *ea)
return i == 6;
}
-#if defined(CONFIG_USBRNDIS_RETAIL) || defined(NDIS_MINIPORT_DRIVER)
-/* registry routine buffer preparation utility functions:
- * parameter order is like strncpy, but returns count
- * of bytes copied. Minimum bytes copied is null char(1)/wchar(2)
- */
-unsigned long wchar2ascii(char *abuf, unsigned short * wbuf, unsigned short wbuflen, unsigned long abuflen)
-{
- unsigned long copyct = 1;
- unsigned short i;
-
- if (abuflen == 0)
- return 0;
-
- /* wbuflen is in bytes */
- wbuflen /= sizeof(unsigned short);
-
- for (i = 0; i < wbuflen; ++i) {
- if (--abuflen == 0)
- break;
- *abuf++ = (char)*wbuf++;
- ++copyct;
- }
- *abuf = '\0';
-
- return copyct;
-}
-#endif /* CONFIG_USBRNDIS_RETAIL || NDIS_MINIPORT_DRIVER */
-
char *bcm_ether_ntoa(const struct ether_addr *ea, char *buf)
{
static const char template[] = "%02x:%02x:%02x:%02x:%02x:%02x";
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_common.c b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
index 27c6976..3c6582f 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
@@ -15,6 +15,8 @@
*/
#include <typedefs.h>
#include <osl.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
#include <bcmutils.h>
#include <bcmendian.h>
#include <dngl_stats.h>
@@ -967,8 +969,6 @@ void print_buf(void *pbuf, int len, int bytes_per_line)
printf("\n");
}
-#define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base))
-
/* Convert user's input in hex pattern to byte-size mask */
static int wl_pattern_atoh(char *src, char *dst)
{
@@ -986,7 +986,7 @@ static int wl_pattern_atoh(char *src, char *dst)
char num[3];
strncpy(num, src, 2);
num[2] = '\0';
- dst[i] = (u8) strtoul(num, NULL, 16);
+ dst[i] = (u8) simple_strtoul(num, NULL, 16);
src += 2;
}
return i;
@@ -1015,7 +1015,7 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable,
arg_org = arg_save;
memcpy(arg_save, arg, strlen(arg) + 1);
- argv[i] = bcmstrtok(&arg_save, " ", 0);
+ argv[i] = strsep(&arg_save, " ");
i = 0;
if (NULL == argv[i]) {
@@ -1032,7 +1032,7 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable,
pkt_filterp = (wl_pkt_filter_enable_t *) (buf + str_len + 1);
/* Parse packet filter id. */
- enable_parm.id = htod32(strtoul(argv[i], NULL, 0));
+ enable_parm.id = htod32(simple_strtoul(argv[i], NULL, 0));
/* Parse enable/disable value. */
enable_parm.enable = htod32(enable);
@@ -1101,9 +1101,9 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
goto fail;
}
- argv[i] = bcmstrtok(&arg_save, " ", 0);
+ argv[i] = strsep(&arg_save, " ");
while (argv[i++])
- argv[i] = bcmstrtok(&arg_save, " ", 0);
+ argv[i] = strsep(&arg_save, " ");
i = 0;
if (NULL == argv[i]) {
@@ -1120,7 +1120,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
pkt_filterp = (wl_pkt_filter_t *) (buf + str_len + 1);
/* Parse packet filter id. */
- pkt_filter.id = htod32(strtoul(argv[i], NULL, 0));
+ pkt_filter.id = htod32(simple_strtoul(argv[i], NULL, 0));
if (NULL == argv[++i]) {
DHD_ERROR(("Polarity not provided\n"));
@@ -1128,7 +1128,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
}
/* Parse filter polarity. */
- pkt_filter.negate_match = htod32(strtoul(argv[i], NULL, 0));
+ pkt_filter.negate_match = htod32(simple_strtoul(argv[i], NULL, 0));
if (NULL == argv[++i]) {
DHD_ERROR(("Filter type not provided\n"));
@@ -1136,7 +1136,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
}
/* Parse filter type. */
- pkt_filter.type = htod32(strtoul(argv[i], NULL, 0));
+ pkt_filter.type = htod32(simple_strtoul(argv[i], NULL, 0));
if (NULL == argv[++i]) {
DHD_ERROR(("Offset not provided\n"));
@@ -1144,7 +1144,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
}
/* Parse pattern filter offset. */
- pkt_filter.u.pattern.offset = htod32(strtoul(argv[i], NULL, 0));
+ pkt_filter.u.pattern.offset = htod32(simple_strtoul(argv[i], NULL, 0));
if (NULL == argv[++i]) {
DHD_ERROR(("Bitmask not provided\n"));
@@ -1290,7 +1290,7 @@ int dhd_preinit_ioctls(dhd_pub_t *dhd)
ptr = buf;
bcm_mkiovar("ver", 0, 0, buf, sizeof(buf));
dhdcdc_query_ioctl(dhd, 0, WLC_GET_VAR, buf, sizeof(buf));
- bcmstrtok(&ptr, "\n", 0);
+ strsep(&ptr, "\n");
/* Print fw version info */
DHD_ERROR(("Firmware version = %s\n", buf));
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 60b499a..fe8dd7b 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -16,6 +16,7 @@
#include <typedefs.h>
#include <osl.h>
+#include <linux/string.h>
#include <bcmsdh.h>
#ifdef BCMEMBEDIMAGE
@@ -2397,15 +2398,15 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, uint32 actionid,
{
*(char *)arg = 0;
- bcmstrcat(arg, "\nFunc 0\n");
+ strcat(arg, "\nFunc 0\n");
bcmsdh_cis_read(bus->sdh, 0x10,
(u8 *) arg + strlen(arg),
SBSDIO_CIS_SIZE_LIMIT);
- bcmstrcat(arg, "\nFunc 1\n");
+ strcat(arg, "\nFunc 1\n");
bcmsdh_cis_read(bus->sdh, 0x11,
(u8 *) arg + strlen(arg),
SBSDIO_CIS_SIZE_LIMIT);
- bcmstrcat(arg, "\nFunc 2\n");
+ strcat(arg, "\nFunc 2\n");
bcmsdh_cis_read(bus->sdh, 0x12,
(u8 *) arg + strlen(arg),
SBSDIO_CIS_SIZE_LIMIT);
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 11084cb..654eb81 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -17,6 +17,7 @@
#include <typedefs.h>
#include <linuxver.h>
#include <osl.h>
+#include <linux/kernel.h>
#include <bcmutils.h>
#include <bcmendian.h>
@@ -3531,7 +3532,6 @@ dongle_offload_out:
static int32 wl_pattern_atoh(s8 *src, s8 *dst)
{
-#define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base))
int i;
if (strncmp(src, "0x", 2) != 0 && strncmp(src, "0X", 2) != 0) {
WL_ERR(("Mask invalid format. Needs to start with 0x\n"));
@@ -3546,7 +3546,7 @@ static int32 wl_pattern_atoh(s8 *src, s8 *dst)
char num[3];
strncpy(num, src, 2);
num[2] = '\0';
- dst[i] = (u8) strtoul(num, NULL, 16);
+ dst[i] = (u8) simple_strtoul(num, NULL, 16);
src += 2;
}
return i;
diff --git a/drivers/staging/brcm80211/include/bcmutils.h b/drivers/staging/brcm80211/include/bcmutils.h
index d0960b7..612384e 100644
--- a/drivers/staging/brcm80211/include/bcmutils.h
+++ b/drivers/staging/brcm80211/include/bcmutils.h
@@ -182,20 +182,6 @@ extern "C" {
#define PKTPRIO_UPD 0x400 /* DSCP used to update VLAN prio */
#define PKTPRIO_DSCP 0x800 /* DSCP prio found */
-#ifdef BRCM_FULLMAC
-/* string */
- extern int BCMROMFN(bcm_atoi) (char *s);
- extern unsigned long 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 unsigned long wchar2ascii(char *abuf, unsigned short *wbuf, unsigned short wbuflen,
- unsigned long 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);
-#endif
/* 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);
--
1.7.2.3
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/3] staging: brcm80211: fix to use "%pM" flag to print MAC address
2010-10-10 10:20 [PATCH 1/3] staging: brcm80211: clean up custom ctype library again Andy Shevchenko
2010-10-10 10:20 ` [PATCH 2/3] staging: brcm80211: remove custom string " Andy Shevchenko
@ 2010-10-10 10:20 ` Andy Shevchenko
2010-10-10 10:44 ` Johannes Berg
2010-10-10 12:41 ` [PATCH 1/3] staging: brcm80211: clean up custom ctype library again Greg KH
2 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2010-10-10 10:20 UTC (permalink / raw)
To: linux-wireless, devel, linux-kernel
Cc: Nohee Ko, Greg Kroah-Hartman, Andy Shevchenko
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/staging/brcm80211/brcmfmac/bcmutils.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmutils.c b/drivers/staging/brcm80211/brcmfmac/bcmutils.c
index f5c552d..007cb55 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmutils.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmutils.c
@@ -501,10 +501,7 @@ int bcm_ether_atoe(char *p, struct ether_addr *ea)
char *bcm_ether_ntoa(const struct ether_addr *ea, char *buf)
{
- static const char template[] = "%02x:%02x:%02x:%02x:%02x:%02x";
- snprintf(buf, 18, template,
- ea->octet[0] & 0xff, ea->octet[1] & 0xff, ea->octet[2] & 0xff,
- ea->octet[3] & 0xff, ea->octet[4] & 0xff, ea->octet[5] & 0xff);
+ snprintf(buf, 18, "%pM", ea->octet);
return buf;
}
--
1.7.2.3
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 3/3] staging: brcm80211: fix to use "%pM" flag to print MAC address
2010-10-10 10:20 ` [PATCH 3/3] staging: brcm80211: fix to use "%pM" flag to print MAC address Andy Shevchenko
@ 2010-10-10 10:44 ` Johannes Berg
2010-10-10 12:25 ` Andy Shevchenko
0 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2010-10-10 10:44 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-wireless, devel, linux-kernel, Nohee Ko, Greg Kroah-Hartman
On Sun, 2010-10-10 at 13:20 +0300, Andy Shevchenko wrote:
> char *bcm_ether_ntoa(const struct ether_addr *ea, char *buf)
> {
> - static const char template[] = "%02x:%02x:%02x:%02x:%02x:%02x";
> - snprintf(buf, 18, template,
> - ea->octet[0] & 0xff, ea->octet[1] & 0xff, ea->octet[2] & 0xff,
> - ea->octet[3] & 0xff, ea->octet[4] & 0xff, ea->octet[5] & 0xff);
> + snprintf(buf, 18, "%pM", ea->octet);
That's a pretty strange use of snprintf -- just use sprintf if you don't
have a real buffer length.
johannes
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 3/3] staging: brcm80211: fix to use "%pM" flag to print MAC address
2010-10-10 10:44 ` Johannes Berg
@ 2010-10-10 12:25 ` Andy Shevchenko
0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2010-10-10 12:25 UTC (permalink / raw)
To: Johannes Berg
Cc: linux-wireless, devel, linux-kernel, Nohee Ko, Greg Kroah-Hartman
On Sun, Oct 10, 2010 at 1:44 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
>> + snprintf(buf, 18, "%pM", ea->octet);
>
> That's a pretty strange use of snprintf -- just use sprintf if you don't
> have a real buffer length.
Exactly. However, it's out of scope of this certain patch.
It should be done as a fix across entire driver.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] staging: brcm80211: clean up custom ctype library again
2010-10-10 10:20 [PATCH 1/3] staging: brcm80211: clean up custom ctype library again Andy Shevchenko
2010-10-10 10:20 ` [PATCH 2/3] staging: brcm80211: remove custom string " Andy Shevchenko
2010-10-10 10:20 ` [PATCH 3/3] staging: brcm80211: fix to use "%pM" flag to print MAC address Andy Shevchenko
@ 2010-10-10 12:41 ` Greg KH
2010-10-11 9:17 ` Andy Shevchenko
2 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2010-10-10 12:41 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-wireless, devel, linux-kernel, Nohee Ko, Greg Kroah-Hartman
On Sun, Oct 10, 2010 at 01:20:11PM +0300, Andy Shevchenko wrote:
> The similar cleanup was done before for softmac implementation. But the
> fullmac driver brings this back. Remove it again.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
> drivers/staging/brcm80211/brcmfmac/bcmutils.c | 56 ++----------------------
This file is now gone from the tree, as of yesterday. Care to resync on
the next linux-next tree on Monday and verify if any of these patches
are even needed anymore?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] staging: brcm80211: clean up custom ctype library again
2010-10-10 12:41 ` [PATCH 1/3] staging: brcm80211: clean up custom ctype library again Greg KH
@ 2010-10-11 9:17 ` Andy Shevchenko
0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2010-10-11 9:17 UTC (permalink / raw)
To: Greg KH; +Cc: linux-wireless, devel, linux-kernel, Nohee Ko, Greg Kroah-Hartman
On Sun, Oct 10, 2010 at 3:41 PM, Greg KH <greg@kroah.com> wrote:
> This file is now gone from the tree, as of yesterday. Care to resync on
> the next linux-next tree on Monday and verify if any of these patches
> are even needed anymore?
Done! Still some clean ups are needed. Already sent new patch series.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-10-11 9:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-10 10:20 [PATCH 1/3] staging: brcm80211: clean up custom ctype library again Andy Shevchenko
2010-10-10 10:20 ` [PATCH 2/3] staging: brcm80211: remove custom string " Andy Shevchenko
2010-10-10 10:20 ` [PATCH 3/3] staging: brcm80211: fix to use "%pM" flag to print MAC address Andy Shevchenko
2010-10-10 10:44 ` Johannes Berg
2010-10-10 12:25 ` Andy Shevchenko
2010-10-10 12:41 ` [PATCH 1/3] staging: brcm80211: clean up custom ctype library again Greg KH
2010-10-11 9:17 ` Andy Shevchenko
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).