Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 300864
b: refs/heads/master
c: 9e04a7c
h: refs/heads/master
v: v3
  • Loading branch information
Amitkumar Karwar authored and John W. Linville committed Apr 12, 2012
1 parent 74fb27e commit a7f428b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d35ccaa4768ee39f7bb3c23394703d1da587c731
refs/heads/master: 9e04a7c6d45fd70be55fcb48ec49f55dad9928f7
6 changes: 6 additions & 0 deletions trunk/drivers/net/wireless/mwifiex/cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,7 @@ int mwifiex_register_cfg80211(struct mwifiex_private *priv)
void *wdev_priv;
struct wireless_dev *wdev;
struct ieee80211_sta_ht_cap *ht_info;
u8 *country_code;

wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
if (!wdev) {
Expand Down Expand Up @@ -1484,6 +1485,11 @@ int mwifiex_register_cfg80211(struct mwifiex_private *priv)
"info: successfully registered wiphy device\n");
}

country_code = mwifiex_11d_code_2_region(priv->adapter->region_code);
if (country_code && regulatory_hint(wdev->wiphy, country_code))
dev_err(priv->adapter->dev,
"%s: regulatory_hint failed\n", __func__);

priv->wdev = wdev;

return ret;
Expand Down
31 changes: 31 additions & 0 deletions trunk/drivers/net/wireless/mwifiex/cfp.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,37 @@ u16 region_code_index[MWIFIEX_MAX_REGION_CODE] = { 0x10, 0x20, 0x30,

static u8 supported_rates_n[N_SUPPORTED_RATES] = { 0x02, 0x04, 0 };

struct region_code_mapping {
u8 code;
u8 region[IEEE80211_COUNTRY_STRING_LEN];
};

static struct region_code_mapping region_code_mapping_t[] = {
{ 0x10, "US " }, /* US FCC */
{ 0x20, "CA " }, /* IC Canada */
{ 0x30, "EU " }, /* ETSI */
{ 0x31, "ES " }, /* Spain */
{ 0x32, "FR " }, /* France */
{ 0x40, "JP " }, /* Japan */
{ 0x41, "JP " }, /* Japan */
{ 0x50, "CN " }, /* China */
};

/* This function converts integer code to region string */
u8 *mwifiex_11d_code_2_region(u8 code)
{
u8 i;
u8 size = sizeof(region_code_mapping_t)/
sizeof(struct region_code_mapping);

/* Look for code in mapping table */
for (i = 0; i < size; i++)
if (region_code_mapping_t[i].code == code)
return region_code_mapping_t[i].region;

return NULL;
}

/*
* This function maps an index in supported rates table into
* the corresponding data rate.
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/wireless/mwifiex/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,7 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
u32 *flags, struct vif_params *params);
int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev);

u8 *mwifiex_11d_code_2_region(u8 code);

#ifdef CONFIG_DEBUG_FS
void mwifiex_debugfs_init(void);
Expand Down

0 comments on commit a7f428b

Please sign in to comment.