aboutsummaryrefslogtreecommitdiffstats
path: root/net/rfkill
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2008-06-23 16:22:59 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-06-26 14:21:20 -0400
commite954b0b85b9e737564b8ad9738de5816747b5901 (patch)
tree173e87944006ded011a2db7feac770848277d881 /net/rfkill
parent28f089c18464810ec9e91ee10a89adbb02ad7765 (diff)
rfkill: add parameter to disable radios by default
Currently, radios are always enabled when their rfkill interface is registered. This is not optimal, the safest state for a radio is to be offline unless the user turns it on. Add a module parameter that causes all radios to be disabled when their rfkill interface is registered. The module default is not changed so unless the parameter is used, radios will still be forced to their enabled state when they are registered. The new rfkill module parameter is called "default_state". Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Acked-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/rfkill')
-rw-r--r--net/rfkill/rfkill.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index f95081a4a024..3edc585dcfa6 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -39,6 +39,11 @@ MODULE_LICENSE("GPL");
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_mutex);
41 41
42static unsigned int rfkill_default_state = RFKILL_STATE_ON;
43module_param_named(default_state, rfkill_default_state, uint, 0444);
44MODULE_PARM_DESC(default_state,
45 "Default initial state for all radio types, 0 = radio off");
46
42static enum rfkill_state rfkill_states[RFKILL_TYPE_MAX]; 47static enum rfkill_state rfkill_states[RFKILL_TYPE_MAX];
43 48
44 49
@@ -436,8 +441,12 @@ static int __init rfkill_init(void)
436 int error; 441 int error;
437 int i; 442 int i;
438 443
444 if (rfkill_default_state != RFKILL_STATE_OFF &&
445 rfkill_default_state != RFKILL_STATE_ON)
446 return -EINVAL;
447
439 for (i = 0; i < ARRAY_SIZE(rfkill_states); i++) 448 for (i = 0; i < ARRAY_SIZE(rfkill_states); i++)
440 rfkill_states[i] = RFKILL_STATE_ON; 449 rfkill_states[i] = rfkill_default_state;
441 450
442 error = class_register(&rfkill_class); 451 error = class_register(&rfkill_class);
443 if (error) { 452 if (error) {