aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-rfkill.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-rfkill.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rfkill.c41
1 files changed, 1 insertions, 40 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-rfkill.c b/drivers/net/wireless/iwlwifi/iwl-rfkill.c
index ffefbb487e12..aa9f31eadab2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rfkill.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rfkill.c
@@ -50,7 +50,7 @@ static int iwl_rfkill_soft_rf_kill(void *data, enum rfkill_state state)
50 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 50 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
51 return 0; 51 return 0;
52 52
53 IWL_DEBUG_RF_KILL("we recieved soft RFKILL set to state %d\n", state); 53 IWL_DEBUG_RF_KILL("we received soft RFKILL set to state %d\n", state);
54 mutex_lock(&priv->mutex); 54 mutex_lock(&priv->mutex);
55 55
56 switch (state) { 56 switch (state) {
@@ -98,36 +98,11 @@ int iwl_rfkill_init(struct iwl_priv *priv)
98 priv->rfkill_mngr.rfkill->dev.class->suspend = NULL; 98 priv->rfkill_mngr.rfkill->dev.class->suspend = NULL;
99 priv->rfkill_mngr.rfkill->dev.class->resume = NULL; 99 priv->rfkill_mngr.rfkill->dev.class->resume = NULL;
100 100
101#if defined(CONFIG_RFKILL_INPUT) || defined(CONFIG_RFKILL_INPUT_MODULE)
102 priv->rfkill_mngr.input_dev = input_allocate_device();
103 if (!priv->rfkill_mngr.input_dev) {
104 IWL_ERROR("Unable to allocate rfkill input device.\n");
105 ret = -ENOMEM;
106 goto freed_rfkill;
107 }
108
109 priv->rfkill_mngr.input_dev->name = priv->cfg->name;
110 priv->rfkill_mngr.input_dev->phys = wiphy_name(priv->hw->wiphy);
111 priv->rfkill_mngr.input_dev->id.bustype = BUS_HOST;
112 priv->rfkill_mngr.input_dev->id.vendor = priv->pci_dev->vendor;
113 priv->rfkill_mngr.input_dev->dev.parent = device;
114 priv->rfkill_mngr.input_dev->evbit[0] = BIT(EV_KEY);
115 set_bit(KEY_WLAN, priv->rfkill_mngr.input_dev->keybit);
116#endif
117
118 ret = rfkill_register(priv->rfkill_mngr.rfkill); 101 ret = rfkill_register(priv->rfkill_mngr.rfkill);
119 if (ret) { 102 if (ret) {
120 IWL_ERROR("Unable to register rfkill: %d\n", ret); 103 IWL_ERROR("Unable to register rfkill: %d\n", ret);
121 goto free_input_dev;
122 }
123
124#if defined(CONFIG_RFKILL_INPUT) || defined(CONFIG_RFKILL_INPUT_MODULE)
125 ret = input_register_device(priv->rfkill_mngr.input_dev);
126 if (ret) {
127 IWL_ERROR("Unable to register rfkill input device: %d\n", ret);
128 goto unregister_rfkill; 104 goto unregister_rfkill;
129 } 105 }
130#endif
131 106
132 IWL_DEBUG_RF_KILL("RFKILL initialization complete.\n"); 107 IWL_DEBUG_RF_KILL("RFKILL initialization complete.\n");
133 return ret; 108 return ret;
@@ -136,12 +111,6 @@ unregister_rfkill:
136 rfkill_unregister(priv->rfkill_mngr.rfkill); 111 rfkill_unregister(priv->rfkill_mngr.rfkill);
137 priv->rfkill_mngr.rfkill = NULL; 112 priv->rfkill_mngr.rfkill = NULL;
138 113
139free_input_dev:
140#if defined(CONFIG_RFKILL_INPUT) || defined(CONFIG_RFKILL_INPUT_MODULE)
141 input_free_device(priv->rfkill_mngr.input_dev);
142 priv->rfkill_mngr.input_dev = NULL;
143#endif
144
145freed_rfkill: 114freed_rfkill:
146 if (priv->rfkill_mngr.rfkill != NULL) 115 if (priv->rfkill_mngr.rfkill != NULL)
147 rfkill_free(priv->rfkill_mngr.rfkill); 116 rfkill_free(priv->rfkill_mngr.rfkill);
@@ -156,13 +125,6 @@ EXPORT_SYMBOL(iwl_rfkill_init);
156void iwl_rfkill_unregister(struct iwl_priv *priv) 125void iwl_rfkill_unregister(struct iwl_priv *priv)
157{ 126{
158 127
159#if defined(CONFIG_RFKILL_INPUT) || defined(CONFIG_RFKILL_INPUT_MODULE)
160 if (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
165
166 if (priv->rfkill_mngr.rfkill) 128 if (priv->rfkill_mngr.rfkill)
167 rfkill_unregister(priv->rfkill_mngr.rfkill); 129 rfkill_unregister(priv->rfkill_mngr.rfkill);
168 130
@@ -173,7 +135,6 @@ EXPORT_SYMBOL(iwl_rfkill_unregister);
173/* set rf-kill to the right state. */ 135/* set rf-kill to the right state. */
174void iwl_rfkill_set_hw_state(struct iwl_priv *priv) 136void iwl_rfkill_set_hw_state(struct iwl_priv *priv)
175{ 137{
176
177 if (!priv->rfkill_mngr.rfkill) 138 if (!priv->rfkill_mngr.rfkill)
178 return; 139 return;
179 140