Commit f1b23361 authored by Henrique de Moraes Holschuh's avatar Henrique de Moraes Holschuh Committed by John W. Linville

rfkill: document the rfkill struct locking (v2)

Reorder fields in struct rfkill and add comments to make it clear
which fields are protected by rfkill->mutex.
Signed-off-by: default avatarHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 37f55e9d
...@@ -68,7 +68,8 @@ enum rfkill_state { ...@@ -68,7 +68,8 @@ enum rfkill_state {
* @user_claim_unsupported: Whether the hardware supports exclusive * @user_claim_unsupported: Whether the hardware supports exclusive
* RF-kill control by userspace. Set this before registering. * RF-kill control by userspace. Set this before registering.
* @user_claim: Set when the switch is controlled exlusively by userspace. * @user_claim: Set when the switch is controlled exlusively by userspace.
* @mutex: Guards switch state transitions * @mutex: Guards switch state transitions. It serializes callbacks
* and also protects the state.
* @data: Pointer to the RF button drivers private data which will be * @data: Pointer to the RF button drivers private data which will be
* passed along when toggling radio state. * passed along when toggling radio state.
* @toggle_radio(): Mandatory handler to control state of the radio. * @toggle_radio(): Mandatory handler to control state of the radio.
...@@ -89,12 +90,13 @@ struct rfkill { ...@@ -89,12 +90,13 @@ struct rfkill {
const char *name; const char *name;
enum rfkill_type type; enum rfkill_type type;
enum rfkill_state state;
bool user_claim_unsupported; bool user_claim_unsupported;
bool user_claim; bool user_claim;
/* the mutex serializes callbacks and also protects
* the state */
struct mutex mutex; struct mutex mutex;
enum rfkill_state state;
void *data; void *data;
int (*toggle_radio)(void *data, enum rfkill_state state); int (*toggle_radio)(void *data, enum rfkill_state state);
int (*get_state)(void *data, enum rfkill_state *state); int (*get_state)(void *data, enum rfkill_state *state);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment