aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwmc3200wifi
diff options
context:
space:
mode:
authorZhu Yi <yi.zhu@intel.com>2009-06-15 15:59:56 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 14:57:52 -0400
commit257862f3faef397f1a677ae6a5a1828fa00a97b1 (patch)
tree005afd1b950593942ee6b4e2ad44cf5dbf14410b /drivers/net/wireless/iwmc3200wifi
parent3549716484a95fd16f7fcf8b68699bd4c803b382 (diff)
iwmc3200wifi: rfkill cleanup
The patch cleans up the unused rfkill related structures and flags. It also adds wext and cfg80211 handlers for txpower auto and off so that software rfkill could be issued by user space. Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwmc3200wifi')
-rw-r--r--drivers/net/wireless/iwmc3200wifi/cfg80211.c24
-rw-r--r--drivers/net/wireless/iwmc3200wifi/iwm.h7
-rw-r--r--drivers/net/wireless/iwmc3200wifi/netdev.c12
-rw-r--r--drivers/net/wireless/iwmc3200wifi/rx.c18
-rw-r--r--drivers/net/wireless/iwmc3200wifi/sdio.c6
-rw-r--r--drivers/net/wireless/iwmc3200wifi/wext.c4
6 files changed, 39 insertions, 32 deletions
diff --git a/drivers/net/wireless/iwmc3200wifi/cfg80211.c b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
index 0cdd7ef68b78..d0629d4757d7 100644
--- a/drivers/net/wireless/iwmc3200wifi/cfg80211.c
+++ b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
@@ -500,6 +500,28 @@ static int iwm_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
500 return 0; 500 return 0;
501} 501}
502 502
503static int iwm_cfg80211_set_txpower(struct wiphy *wiphy,
504 enum tx_power_setting type, int dbm)
505{
506 switch (type) {
507 case TX_POWER_AUTOMATIC:
508 return 0;
509 default:
510 return -EOPNOTSUPP;
511 }
512
513 return 0;
514}
515
516static int iwm_cfg80211_get_txpower(struct wiphy *wiphy, int *dbm)
517{
518 struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
519
520 *dbm = iwm->txpower;
521
522 return 0;
523}
524
503static struct cfg80211_ops iwm_cfg80211_ops = { 525static struct cfg80211_ops iwm_cfg80211_ops = {
504 .change_virtual_intf = iwm_cfg80211_change_iface, 526 .change_virtual_intf = iwm_cfg80211_change_iface,
505 .add_key = iwm_cfg80211_add_key, 527 .add_key = iwm_cfg80211_add_key,
@@ -510,6 +532,8 @@ static struct cfg80211_ops iwm_cfg80211_ops = {
510 .set_wiphy_params = iwm_cfg80211_set_wiphy_params, 532 .set_wiphy_params = iwm_cfg80211_set_wiphy_params,
511 .join_ibss = iwm_cfg80211_join_ibss, 533 .join_ibss = iwm_cfg80211_join_ibss,
512 .leave_ibss = iwm_cfg80211_leave_ibss, 534 .leave_ibss = iwm_cfg80211_leave_ibss,
535 .set_tx_power = iwm_cfg80211_set_txpower,
536 .get_tx_power = iwm_cfg80211_get_txpower,
513}; 537};
514 538
515struct wireless_dev *iwm_wdev_alloc(int sizeof_bus, struct device *dev) 539struct wireless_dev *iwm_wdev_alloc(int sizeof_bus, struct device *dev)
diff --git a/drivers/net/wireless/iwmc3200wifi/iwm.h b/drivers/net/wireless/iwmc3200wifi/iwm.h
index 90b05d999635..4da57f737f27 100644
--- a/drivers/net/wireless/iwmc3200wifi/iwm.h
+++ b/drivers/net/wireless/iwmc3200wifi/iwm.h
@@ -184,10 +184,6 @@ struct iwm_key {
184#define IWM_STATUS_ASSOCIATING 3 184#define IWM_STATUS_ASSOCIATING 3
185#define IWM_STATUS_ASSOCIATED 4 185#define IWM_STATUS_ASSOCIATED 4
186 186
187#define IWM_RADIO_RFKILL_OFF 0
188#define IWM_RADIO_RFKILL_HW 1
189#define IWM_RADIO_RFKILL_SW 2
190
191struct iwm_tx_queue { 187struct iwm_tx_queue {
192 int id; 188 int id;
193 struct sk_buff_head queue; 189 struct sk_buff_head queue;
@@ -221,7 +217,6 @@ struct iwm_priv {
221 struct iwm_conf conf; 217 struct iwm_conf conf;
222 218
223 unsigned long status; 219 unsigned long status;
224 unsigned long radio;
225 220
226 struct list_head pending_notif; 221 struct list_head pending_notif;
227 wait_queue_head_t notif_queue; 222 wait_queue_head_t notif_queue;
@@ -240,6 +235,7 @@ struct iwm_priv {
240 u8 bssid[ETH_ALEN]; 235 u8 bssid[ETH_ALEN];
241 u8 channel; 236 u8 channel;
242 u16 rate; 237 u16 rate;
238 u32 txpower;
243 239
244 struct iwm_sta_info sta_table[IWM_STA_TABLE_NUM]; 240 struct iwm_sta_info sta_table[IWM_STA_TABLE_NUM];
245 struct list_head bss_list; 241 struct list_head bss_list;
@@ -290,7 +286,6 @@ struct iwm_priv {
290 struct timer_list watchdog; 286 struct timer_list watchdog;
291 struct work_struct reset_worker; 287 struct work_struct reset_worker;
292 struct mutex mutex; 288 struct mutex mutex;
293 struct rfkill *rfkill;
294 289
295 char private[0] __attribute__((__aligned__(NETDEV_ALIGN))); 290 char private[0] __attribute__((__aligned__(NETDEV_ALIGN)));
296}; 291};
diff --git a/drivers/net/wireless/iwmc3200wifi/netdev.c b/drivers/net/wireless/iwmc3200wifi/netdev.c
index d4deb4b471e5..e94e96955b99 100644
--- a/drivers/net/wireless/iwmc3200wifi/netdev.c
+++ b/drivers/net/wireless/iwmc3200wifi/netdev.c
@@ -55,23 +55,15 @@
55static int iwm_open(struct net_device *ndev) 55static int iwm_open(struct net_device *ndev)
56{ 56{
57 struct iwm_priv *iwm = ndev_to_iwm(ndev); 57 struct iwm_priv *iwm = ndev_to_iwm(ndev);
58 int ret = 0;
59
60 if (!test_bit(IWM_RADIO_RFKILL_SW, &iwm->radio))
61 ret = iwm_up(iwm);
62 58
63 return ret; 59 return iwm_up(iwm);
64} 60}
65 61
66static int iwm_stop(struct net_device *ndev) 62static int iwm_stop(struct net_device *ndev)
67{ 63{
68 struct iwm_priv *iwm = ndev_to_iwm(ndev); 64 struct iwm_priv *iwm = ndev_to_iwm(ndev);
69 int ret = 0;
70
71 if (!test_bit(IWM_RADIO_RFKILL_SW, &iwm->radio))
72 ret = iwm_down(iwm);
73 65
74 return ret; 66 return iwm_down(iwm);
75} 67}
76 68
77/* 69/*
diff --git a/drivers/net/wireless/iwmc3200wifi/rx.c b/drivers/net/wireless/iwmc3200wifi/rx.c
index 49a8be7c5396..55871da695a9 100644
--- a/drivers/net/wireless/iwmc3200wifi/rx.c
+++ b/drivers/net/wireless/iwmc3200wifi/rx.c
@@ -143,17 +143,18 @@ static int iwm_ntf_init_complete(struct iwm_priv *iwm, u8 *buf,
143 unsigned long buf_size, 143 unsigned long buf_size,
144 struct iwm_wifi_cmd *cmd) 144 struct iwm_wifi_cmd *cmd)
145{ 145{
146 struct wiphy *wiphy = iwm_to_wiphy(iwm);
146 struct iwm_umac_notif_init_complete *init_complete = 147 struct iwm_umac_notif_init_complete *init_complete =
147 (struct iwm_umac_notif_init_complete *)(buf); 148 (struct iwm_umac_notif_init_complete *)(buf);
148 u16 status = le16_to_cpu(init_complete->status); 149 u16 status = le16_to_cpu(init_complete->status);
150 bool blocked = (status == UMAC_NTFY_INIT_COMPLETE_STATUS_ERR);
149 151
150 if (status == UMAC_NTFY_INIT_COMPLETE_STATUS_ERR) { 152 if (blocked)
151 IWM_DBG_NTF(iwm, DBG, "Hardware rf kill is on (radio off)\n"); 153 IWM_DBG_NTF(iwm, DBG, "Hardware rf kill is on (radio off)\n");
152 set_bit(IWM_RADIO_RFKILL_HW, &iwm->radio); 154 else
153 } else {
154 IWM_DBG_NTF(iwm, DBG, "Hardware rf kill is off (radio on)\n"); 155 IWM_DBG_NTF(iwm, DBG, "Hardware rf kill is off (radio on)\n");
155 clear_bit(IWM_RADIO_RFKILL_HW, &iwm->radio); 156
156 } 157 wiphy_rfkill_set_hw_state(wiphy, blocked);
157 158
158 return 0; 159 return 0;
159} 160}
@@ -875,6 +876,7 @@ static int iwm_ntf_statistics(struct iwm_priv *iwm, u8 *buf,
875 /* UMAC passes rate info multiplies by 2 */ 876 /* UMAC passes rate info multiplies by 2 */
876 iwm->rate = max_rate >> 1; 877 iwm->rate = max_rate >> 1;
877 } 878 }
879 iwm->txpower = le32_to_cpu(stats->tx_power);
878 880
879 wstats->status = 0; 881 wstats->status = 0;
880 882
@@ -1015,6 +1017,7 @@ static int iwm_ntf_wifi_if_wrapper(struct iwm_priv *iwm, u8 *buf,
1015static int iwm_ntf_card_state(struct iwm_priv *iwm, u8 *buf, 1017static int iwm_ntf_card_state(struct iwm_priv *iwm, u8 *buf,
1016 unsigned long buf_size, struct iwm_wifi_cmd *cmd) 1018 unsigned long buf_size, struct iwm_wifi_cmd *cmd)
1017{ 1019{
1020 struct wiphy *wiphy = iwm_to_wiphy(iwm);
1018 struct iwm_lmac_card_state *state = (struct iwm_lmac_card_state *) 1021 struct iwm_lmac_card_state *state = (struct iwm_lmac_card_state *)
1019 (buf + sizeof(struct iwm_umac_wifi_in_hdr)); 1022 (buf + sizeof(struct iwm_umac_wifi_in_hdr));
1020 u32 flags = le32_to_cpu(state->flags); 1023 u32 flags = le32_to_cpu(state->flags);
@@ -1023,10 +1026,7 @@ static int iwm_ntf_card_state(struct iwm_priv *iwm, u8 *buf,
1023 flags & IWM_CARD_STATE_HW_DISABLED ? "ON" : "OFF", 1026 flags & IWM_CARD_STATE_HW_DISABLED ? "ON" : "OFF",
1024 flags & IWM_CARD_STATE_CTKILL_DISABLED ? "ON" : "OFF"); 1027 flags & IWM_CARD_STATE_CTKILL_DISABLED ? "ON" : "OFF");
1025 1028
1026 if (flags & IWM_CARD_STATE_HW_DISABLED) 1029 wiphy_rfkill_set_hw_state(wiphy, flags & IWM_CARD_STATE_HW_DISABLED);
1027 set_bit(IWM_RADIO_RFKILL_HW, &iwm->radio);
1028 else
1029 clear_bit(IWM_RADIO_RFKILL_HW, &iwm->radio);
1030 1030
1031 return 0; 1031 return 0;
1032} 1032}
diff --git a/drivers/net/wireless/iwmc3200wifi/sdio.c b/drivers/net/wireless/iwmc3200wifi/sdio.c
index 916681837fd2..b93f620ee4f1 100644
--- a/drivers/net/wireless/iwmc3200wifi/sdio.c
+++ b/drivers/net/wireless/iwmc3200wifi/sdio.c
@@ -506,11 +506,7 @@ static struct sdio_driver iwm_sdio_driver = {
506 506
507static int __init iwm_sdio_init_module(void) 507static int __init iwm_sdio_init_module(void)
508{ 508{
509 int ret; 509 return sdio_register_driver(&iwm_sdio_driver);
510
511 ret = sdio_register_driver(&iwm_sdio_driver);
512
513 return ret;
514} 510}
515 511
516static void __exit iwm_sdio_exit_module(void) 512static void __exit iwm_sdio_exit_module(void)
diff --git a/drivers/net/wireless/iwmc3200wifi/wext.c b/drivers/net/wireless/iwmc3200wifi/wext.c
index 3062f37bbe95..973457383c11 100644
--- a/drivers/net/wireless/iwmc3200wifi/wext.c
+++ b/drivers/net/wireless/iwmc3200wifi/wext.c
@@ -452,8 +452,8 @@ static const iw_handler iwm_handlers[] =
452 (iw_handler) cfg80211_wext_giwrts, /* SIOCGIWRTS */ 452 (iw_handler) cfg80211_wext_giwrts, /* SIOCGIWRTS */
453 (iw_handler) cfg80211_wext_siwfrag, /* SIOCSIWFRAG */ 453 (iw_handler) cfg80211_wext_siwfrag, /* SIOCSIWFRAG */
454 (iw_handler) cfg80211_wext_giwfrag, /* SIOCGIWFRAG */ 454 (iw_handler) cfg80211_wext_giwfrag, /* SIOCGIWFRAG */
455 (iw_handler) NULL, /* SIOCSIWTXPOW */ 455 (iw_handler) cfg80211_wext_siwtxpower, /* SIOCSIWTXPOW */
456 (iw_handler) NULL, /* SIOCGIWTXPOW */ 456 (iw_handler) cfg80211_wext_giwtxpower, /* SIOCGIWTXPOW */
457 (iw_handler) NULL, /* SIOCSIWRETRY */ 457 (iw_handler) NULL, /* SIOCSIWRETRY */
458 (iw_handler) NULL, /* SIOCGIWRETRY */ 458 (iw_handler) NULL, /* SIOCGIWRETRY */
459 (iw_handler) cfg80211_wext_siwencode, /* SIOCSIWENCODE */ 459 (iw_handler) cfg80211_wext_siwencode, /* SIOCSIWENCODE */