aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2008-08-26 10:58:00 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-29 16:24:11 -0400
commit15635744484d4255778fc641261be27179c51f9a (patch)
tree0f00163e77259aae1ab1636801f4a6842cb8fc77
parentf745ba03a12a1c4b98a88a96ab39d9b58ac677a2 (diff)
rfkill: rename rfkill_mutex to rfkill_global_mutex
rfkill_mutex and rfkill->mutex are too easy to confuse with each other. Rename rfkill_mutex to rfkill_global_mutex, so that they are easier to tell apart with just one glance. Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Acked-by: Ivo van Doorn <IvDoorn@gmail.com> Cc: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--net/rfkill/rfkill.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 910699c4e04f..d5735799ccd9 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -37,7 +37,7 @@ MODULE_DESCRIPTION("RF switch support");
37MODULE_LICENSE("GPL"); 37MODULE_LICENSE("GPL");
38 38
39static LIST_HEAD(rfkill_list); /* list of registered rf switches */ 39static LIST_HEAD(rfkill_list); /* list of registered rf switches */
40static DEFINE_MUTEX(rfkill_mutex); 40static DEFINE_MUTEX(rfkill_global_mutex);
41 41
42static unsigned int rfkill_default_state = RFKILL_STATE_UNBLOCKED; 42static unsigned int rfkill_default_state = RFKILL_STATE_UNBLOCKED;
43module_param_named(default_state, rfkill_default_state, uint, 0444); 43module_param_named(default_state, rfkill_default_state, uint, 0444);
@@ -234,7 +234,7 @@ static int rfkill_toggle_radio(struct rfkill *rfkill,
234 * unless a specific switch is claimed by userspace (in which case, 234 * unless a specific switch is claimed by userspace (in which case,
235 * that switch is left alone) or suspended. 235 * that switch is left alone) or suspended.
236 * 236 *
237 * Caller must have acquired rfkill_mutex. 237 * Caller must have acquired rfkill_global_mutex.
238 */ 238 */
239static void __rfkill_switch_all(const enum rfkill_type type, 239static void __rfkill_switch_all(const enum rfkill_type type,
240 const enum rfkill_state state) 240 const enum rfkill_state state)
@@ -263,14 +263,14 @@ static void __rfkill_switch_all(const enum rfkill_type type,
263 * @type: type of interfaces to be affected 263 * @type: type of interfaces to be affected
264 * @state: the new state 264 * @state: the new state
265 * 265 *
266 * Acquires rfkill_mutex and calls __rfkill_switch_all(@type, @state). 266 * Acquires rfkill_global_mutex and calls __rfkill_switch_all(@type, @state).
267 * Please refer to __rfkill_switch_all() for details. 267 * Please refer to __rfkill_switch_all() for details.
268 */ 268 */
269void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state) 269void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state)
270{ 270{
271 mutex_lock(&rfkill_mutex); 271 mutex_lock(&rfkill_global_mutex);
272 __rfkill_switch_all(type, state); 272 __rfkill_switch_all(type, state);
273 mutex_unlock(&rfkill_mutex); 273 mutex_unlock(&rfkill_global_mutex);
274} 274}
275EXPORT_SYMBOL(rfkill_switch_all); 275EXPORT_SYMBOL(rfkill_switch_all);
276 276
@@ -278,7 +278,7 @@ EXPORT_SYMBOL(rfkill_switch_all);
278 * rfkill_epo - emergency power off all transmitters 278 * rfkill_epo - emergency power off all transmitters
279 * 279 *
280 * This kicks all non-suspended rfkill devices to RFKILL_STATE_SOFT_BLOCKED, 280 * This kicks all non-suspended rfkill devices to RFKILL_STATE_SOFT_BLOCKED,
281 * ignoring everything in its path but rfkill_mutex and rfkill->mutex. 281 * ignoring everything in its path but rfkill_global_mutex and rfkill->mutex.
282 * 282 *
283 * The global state before the EPO is saved and can be restored later 283 * The global state before the EPO is saved and can be restored later
284 * using rfkill_restore_states(). 284 * using rfkill_restore_states().
@@ -288,7 +288,8 @@ void rfkill_epo(void)
288 struct rfkill *rfkill; 288 struct rfkill *rfkill;
289 int i; 289 int i;
290 290
291 mutex_lock(&rfkill_mutex); 291 mutex_lock(&rfkill_global_mutex);
292
292 list_for_each_entry(rfkill, &rfkill_list, node) { 293 list_for_each_entry(rfkill, &rfkill_list, node) {
293 mutex_lock(&rfkill->mutex); 294 mutex_lock(&rfkill->mutex);
294 rfkill_toggle_radio(rfkill, RFKILL_STATE_SOFT_BLOCKED, 1); 295 rfkill_toggle_radio(rfkill, RFKILL_STATE_SOFT_BLOCKED, 1);
@@ -300,7 +301,7 @@ void rfkill_epo(void)
300 rfkill_global_states[i].current_state = 301 rfkill_global_states[i].current_state =
301 RFKILL_STATE_SOFT_BLOCKED; 302 RFKILL_STATE_SOFT_BLOCKED;
302 } 303 }
303 mutex_unlock(&rfkill_mutex); 304 mutex_unlock(&rfkill_global_mutex);
304} 305}
305EXPORT_SYMBOL_GPL(rfkill_epo); 306EXPORT_SYMBOL_GPL(rfkill_epo);
306 307
@@ -315,10 +316,11 @@ void rfkill_restore_states(void)
315{ 316{
316 int i; 317 int i;
317 318
318 mutex_lock(&rfkill_mutex); 319 mutex_lock(&rfkill_global_mutex);
320
319 for (i = 0; i < RFKILL_TYPE_MAX; i++) 321 for (i = 0; i < RFKILL_TYPE_MAX; i++)
320 __rfkill_switch_all(i, rfkill_global_states[i].default_state); 322 __rfkill_switch_all(i, rfkill_global_states[i].default_state);
321 mutex_unlock(&rfkill_mutex); 323 mutex_unlock(&rfkill_global_mutex);
322} 324}
323EXPORT_SYMBOL_GPL(rfkill_restore_states); 325EXPORT_SYMBOL_GPL(rfkill_restore_states);
324 326
@@ -471,7 +473,7 @@ static ssize_t rfkill_claim_store(struct device *dev,
471 * Take the global lock to make sure the kernel is not in 473 * Take the global lock to make sure the kernel is not in
472 * the middle of rfkill_switch_all 474 * the middle of rfkill_switch_all
473 */ 475 */
474 error = mutex_lock_interruptible(&rfkill_mutex); 476 error = mutex_lock_interruptible(&rfkill_global_mutex);
475 if (error) 477 if (error)
476 return error; 478 return error;
477 479
@@ -486,7 +488,7 @@ static ssize_t rfkill_claim_store(struct device *dev,
486 rfkill->user_claim = claim; 488 rfkill->user_claim = claim;
487 } 489 }
488 490
489 mutex_unlock(&rfkill_mutex); 491 mutex_unlock(&rfkill_global_mutex);
490 492
491 return error ? error : count; 493 return error ? error : count;
492} 494}
@@ -621,7 +623,7 @@ static int rfkill_add_switch(struct rfkill *rfkill)
621{ 623{
622 int error; 624 int error;
623 625
624 mutex_lock(&rfkill_mutex); 626 mutex_lock(&rfkill_global_mutex);
625 627
626 error = rfkill_check_duplicity(rfkill); 628 error = rfkill_check_duplicity(rfkill);
627 if (error < 0) 629 if (error < 0)
@@ -642,16 +644,16 @@ static int rfkill_add_switch(struct rfkill *rfkill)
642 644
643 error = 0; 645 error = 0;
644unlock_out: 646unlock_out:
645 mutex_unlock(&rfkill_mutex); 647 mutex_unlock(&rfkill_global_mutex);
646 648
647 return error; 649 return error;
648} 650}
649 651
650static void rfkill_remove_switch(struct rfkill *rfkill) 652static void rfkill_remove_switch(struct rfkill *rfkill)
651{ 653{
652 mutex_lock(&rfkill_mutex); 654 mutex_lock(&rfkill_global_mutex);
653 list_del_init(&rfkill->node); 655 list_del_init(&rfkill->node);
654 mutex_unlock(&rfkill_mutex); 656 mutex_unlock(&rfkill_global_mutex);
655 657
656 mutex_lock(&rfkill->mutex); 658 mutex_lock(&rfkill->mutex);
657 rfkill_toggle_radio(rfkill, RFKILL_STATE_SOFT_BLOCKED, 1); 659 rfkill_toggle_radio(rfkill, RFKILL_STATE_SOFT_BLOCKED, 1);
@@ -840,7 +842,7 @@ int rfkill_set_default(enum rfkill_type type, enum rfkill_state state)
840 "parameter to rfkill_set_default\n", state, type)) 842 "parameter to rfkill_set_default\n", state, type))
841 return -EINVAL; 843 return -EINVAL;
842 844
843 mutex_lock(&rfkill_mutex); 845 mutex_lock(&rfkill_global_mutex);
844 846
845 if (!test_and_set_bit(type, rfkill_states_lockdflt)) { 847 if (!test_and_set_bit(type, rfkill_states_lockdflt)) {
846 rfkill_global_states[type].default_state = state; 848 rfkill_global_states[type].default_state = state;
@@ -848,7 +850,7 @@ int rfkill_set_default(enum rfkill_type type, enum rfkill_state state)
848 } else 850 } else
849 error = -EPERM; 851 error = -EPERM;
850 852
851 mutex_unlock(&rfkill_mutex); 853 mutex_unlock(&rfkill_global_mutex);
852 return error; 854 return error;
853} 855}
854EXPORT_SYMBOL_GPL(rfkill_set_default); 856EXPORT_SYMBOL_GPL(rfkill_set_default);