rfkill: export global states to rfkill-input
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Thu, 9 Oct 2008 21:15:30 +0000 (18:15 -0300)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 31 Oct 2008 23:00:09 +0000 (19:00 -0400)
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>
net/rfkill/rfkill-input.h
net/rfkill/rfkill.c

index bbfa646157c63a1668968bf90658f81ac3f976ad..d1e03e85cbed5aecade1f3961d269c98aab10262 100644 (file)
@@ -14,5 +14,6 @@
 void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state);
 void rfkill_epo(void);
 void rfkill_restore_states(void);
+enum rfkill_state rfkill_get_global_state(const enum rfkill_type type);
 
 #endif /* __RFKILL_INPUT_H */
index 08be968f578d20db5973d1b920d0cb162944fc37..fdf87d2ab25e358ddf8e5d9aec29e5392a2cf432 100644 (file)
@@ -323,6 +323,19 @@ void rfkill_restore_states(void)
 }
 EXPORT_SYMBOL_GPL(rfkill_restore_states);
 
+/**
+ * rfkill_get_global_state - returns global state for a type
+ * @type: the type to get the global state of
+ *
+ * Returns the current global state for a given wireless
+ * device type.
+ */
+enum rfkill_state rfkill_get_global_state(const enum rfkill_type type)
+{
+       return rfkill_global_states[type].current_state;
+}
+EXPORT_SYMBOL_GPL(rfkill_get_global_state);
+
 /**
  * rfkill_force_state - Force the internal rfkill radio state
  * @rfkill: pointer to the rfkill class to modify.
@@ -834,6 +847,7 @@ int rfkill_set_default(enum rfkill_type type, enum rfkill_state state)
 
        if (!test_and_set_bit(type, rfkill_states_lockdflt)) {
                rfkill_global_states[type].default_state = state;
+               rfkill_global_states[type].current_state = state;
                error = 0;
        } else
                error = -EPERM;