Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 66878
b: refs/heads/master
c: 20405c0
h: refs/heads/master
v: v3
  • Loading branch information
Michael Buesch authored and David S. Miller committed Oct 10, 2007
1 parent ce4fb5e commit fb5fe05
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 135900c182c321a4888ec496b014e6707272faca
refs/heads/master: 20405c08412a4d89357870d7220f9fb1c458b286
3 changes: 3 additions & 0 deletions trunk/include/linux/rfkill.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ enum rfkill_state {
* @type: Radio type which the button controls, the value stored
* here should be a value from enum rfkill_type.
* @state: State of the switch (on/off).
* @user_claim_unsupported: Whether the hardware supports exclusive
* RF-kill control by userspace. Set this before registering.
* @user_claim: Set when the switch is controlled exlusively by userspace.
* @mutex: Guards switch state transitions
* @data: Pointer to the RF button drivers private data which will be
Expand All @@ -69,6 +71,7 @@ struct rfkill {
enum rfkill_type type;

enum rfkill_state state;
bool user_claim_unsupported;
bool user_claim;

struct mutex mutex;
Expand Down
7 changes: 6 additions & 1 deletion trunk/net/rfkill/rfkill.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,21 @@ static ssize_t rfkill_claim_store(struct device *dev,
if (error)
return error;

if (rfkill->user_claim_unsupported) {
error = -EOPNOTSUPP;
goto out_unlock;
}
if (rfkill->user_claim != claim) {
if (!claim)
rfkill_toggle_radio(rfkill,
rfkill_states[rfkill->type]);
rfkill->user_claim = claim;
}

out_unlock:
mutex_unlock(&rfkill_mutex);

return count;
return error ? error : count;
}

static struct device_attribute rfkill_dev_attrs[] = {
Expand Down

0 comments on commit fb5fe05

Please sign in to comment.