OSDN Git Service

net: wireless: bcmdhd: Skip disassoc if country is not changed in country set
authorDmitry Shmidt <dimitrysh@google.com>
Fri, 26 Aug 2011 00:13:01 +0000 (17:13 -0700)
committerDmitry Shmidt <dimitrysh@google.com>
Wed, 31 Aug 2011 17:24:13 +0000 (10:24 -0700)
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
drivers/net/wireless/bcmdhd/wldev_common.c

index b01e4a2..e69561e 100644 (file)
@@ -309,11 +309,19 @@ int wldev_set_country(
        if (!country_code)
                return error;
 
-       bzero(&scbval, sizeof(scb_val_t));
-       error = wldev_ioctl(dev, WLC_DISASSOC, &scbval, sizeof(scb_val_t), 1);
-       if (error < 0) {
-               DHD_ERROR(("%s: set country failed due to Disassoc error\n", __FUNCTION__));
-               return error;
+       error = wldev_iovar_getbuf(dev, "country", &cspec, sizeof(cspec),
+                                       smbuf, sizeof(smbuf));
+       if (error < 0)
+               DHD_ERROR(("%s: get country failed = %d\n", __FUNCTION__, error));
+
+       if ((error < 0) ||
+           (strncmp(country_code, smbuf, WLC_CNTRY_BUF_SZ) != 0)) {
+               bzero(&scbval, sizeof(scb_val_t));
+               error = wldev_ioctl(dev, WLC_DISASSOC, &scbval, sizeof(scb_val_t), 1);
+               if (error < 0) {
+                       DHD_ERROR(("%s: set country failed due to Disassoc error\n", __FUNCTION__));
+                       return error;
+               }
        }
        cspec.rev = -1;
        memcpy(cspec.country_abbrev, country_code, WLC_CNTRY_BUF_SZ);