aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2011-12-07 06:35:17 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-12-16 09:30:42 -0500
commita1910f9cad2b4b9cc0d5d326aa65632a23c16088 (patch)
treedcc927cc74dfd8918ee2324a98002b961c4a30cd /drivers/net/wireless
parent1b2538b2ab8f37e55b91b3cce98d2df5c126125d (diff)
mac80211_hwsim: fix wmediumd_pid
Fix a few minor issues with wmediumd_pid: a) make static b) use u32 to match the snd_pid type c) use ACCESS_ONCE since we don't lock it d) don't explicitly initialize to 0 Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 6cf6d6d25e21..52bcdf40d5bd 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -37,7 +37,8 @@ MODULE_AUTHOR("Jouni Malinen");
37MODULE_DESCRIPTION("Software simulator of 802.11 radio(s) for mac80211"); 37MODULE_DESCRIPTION("Software simulator of 802.11 radio(s) for mac80211");
38MODULE_LICENSE("GPL"); 38MODULE_LICENSE("GPL");
39 39
40int wmediumd_pid; 40static u32 wmediumd_pid;
41
41static int radios = 2; 42static int radios = 2;
42module_param(radios, int, 0444); 43module_param(radios, int, 0444);
43MODULE_PARM_DESC(radios, "Number of simulated radios"); 44MODULE_PARM_DESC(radios, "Number of simulated radios");
@@ -665,7 +666,7 @@ static void mac80211_hwsim_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
665{ 666{
666 bool ack; 667 bool ack;
667 struct ieee80211_tx_info *txi; 668 struct ieee80211_tx_info *txi;
668 int _pid; 669 u32 _pid;
669 670
670 mac80211_hwsim_monitor_rx(hw, skb); 671 mac80211_hwsim_monitor_rx(hw, skb);
671 672
@@ -676,7 +677,7 @@ static void mac80211_hwsim_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
676 } 677 }
677 678
678 /* wmediumd mode check */ 679 /* wmediumd mode check */
679 _pid = wmediumd_pid; 680 _pid = ACCESS_ONCE(wmediumd_pid);
680 681
681 if (_pid) 682 if (_pid)
682 return mac80211_hwsim_tx_frame_nl(hw, skb, _pid); 683 return mac80211_hwsim_tx_frame_nl(hw, skb, _pid);
@@ -764,7 +765,7 @@ static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac,
764 struct ieee80211_hw *hw = arg; 765 struct ieee80211_hw *hw = arg;
765 struct sk_buff *skb; 766 struct sk_buff *skb;
766 struct ieee80211_tx_info *info; 767 struct ieee80211_tx_info *info;
767 int _pid; 768 u32 _pid;
768 769
769 hwsim_check_magic(vif); 770 hwsim_check_magic(vif);
770 771
@@ -781,7 +782,7 @@ static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac,
781 mac80211_hwsim_monitor_rx(hw, skb); 782 mac80211_hwsim_monitor_rx(hw, skb);
782 783
783 /* wmediumd mode check */ 784 /* wmediumd mode check */
784 _pid = wmediumd_pid; 785 _pid = ACCESS_ONCE(wmediumd_pid);
785 786
786 if (_pid) 787 if (_pid)
787 return mac80211_hwsim_tx_frame_nl(hw, skb, _pid); 788 return mac80211_hwsim_tx_frame_nl(hw, skb, _pid);
@@ -1254,7 +1255,7 @@ static void hwsim_send_ps_poll(void *dat, u8 *mac, struct ieee80211_vif *vif)
1254 struct hwsim_vif_priv *vp = (void *)vif->drv_priv; 1255 struct hwsim_vif_priv *vp = (void *)vif->drv_priv;
1255 struct sk_buff *skb; 1256 struct sk_buff *skb;
1256 struct ieee80211_pspoll *pspoll; 1257 struct ieee80211_pspoll *pspoll;
1257 int _pid; 1258 u32 _pid;
1258 1259
1259 if (!vp->assoc) 1260 if (!vp->assoc)
1260 return; 1261 return;
@@ -1275,7 +1276,7 @@ static void hwsim_send_ps_poll(void *dat, u8 *mac, struct ieee80211_vif *vif)
1275 memcpy(pspoll->ta, mac, ETH_ALEN); 1276 memcpy(pspoll->ta, mac, ETH_ALEN);
1276 1277
1277 /* wmediumd mode check */ 1278 /* wmediumd mode check */
1278 _pid = wmediumd_pid; 1279 _pid = ACCESS_ONCE(wmediumd_pid);
1279 1280
1280 if (_pid) 1281 if (_pid)
1281 return mac80211_hwsim_tx_frame_nl(data->hw, skb, _pid); 1282 return mac80211_hwsim_tx_frame_nl(data->hw, skb, _pid);
@@ -1292,7 +1293,7 @@ static void hwsim_send_nullfunc(struct mac80211_hwsim_data *data, u8 *mac,
1292 struct hwsim_vif_priv *vp = (void *)vif->drv_priv; 1293 struct hwsim_vif_priv *vp = (void *)vif->drv_priv;
1293 struct sk_buff *skb; 1294 struct sk_buff *skb;
1294 struct ieee80211_hdr *hdr; 1295 struct ieee80211_hdr *hdr;
1295 int _pid; 1296 u32 _pid;
1296 1297
1297 if (!vp->assoc) 1298 if (!vp->assoc)
1298 return; 1299 return;
@@ -1314,7 +1315,7 @@ static void hwsim_send_nullfunc(struct mac80211_hwsim_data *data, u8 *mac,
1314 memcpy(hdr->addr3, vp->bssid, ETH_ALEN); 1315 memcpy(hdr->addr3, vp->bssid, ETH_ALEN);
1315 1316
1316 /* wmediumd mode check */ 1317 /* wmediumd mode check */
1317 _pid = wmediumd_pid; 1318 _pid = ACCESS_ONCE(wmediumd_pid);
1318 1319
1319 if (_pid) 1320 if (_pid)
1320 return mac80211_hwsim_tx_frame_nl(data->hw, skb, _pid); 1321 return mac80211_hwsim_tx_frame_nl(data->hw, skb, _pid);
@@ -1634,8 +1635,6 @@ static int hwsim_init_netlink(void)
1634 int rc; 1635 int rc;
1635 printk(KERN_INFO "mac80211_hwsim: initializing netlink\n"); 1636 printk(KERN_INFO "mac80211_hwsim: initializing netlink\n");
1636 1637
1637 wmediumd_pid = 0;
1638
1639 rc = genl_register_family_with_ops(&hwsim_genl_family, 1638 rc = genl_register_family_with_ops(&hwsim_genl_family,
1640 hwsim_ops, ARRAY_SIZE(hwsim_ops)); 1639 hwsim_ops, ARRAY_SIZE(hwsim_ops));
1641 if (rc) 1640 if (rc)