diff options
Diffstat (limited to 'drivers/net/wireless/bcmdhd/wldev_common.c')
-rw-r--r-- | drivers/net/wireless/bcmdhd/wldev_common.c | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/drivers/net/wireless/bcmdhd/wldev_common.c b/drivers/net/wireless/bcmdhd/wldev_common.c index 8e0ed4d..2d4831b 100644 --- a/drivers/net/wireless/bcmdhd/wldev_common.c +++ b/drivers/net/wireless/bcmdhd/wldev_common.c @@ -1,7 +1,7 @@ /* * Common function shared by Linux WEXT, cfg80211 and p2p drivers * - * Copyright (C) 1999-2012, Broadcom Corporation + * Copyright (C) 1999-2014, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you @@ -21,7 +21,7 @@ * software in any way with any other Broadcom software provided under a license * other than the GPL, without Broadcom's express prior written consent. * - * $Id: wldev_common.c,v 1.1.4.1.2.14 2011-02-09 01:40:07 $ + * $Id: wldev_common.c 432642 2013-10-29 04:23:40Z $ */ #include <osl.h> @@ -32,12 +32,12 @@ #include <wldev_common.h> #include <bcmutils.h> -#define htod32(i) i -#define htod16(i) i -#define dtoh32(i) i -#define dtoh16(i) i -#define htodchanspec(i) i -#define dtohchanspec(i) i +#define htod32(i) (i) +#define htod16(i) (i) +#define dtoh32(i) (i) +#define dtoh16(i) (i) +#define htodchanspec(i) (i) +#define dtohchanspec(i) (i) #define WLDEV_ERROR(args) \ do { \ @@ -109,6 +109,7 @@ s32 wldev_iovar_setbuf( ret = wldev_ioctl(dev, WLC_SET_VAR, buf, iovar_len, TRUE); else ret = BCME_BUFTOOSHORT; + if (buf_sync) mutex_unlock(buf_sync); return ret; @@ -335,7 +336,7 @@ int wldev_set_band( } int wldev_set_country( - struct net_device *dev, char *country_code) + struct net_device *dev, char *country_code, bool notify, bool user_enforced) { int error = -1; wl_country_t cspec = {{0}, 0, {0}}; @@ -345,24 +346,30 @@ int wldev_set_country( if (!country_code) return error; - error = wldev_iovar_getbuf(dev, "country", &cspec, sizeof(cspec), - smbuf, sizeof(smbuf), NULL); - if (error < 0) + bzero(&scbval, sizeof(scb_val_t)); + error = wldev_iovar_getbuf(dev, "country", NULL, 0, &cspec, sizeof(cspec), NULL); + if (error < 0) { WLDEV_ERROR(("%s: get country failed = %d\n", __FUNCTION__, error)); + return 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), true); - if (error < 0) { - WLDEV_ERROR(("%s: set country failed due to Disassoc error %d\n", - __FUNCTION__, error)); - return error; + (strncmp(country_code, cspec.country_abbrev, WLC_CNTRY_BUF_SZ) != 0)) { + + if (user_enforced) { + bzero(&scbval, sizeof(scb_val_t)); + error = wldev_ioctl(dev, WLC_DISASSOC, &scbval, sizeof(scb_val_t), true); + if (error < 0) { + WLDEV_ERROR(("%s: set country failed due to Disassoc error %d\n", + __FUNCTION__, error)); + return error; + } } + cspec.rev = -1; memcpy(cspec.country_abbrev, country_code, WLC_CNTRY_BUF_SZ); memcpy(cspec.ccode, country_code, WLC_CNTRY_BUF_SZ); - get_customized_country_code((char *)&cspec.country_abbrev, &cspec); + dhd_get_customized_country_code(dev, (char *)&cspec.country_abbrev, &cspec); error = wldev_iovar_setbuf(dev, "country", &cspec, sizeof(cspec), smbuf, sizeof(smbuf), NULL); if (error < 0) { @@ -370,7 +377,7 @@ int wldev_set_country( __FUNCTION__, country_code, cspec.ccode, cspec.rev)); return error; } - dhd_bus_country_set(dev, &cspec); + dhd_bus_country_set(dev, &cspec, notify); WLDEV_ERROR(("%s: set country for %s as %s rev %d\n", __FUNCTION__, country_code, cspec.ccode, cspec.rev)); } |