diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-rfkill.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-rfkill.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-rfkill.c b/drivers/net/wireless/iwlwifi/iwl-rfkill.c index 308d69b18404..8f38c24491cd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rfkill.c +++ b/drivers/net/wireless/iwlwifi/iwl-rfkill.c | |||
@@ -75,8 +75,10 @@ int iwl_rfkill_init(struct iwl_priv *priv) | |||
75 | 75 | ||
76 | BUG_ON(device == NULL); | 76 | BUG_ON(device == NULL); |
77 | 77 | ||
78 | IWL_DEBUG_RF_KILL("Initializing RFKILL.\n"); | ||
78 | priv->rfkill_mngr.rfkill = rfkill_allocate(device, RFKILL_TYPE_WLAN); | 79 | priv->rfkill_mngr.rfkill = rfkill_allocate(device, RFKILL_TYPE_WLAN); |
79 | if (!priv->rfkill_mngr.rfkill) { | 80 | if (!priv->rfkill_mngr.rfkill) { |
81 | IWL_ERROR("Unable to allocate rfkill device.\n"); | ||
80 | ret = -ENOMEM; | 82 | ret = -ENOMEM; |
81 | goto error; | 83 | goto error; |
82 | } | 84 | } |
@@ -92,6 +94,7 @@ int iwl_rfkill_init(struct iwl_priv *priv) | |||
92 | 94 | ||
93 | priv->rfkill_mngr.input_dev = input_allocate_device(); | 95 | priv->rfkill_mngr.input_dev = input_allocate_device(); |
94 | if (!priv->rfkill_mngr.input_dev) { | 96 | if (!priv->rfkill_mngr.input_dev) { |
97 | IWL_ERROR("Unable to allocate rfkill input device.\n"); | ||
95 | ret = -ENOMEM; | 98 | ret = -ENOMEM; |
96 | goto freed_rfkill; | 99 | goto freed_rfkill; |
97 | } | 100 | } |
@@ -105,27 +108,35 @@ int iwl_rfkill_init(struct iwl_priv *priv) | |||
105 | set_bit(KEY_WLAN, priv->rfkill_mngr.input_dev->keybit); | 108 | set_bit(KEY_WLAN, priv->rfkill_mngr.input_dev->keybit); |
106 | 109 | ||
107 | ret = rfkill_register(priv->rfkill_mngr.rfkill); | 110 | ret = rfkill_register(priv->rfkill_mngr.rfkill); |
108 | if (ret) | 111 | if (ret) { |
112 | IWL_ERROR("Unable to register rfkill: %d\n", ret); | ||
109 | goto free_input_dev; | 113 | goto free_input_dev; |
114 | } | ||
110 | 115 | ||
111 | ret = input_register_device(priv->rfkill_mngr.input_dev); | 116 | ret = input_register_device(priv->rfkill_mngr.input_dev); |
112 | if (ret) | 117 | if (ret) { |
118 | IWL_ERROR("Unable to register rfkill input device: %d\n", ret); | ||
113 | goto unregister_rfkill; | 119 | goto unregister_rfkill; |
120 | } | ||
114 | 121 | ||
122 | IWL_DEBUG_RF_KILL("RFKILL initialization complete.\n"); | ||
115 | return ret; | 123 | return ret; |
116 | 124 | ||
117 | unregister_rfkill: | 125 | unregister_rfkill: |
118 | rfkill_unregister(priv->rfkill_mngr.rfkill); | 126 | rfkill_unregister(priv->rfkill_mngr.rfkill); |
127 | priv->rfkill_mngr.rfkill = NULL; | ||
119 | 128 | ||
120 | free_input_dev: | 129 | free_input_dev: |
121 | input_free_device(priv->rfkill_mngr.input_dev); | 130 | input_free_device(priv->rfkill_mngr.input_dev); |
122 | priv->rfkill_mngr.input_dev = NULL; | 131 | priv->rfkill_mngr.input_dev = NULL; |
123 | 132 | ||
124 | freed_rfkill: | 133 | freed_rfkill: |
125 | rfkill_free(priv->rfkill_mngr.rfkill); | 134 | if (priv->rfkill_mngr.rfkill != NULL) |
135 | rfkill_free(priv->rfkill_mngr.rfkill); | ||
126 | priv->rfkill_mngr.rfkill = NULL; | 136 | priv->rfkill_mngr.rfkill = NULL; |
127 | 137 | ||
128 | error: | 138 | error: |
139 | IWL_DEBUG_RF_KILL("RFKILL initialization complete.\n"); | ||
129 | return ret; | 140 | return ret; |
130 | } | 141 | } |
131 | EXPORT_SYMBOL(iwl_rfkill_init); | 142 | EXPORT_SYMBOL(iwl_rfkill_init); |
@@ -138,19 +149,11 @@ void iwl_rfkill_unregister(struct iwl_priv *priv) | |||
138 | 149 | ||
139 | if (priv->rfkill_mngr.rfkill) | 150 | if (priv->rfkill_mngr.rfkill) |
140 | rfkill_unregister(priv->rfkill_mngr.rfkill); | 151 | rfkill_unregister(priv->rfkill_mngr.rfkill); |
141 | } | ||
142 | EXPORT_SYMBOL(iwl_rfkill_unregister); | ||
143 | 152 | ||
144 | 153 | priv->rfkill_mngr.input_dev = NULL; | |
145 | void iwl_rfkill_free(struct iwl_priv *priv) | 154 | priv->rfkill_mngr.rfkill = NULL; |
146 | { | ||
147 | if (priv->rfkill_mngr.input_dev) | ||
148 | input_free_device(priv->rfkill_mngr.input_dev); | ||
149 | |||
150 | if (priv->rfkill_mngr.rfkill) | ||
151 | rfkill_free(priv->rfkill_mngr.rfkill); | ||
152 | } | 155 | } |
153 | EXPORT_SYMBOL(iwl_rfkill_free); | 156 | EXPORT_SYMBOL(iwl_rfkill_unregister); |
154 | 157 | ||
155 | /* set rf-kill to the right state. */ | 158 | /* set rf-kill to the right state. */ |
156 | void iwl_rfkill_set_hw_state(struct iwl_priv *priv) | 159 | void iwl_rfkill_set_hw_state(struct iwl_priv *priv) |