staging: brcm80211: replace simple_strtoul usage in brcmsmac
authorArend van Spriel <arend@broadcom.com>
Mon, 8 Aug 2011 13:58:26 +0000 (15:58 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 23 Aug 2011 20:00:02 +0000 (13:00 -0700)
The usage of simple_strtoul is not preferred. Instead kstrtoul
should be used. This patch fixes this for the brcmsmac driver.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/brcm80211/brcmsmac/main.c
drivers/staging/brcm80211/brcmsmac/phy/phy_cmn.c

index 5c97778c1db775cc281fafd29e80daffccad32c5..001a1f77e692a55844be6c485956f54d621e2ae9 100644 (file)
@@ -4287,16 +4287,17 @@ int brcms_b_attach(struct brcms_c_info *wlc, u16 vendor, u16 device, uint unit,
 #endif
        if (bustype != SI_BUS) {
                char *var;
+               unsigned long res;
 
                var = getvar(vars, "vendid");
-               if (var) {
-                       vendor = (u16) simple_strtoul(var, NULL, 0);
+               if (var && !kstrtoul(var, 0, &res)) {
+                       vendor = (u16)res;
                        wiphy_err(wiphy, "Overriding vendor id = 0x%x\n",
                                  vendor);
                }
                var = getvar(vars, "devid");
-               if (var) {
-                       u16 devid = (u16) simple_strtoul(var, NULL, 0);
+               if (var && !kstrtoul(var, 0, &res)) {
+                       u16 devid = (u16)res;
                        if (devid != 0xffff) {
                                device = devid;
                                wiphy_err(wiphy, "Overriding device id = 0x%x"
@@ -9596,10 +9597,11 @@ char *getvar(char *vars, const char *name)
 int getintvar(char *vars, const char *name)
 {
        char *val;
+       unsigned long res;
 
        val = getvar(vars, name);
-       if (val == NULL)
-               return 0;
+       if (val && !kstrtoul(val, 0, &res))
+               return res;
 
-       return simple_strtoul(val, NULL, 0);
+       return 0;
 }
index 582df4a248bbb2d51f9221def4326fcc70684dbb..22f7bfc79dde3d7b81c8f9fbdd6b89770e121805 100644 (file)
@@ -174,12 +174,13 @@ char *phy_getvar(struct brcms_phy *pi, const char *name)
 int phy_getintvar(struct brcms_phy *pi, const char *name)
 {
        char *val;
+       unsigned long res;
 
        val = PHY_GETVAR(pi, name);
-       if (val == NULL)
-               return 0;
+       if (val && !kstrtoul(val, 0, &res))
+               return res;
 
-       return simple_strtoul(val, NULL, 0);
+       return 0;
 }
 
 void wlc_phyreg_enter(struct brcms_phy_pub *pih)