aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-06-29 01:57:58 -0400
committerDavid S. Miller <davem@davemloft.net>2008-06-29 01:57:58 -0400
commit28f49d8fec19833672a6a813bfde0068fee50bc9 (patch)
tree6905c5cabc063e44b891ae0af5b5d7cce69e6e71 /drivers/net/wireless/iwlwifi
parent332e4af80d1214fbf0e263e1408fc7c5b64ecdd6 (diff)
parentff28bd94e307c67abb1bccda5d3a9018bd798e08 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/Kconfig2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rfkill.c18
2 files changed, 16 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig
index a382c0078923..d7ea32f39694 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -8,7 +8,7 @@ config IWLCORE
8 select MAC80211_LEDS if IWLWIFI_LEDS 8 select MAC80211_LEDS if IWLWIFI_LEDS
9 select LEDS_CLASS if IWLWIFI_LEDS 9 select LEDS_CLASS if IWLWIFI_LEDS
10 select RFKILL if IWLWIFI_RFKILL 10 select RFKILL if IWLWIFI_RFKILL
11 select RFKILL_INPUT if IWLWIFI_RFKILL 11 select RFKILL_INPUT if (IWLWIFI_RFKILL && INPUT)
12 12
13config IWLWIFI_LEDS 13config IWLWIFI_LEDS
14 bool 14 bool
diff --git a/drivers/net/wireless/iwlwifi/iwl-rfkill.c b/drivers/net/wireless/iwlwifi/iwl-rfkill.c
index 5f098747cf95..ffefbb487e12 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rfkill.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rfkill.c
@@ -54,17 +54,20 @@ static int iwl_rfkill_soft_rf_kill(void *data, enum rfkill_state state)
54 mutex_lock(&priv->mutex); 54 mutex_lock(&priv->mutex);
55 55
56 switch (state) { 56 switch (state) {
57 case RFKILL_STATE_ON: 57 case RFKILL_STATE_UNBLOCKED:
58 iwl_radio_kill_sw_enable_radio(priv); 58 iwl_radio_kill_sw_enable_radio(priv);
59 /* if HW rf-kill is set dont allow ON state */ 59 /* if HW rf-kill is set dont allow ON state */
60 if (iwl_is_rfkill(priv)) 60 if (iwl_is_rfkill(priv))
61 err = -EBUSY; 61 err = -EBUSY;
62 break; 62 break;
63 case RFKILL_STATE_OFF: 63 case RFKILL_STATE_SOFT_BLOCKED:
64 iwl_radio_kill_sw_disable_radio(priv); 64 iwl_radio_kill_sw_disable_radio(priv);
65 if (!iwl_is_rfkill(priv)) 65 if (!iwl_is_rfkill(priv))
66 err = -EBUSY; 66 err = -EBUSY;
67 break; 67 break;
68 default:
69 IWL_WARNING("we recieved unexpected RFKILL state %d\n", state);
70 break;
68 } 71 }
69 mutex_unlock(&priv->mutex); 72 mutex_unlock(&priv->mutex);
70 73
@@ -95,6 +98,7 @@ int iwl_rfkill_init(struct iwl_priv *priv)
95 priv->rfkill_mngr.rfkill->dev.class->suspend = NULL; 98 priv->rfkill_mngr.rfkill->dev.class->suspend = NULL;
96 priv->rfkill_mngr.rfkill->dev.class->resume = NULL; 99 priv->rfkill_mngr.rfkill->dev.class->resume = NULL;
97 100
101#if defined(CONFIG_RFKILL_INPUT) || defined(CONFIG_RFKILL_INPUT_MODULE)
98 priv->rfkill_mngr.input_dev = input_allocate_device(); 102 priv->rfkill_mngr.input_dev = input_allocate_device();
99 if (!priv->rfkill_mngr.input_dev) { 103 if (!priv->rfkill_mngr.input_dev) {
100 IWL_ERROR("Unable to allocate rfkill input device.\n"); 104 IWL_ERROR("Unable to allocate rfkill input device.\n");
@@ -109,6 +113,7 @@ int iwl_rfkill_init(struct iwl_priv *priv)
109 priv->rfkill_mngr.input_dev->dev.parent = device; 113 priv->rfkill_mngr.input_dev->dev.parent = device;
110 priv->rfkill_mngr.input_dev->evbit[0] = BIT(EV_KEY); 114 priv->rfkill_mngr.input_dev->evbit[0] = BIT(EV_KEY);
111 set_bit(KEY_WLAN, priv->rfkill_mngr.input_dev->keybit); 115 set_bit(KEY_WLAN, priv->rfkill_mngr.input_dev->keybit);
116#endif
112 117
113 ret = rfkill_register(priv->rfkill_mngr.rfkill); 118 ret = rfkill_register(priv->rfkill_mngr.rfkill);
114 if (ret) { 119 if (ret) {
@@ -116,11 +121,13 @@ int iwl_rfkill_init(struct iwl_priv *priv)
116 goto free_input_dev; 121 goto free_input_dev;
117 } 122 }
118 123
124#if defined(CONFIG_RFKILL_INPUT) || defined(CONFIG_RFKILL_INPUT_MODULE)
119 ret = input_register_device(priv->rfkill_mngr.input_dev); 125 ret = input_register_device(priv->rfkill_mngr.input_dev);
120 if (ret) { 126 if (ret) {
121 IWL_ERROR("Unable to register rfkill input device: %d\n", ret); 127 IWL_ERROR("Unable to register rfkill input device: %d\n", ret);
122 goto unregister_rfkill; 128 goto unregister_rfkill;
123 } 129 }
130#endif
124 131
125 IWL_DEBUG_RF_KILL("RFKILL initialization complete.\n"); 132 IWL_DEBUG_RF_KILL("RFKILL initialization complete.\n");
126 return ret; 133 return ret;
@@ -130,8 +137,10 @@ unregister_rfkill:
130 priv->rfkill_mngr.rfkill = NULL; 137 priv->rfkill_mngr.rfkill = NULL;
131 138
132free_input_dev: 139free_input_dev:
140#if defined(CONFIG_RFKILL_INPUT) || defined(CONFIG_RFKILL_INPUT_MODULE)
133 input_free_device(priv->rfkill_mngr.input_dev); 141 input_free_device(priv->rfkill_mngr.input_dev);
134 priv->rfkill_mngr.input_dev = NULL; 142 priv->rfkill_mngr.input_dev = NULL;
143#endif
135 144
136freed_rfkill: 145freed_rfkill:
137 if (priv->rfkill_mngr.rfkill != NULL) 146 if (priv->rfkill_mngr.rfkill != NULL)
@@ -147,13 +156,16 @@ EXPORT_SYMBOL(iwl_rfkill_init);
147void iwl_rfkill_unregister(struct iwl_priv *priv) 156void iwl_rfkill_unregister(struct iwl_priv *priv)
148{ 157{
149 158
159#if defined(CONFIG_RFKILL_INPUT) || defined(CONFIG_RFKILL_INPUT_MODULE)
150 if (priv->rfkill_mngr.input_dev) 160 if (priv->rfkill_mngr.input_dev)
151 input_unregister_device(priv->rfkill_mngr.input_dev); 161 input_unregister_device(priv->rfkill_mngr.input_dev);
162 input_free_device(priv->rfkill_mngr.input_dev);
163 priv->rfkill_mngr.input_dev = NULL;
164#endif
152 165
153 if (priv->rfkill_mngr.rfkill) 166 if (priv->rfkill_mngr.rfkill)
154 rfkill_unregister(priv->rfkill_mngr.rfkill); 167 rfkill_unregister(priv->rfkill_mngr.rfkill);
155 168
156 priv->rfkill_mngr.input_dev = NULL;
157 priv->rfkill_mngr.rfkill = NULL; 169 priv->rfkill_mngr.rfkill = NULL;
158} 170}
159EXPORT_SYMBOL(iwl_rfkill_unregister); 171EXPORT_SYMBOL(iwl_rfkill_unregister);