Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=20405c08412a4d89357870d7220f9fb1c458b286
Commit:     20405c08412a4d89357870d7220f9fb1c458b286
Parent:     135900c182c321a4888ec496b014e6707272faca
Author:     Michael Buesch <[EMAIL PROTECTED]>
AuthorDate: Thu Sep 27 21:34:23 2007 +0200
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Oct 10 16:54:11 2007 -0700

    [RFKILL]: Add support for hardware-only rfkill buttons
    
    Buttons that work directly on hardware cannot support
    the "user_claim" functionality. Add a flag to signal
    this and return -EOPNOTSUPP in this case.
    b43 is such a device.
    
    Signed-off-by: Michael Buesch <[EMAIL PROTECTED]>
    Acked-by: Ivo van Doorn <[EMAIL PROTECTED]>
    Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 include/linux/rfkill.h |    3 +++
 net/rfkill/rfkill.c    |    7 ++++++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 26fddea..0ce5e0b 100644
--- a/include/linux/rfkill.h
+++ b/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/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index a8c5e0b..51d151c 100644
--- a/net/rfkill/rfkill.c
+++ b/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[] = {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to