diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2008-10-09 17:15:30 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-10-31 19:00:09 -0400 |
commit | 68d2413bec7e1d97e906eafb05e78d925a5ca128 (patch) | |
tree | 8282f58381f95108bf891739a866bbe089bb4957 /net/rfkill | |
parent | cf4b4aab552f5f658ed400dd0cd41f9ac8aac7c1 (diff) |
rfkill: export global states to rfkill-input
Export the the global switch states to rfkill-input. This is needed to
properly implement KEY_* handling without disregarding the initial state.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: 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-input.h | 1 | ||||
-rw-r--r-- | net/rfkill/rfkill.c | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/net/rfkill/rfkill-input.h b/net/rfkill/rfkill-input.h index bbfa646157c6..d1e03e85cbed 100644 --- a/net/rfkill/rfkill-input.h +++ b/net/rfkill/rfkill-input.h | |||
@@ -14,5 +14,6 @@ | |||
14 | void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state); | 14 | void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state); |
15 | void rfkill_epo(void); | 15 | void rfkill_epo(void); |
16 | void rfkill_restore_states(void); | 16 | void rfkill_restore_states(void); |
17 | enum rfkill_state rfkill_get_global_state(const enum rfkill_type type); | ||
17 | 18 | ||
18 | #endif /* __RFKILL_INPUT_H */ | 19 | #endif /* __RFKILL_INPUT_H */ |
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c index 08be968f578d..fdf87d2ab25e 100644 --- a/net/rfkill/rfkill.c +++ b/net/rfkill/rfkill.c | |||
@@ -324,6 +324,19 @@ void rfkill_restore_states(void) | |||
324 | EXPORT_SYMBOL_GPL(rfkill_restore_states); | 324 | EXPORT_SYMBOL_GPL(rfkill_restore_states); |
325 | 325 | ||
326 | /** | 326 | /** |
327 | * rfkill_get_global_state - returns global state for a type | ||
328 | * @type: the type to get the global state of | ||
329 | * | ||
330 | * Returns the current global state for a given wireless | ||
331 | * device type. | ||
332 | */ | ||
333 | enum rfkill_state rfkill_get_global_state(const enum rfkill_type type) | ||
334 | { | ||
335 | return rfkill_global_states[type].current_state; | ||
336 | } | ||
337 | EXPORT_SYMBOL_GPL(rfkill_get_global_state); | ||
338 | |||
339 | /** | ||
327 | * rfkill_force_state - Force the internal rfkill radio state | 340 | * rfkill_force_state - Force the internal rfkill radio state |
328 | * @rfkill: pointer to the rfkill class to modify. | 341 | * @rfkill: pointer to the rfkill class to modify. |
329 | * @state: the current radio state the class should be forced to. | 342 | * @state: the current radio state the class should be forced to. |
@@ -834,6 +847,7 @@ int rfkill_set_default(enum rfkill_type type, enum rfkill_state state) | |||
834 | 847 | ||
835 | if (!test_and_set_bit(type, rfkill_states_lockdflt)) { | 848 | if (!test_and_set_bit(type, rfkill_states_lockdflt)) { |
836 | rfkill_global_states[type].default_state = state; | 849 | rfkill_global_states[type].default_state = state; |
850 | rfkill_global_states[type].current_state = state; | ||
837 | error = 0; | 851 | error = 0; |
838 | } else | 852 | } else |
839 | error = -EPERM; | 853 | error = -EPERM; |