summaryrefslogtreecommitdiff
path: root/net/rfkill
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-03-27 14:14:31 +0100
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:27 -0400
commit621cac85297de5ba655e3430b007dd2e0da91da6 (patch)
tree6193ecf0966094bb744fb4238191bcab03a3cdef /net/rfkill
parentc1c6b14b22af0f85d05a70405dc3fba5de840c7b (diff)
downloadkernel-common-621cac85297de5ba655e3430b007dd2e0da91da6.tar.gz
kernel-common-621cac85297de5ba655e3430b007dd2e0da91da6.tar.bz2
kernel-common-621cac85297de5ba655e3430b007dd2e0da91da6.zip
rfkill: remove user_claim stuff
Almost all drivers do not support user_claim, so remove it completely and always report -EOPNOTSUPP to userspace. Since userspace cannot really drive rfkill _anyway_ (due to the odd restrictions imposed by the documentation) having this code is just pointless. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/rfkill')
-rw-r--r--net/rfkill/rfkill.c45
1 files changed, 3 insertions, 42 deletions
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 3eaa39403c13..df1269c5ca70 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -200,7 +200,7 @@ static void __rfkill_switch_all(const enum rfkill_type type,
rfkill_global_states[type].current_state = state;
list_for_each_entry(rfkill, &rfkill_list, node) {
- if ((!rfkill->user_claim) && (rfkill->type == type)) {
+ if (rfkill->type == type) {
mutex_lock(&rfkill->mutex);
rfkill_toggle_radio(rfkill, state, 0);
mutex_unlock(&rfkill->mutex);
@@ -447,53 +447,14 @@ static ssize_t rfkill_claim_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- struct rfkill *rfkill = to_rfkill(dev);
-
- return sprintf(buf, "%d\n", rfkill->user_claim);
+ return sprintf(buf, "%d\n", 0);
}
static ssize_t rfkill_claim_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct rfkill *rfkill = to_rfkill(dev);
- unsigned long claim_tmp;
- bool claim;
- int error;
-
- if (!capable(CAP_NET_ADMIN))
- return -EPERM;
-
- if (rfkill->user_claim_unsupported)
- return -EOPNOTSUPP;
-
- error = strict_strtoul(buf, 0, &claim_tmp);
- if (error)
- return error;
- claim = !!claim_tmp;
-
- /*
- * Take the global lock to make sure the kernel is not in
- * the middle of rfkill_switch_all
- */
- error = mutex_lock_killable(&rfkill_global_mutex);
- if (error)
- return error;
-
- if (rfkill->user_claim != claim) {
- if (!claim && !rfkill_epo_lock_active) {
- mutex_lock(&rfkill->mutex);
- rfkill_toggle_radio(rfkill,
- rfkill_global_states[rfkill->type].current_state,
- 0);
- mutex_unlock(&rfkill->mutex);
- }
- rfkill->user_claim = claim;
- }
-
- mutex_unlock(&rfkill_global_mutex);
-
- return error ? error : count;
+ return -EOPNOTSUPP;
}
static struct device_attribute rfkill_dev_attrs[] = {