diff options
author | Bing Zhao <bzhao@marvell.com> | 2014-01-08 18:45:57 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-01-09 10:56:40 -0500 |
commit | b58df4461921dad57707fbedee11e6f79f58b1e6 (patch) | |
tree | e846714980142f5bb48e6f64b0692e3d0045266a | |
parent | 63791ccd4690e5c6b3f060bcd2b846e31bd0b423 (diff) |
mwifiex: use a function to replace two copies of a code fragment
Instead of having two copies of the code for device tree cfgdata
downloading, add a function to improve the code.
Reviewed-by: Paul Stewart <pstew@chromium.org>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_ioctl.c | 17 |
3 files changed, 13 insertions, 14 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index b994679abce0..e7c81abf108e 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -563,14 +563,7 @@ static void mwifiex_reg_notifier(struct wiphy *wiphy, | |||
563 | memcpy(adapter->country_code, request->alpha2, | 563 | memcpy(adapter->country_code, request->alpha2, |
564 | sizeof(request->alpha2)); | 564 | sizeof(request->alpha2)); |
565 | mwifiex_send_domain_info_cmd_fw(wiphy); | 565 | mwifiex_send_domain_info_cmd_fw(wiphy); |
566 | 566 | mwifiex_dnld_txpwr_table(priv); | |
567 | if (adapter->dt_node) { | ||
568 | char txpwr[] = {"marvell,00_txpwrlimit"}; | ||
569 | |||
570 | memcpy(&txpwr[8], adapter->country_code, 2); | ||
571 | mwifiex_dnld_dt_cfgdata(priv, adapter->dt_node, | ||
572 | txpwr); | ||
573 | } | ||
574 | } | 567 | } |
575 | } | 568 | } |
576 | 569 | ||
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index ab3416449bfd..d8ad554ce39f 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -1155,6 +1155,7 @@ void mwifiex_11h_process_join(struct mwifiex_private *priv, u8 **buffer, | |||
1155 | int mwifiex_11h_handle_event_chanswann(struct mwifiex_private *priv); | 1155 | int mwifiex_11h_handle_event_chanswann(struct mwifiex_private *priv); |
1156 | int mwifiex_dnld_dt_cfgdata(struct mwifiex_private *priv, | 1156 | int mwifiex_dnld_dt_cfgdata(struct mwifiex_private *priv, |
1157 | struct device_node *node, const char *prefix); | 1157 | struct device_node *node, const char *prefix); |
1158 | void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv); | ||
1158 | 1159 | ||
1159 | extern const struct ethtool_ops mwifiex_ethtool_ops; | 1160 | extern const struct ethtool_ops mwifiex_ethtool_ops; |
1160 | 1161 | ||
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index 3edc92fad319..c5cb2ed19ec2 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
@@ -184,6 +184,16 @@ int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv, | |||
184 | return mwifiex_update_bss_desc_with_ie(priv->adapter, bss_desc); | 184 | return mwifiex_update_bss_desc_with_ie(priv->adapter, bss_desc); |
185 | } | 185 | } |
186 | 186 | ||
187 | void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv) | ||
188 | { | ||
189 | if (priv->adapter->dt_node) { | ||
190 | char txpwr[] = {"marvell,00_txpwrlimit"}; | ||
191 | |||
192 | memcpy(&txpwr[8], priv->adapter->country_code, 2); | ||
193 | mwifiex_dnld_dt_cfgdata(priv, priv->adapter->dt_node, txpwr); | ||
194 | } | ||
195 | } | ||
196 | |||
187 | static int mwifiex_process_country_ie(struct mwifiex_private *priv, | 197 | static int mwifiex_process_country_ie(struct mwifiex_private *priv, |
188 | struct cfg80211_bss *bss) | 198 | struct cfg80211_bss *bss) |
189 | { | 199 | { |
@@ -234,12 +244,7 @@ static int mwifiex_process_country_ie(struct mwifiex_private *priv, | |||
234 | return -1; | 244 | return -1; |
235 | } | 245 | } |
236 | 246 | ||
237 | if (priv->adapter->dt_node) { | 247 | mwifiex_dnld_txpwr_table(priv); |
238 | char txpwr[] = {"marvell,00_txpwrlimit"}; | ||
239 | |||
240 | memcpy(&txpwr[8], priv->adapter->country_code, 2); | ||
241 | mwifiex_dnld_dt_cfgdata(priv, priv->adapter->dt_node, txpwr); | ||
242 | } | ||
243 | 248 | ||
244 | return 0; | 249 | return 0; |
245 | } | 250 | } |