From fb5fe05c47ed77cfffec088d17c217bdcaca951c Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Thu, 27 Sep 2007 21:34:23 +0200 Subject: [PATCH] --- yaml --- r: 66878 b: refs/heads/master c: 20405c08412a4d89357870d7220f9fb1c458b286 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/rfkill.h | 3 +++ trunk/net/rfkill/rfkill.c | 7 ++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index dca9fb97cacb..753b277ac8e2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 135900c182c321a4888ec496b014e6707272faca +refs/heads/master: 20405c08412a4d89357870d7220f9fb1c458b286 diff --git a/trunk/include/linux/rfkill.h b/trunk/include/linux/rfkill.h index 26fddea12c25..0ce5e0b52dbd 100644 --- a/trunk/include/linux/rfkill.h +++ b/trunk/include/linux/rfkill.h @@ -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 @@ -69,6 +71,7 @@ struct rfkill { enum rfkill_type type; enum rfkill_state state; + bool user_claim_unsupported; bool user_claim; struct mutex mutex; diff --git a/trunk/net/rfkill/rfkill.c b/trunk/net/rfkill/rfkill.c index a8c5e0b914e4..51d151c0e962 100644 --- a/trunk/net/rfkill/rfkill.c +++ b/trunk/net/rfkill/rfkill.c @@ -190,6 +190,10 @@ 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, @@ -197,9 +201,10 @@ static ssize_t rfkill_claim_store(struct device *dev, rfkill->user_claim = claim; } +out_unlock: mutex_unlock(&rfkill_mutex); - return count; + return error ? error : count; } static struct device_attribute rfkill_dev_attrs[] = {