aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/Kconfig2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rfkill.c11
2 files changed, 11 insertions, 2 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..4624ac7b4980 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rfkill.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rfkill.c
@@ -95,6 +95,7 @@ int iwl_rfkill_init(struct iwl_priv *priv)
95 priv->rfkill_mngr.rfkill->dev.class->suspend = NULL; 95 priv->rfkill_mngr.rfkill->dev.class->suspend = NULL;
96 priv->rfkill_mngr.rfkill->dev.class->resume = NULL; 96 priv->rfkill_mngr.rfkill->dev.class->resume = NULL;
97 97
98#if defined(CONFIG_RFKILL_INPUT) || defined(CONFIG_RFKILL_INPUT_MODULE)
98 priv->rfkill_mngr.input_dev = input_allocate_device(); 99 priv->rfkill_mngr.input_dev = input_allocate_device();
99 if (!priv->rfkill_mngr.input_dev) { 100 if (!priv->rfkill_mngr.input_dev) {
100 IWL_ERROR("Unable to allocate rfkill input device.\n"); 101 IWL_ERROR("Unable to allocate rfkill input device.\n");
@@ -109,6 +110,7 @@ int iwl_rfkill_init(struct iwl_priv *priv)
109 priv->rfkill_mngr.input_dev->dev.parent = device; 110 priv->rfkill_mngr.input_dev->dev.parent = device;
110 priv->rfkill_mngr.input_dev->evbit[0] = BIT(EV_KEY); 111 priv->rfkill_mngr.input_dev->evbit[0] = BIT(EV_KEY);
111 set_bit(KEY_WLAN, priv->rfkill_mngr.input_dev->keybit); 112 set_bit(KEY_WLAN, priv->rfkill_mngr.input_dev->keybit);
113#endif
112 114
113 ret = rfkill_register(priv->rfkill_mngr.rfkill); 115 ret = rfkill_register(priv->rfkill_mngr.rfkill);
114 if (ret) { 116 if (ret) {
@@ -116,11 +118,13 @@ int iwl_rfkill_init(struct iwl_priv *priv)
116 goto free_input_dev; 118 goto free_input_dev;
117 } 119 }
118 120
121#if defined(CONFIG_RFKILL_INPUT) || defined(CONFIG_RFKILL_INPUT_MODULE)
119 ret = input_register_device(priv->rfkill_mngr.input_dev); 122 ret = input_register_device(priv->rfkill_mngr.input_dev);
120 if (ret) { 123 if (ret) {
121 IWL_ERROR("Unable to register rfkill input device: %d\n", ret); 124 IWL_ERROR("Unable to register rfkill input device: %d\n", ret);
122 goto unregister_rfkill; 125 goto unregister_rfkill;
123 } 126 }
127#endif
124 128
125 IWL_DEBUG_RF_KILL("RFKILL initialization complete.\n"); 129 IWL_DEBUG_RF_KILL("RFKILL initialization complete.\n");
126 return ret; 130 return ret;
@@ -130,8 +134,10 @@ unregister_rfkill:
130 priv->rfkill_mngr.rfkill = NULL; 134 priv->rfkill_mngr.rfkill = NULL;
131 135
132free_input_dev: 136free_input_dev:
137#if defined(CONFIG_RFKILL_INPUT) || defined(CONFIG_RFKILL_INPUT_MODULE)
133 input_free_device(priv->rfkill_mngr.input_dev); 138 input_free_device(priv->rfkill_mngr.input_dev);
134 priv->rfkill_mngr.input_dev = NULL; 139 priv->rfkill_mngr.input_dev = NULL;
140#endif
135 141
136freed_rfkill: 142freed_rfkill:
137 if (priv->rfkill_mngr.rfkill != NULL) 143 if (priv->rfkill_mngr.rfkill != NULL)
@@ -147,13 +153,16 @@ EXPORT_SYMBOL(iwl_rfkill_init);
147void iwl_rfkill_unregister(struct iwl_priv *priv) 153void iwl_rfkill_unregister(struct iwl_priv *priv)
148{ 154{
149 155
156#if defined(CONFIG_RFKILL_INPUT) || defined(CONFIG_RFKILL_INPUT_MODULE)
150 if (priv->rfkill_mngr.input_dev) 157 if (priv->rfkill_mngr.input_dev)
151 input_unregister_device(priv->rfkill_mngr.input_dev); 158 input_unregister_device(priv->rfkill_mngr.input_dev);
159 input_free_device(priv->rfkill_mngr.input_dev);
160 priv->rfkill_mngr.input_dev = NULL;
161#endif
152 162
153 if (priv->rfkill_mngr.rfkill) 163 if (priv->rfkill_mngr.rfkill)
154 rfkill_unregister(priv->rfkill_mngr.rfkill); 164 rfkill_unregister(priv->rfkill_mngr.rfkill);
155 165
156 priv->rfkill_mngr.input_dev = NULL;
157 priv->rfkill_mngr.rfkill = NULL; 166 priv->rfkill_mngr.rfkill = NULL;
158} 167}
159EXPORT_SYMBOL(iwl_rfkill_unregister); 168EXPORT_SYMBOL(iwl_rfkill_unregister);