aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-03-27 09:14:31 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:27 -0400
commit621cac85297de5ba655e3430b007dd2e0da91da6 (patch)
tree6193ecf0966094bb744fb4238191bcab03a3cdef /net
parentc1c6b14b22af0f85d05a70405dc3fba5de840c7b (diff)
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')
-rw-r--r--net/rfkill/rfkill.c45
-rw-r--r--net/wimax/op-rfkill.c1
2 files changed, 3 insertions, 43 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,
200 200
201 rfkill_global_states[type].current_state = state; 201 rfkill_global_states[type].current_state = state;
202 list_for_each_entry(rfkill, &rfkill_list, node) { 202 list_for_each_entry(rfkill, &rfkill_list, node) {
203 if ((!rfkill->user_claim) && (rfkill->type == type)) { 203 if (rfkill->type == type) {
204 mutex_lock(&rfkill->mutex); 204 mutex_lock(&rfkill->mutex);
205 rfkill_toggle_radio(rfkill, state, 0); 205 rfkill_toggle_radio(rfkill, state, 0);
206 mutex_unlock(&rfkill->mutex); 206 mutex_unlock(&rfkill->mutex);
@@ -447,53 +447,14 @@ static ssize_t rfkill_claim_show(struct device *dev,
447 struct device_attribute *attr, 447 struct device_attribute *attr,
448 char *buf) 448 char *buf)
449{ 449{
450 struct rfkill *rfkill = to_rfkill(dev); 450 return sprintf(buf, "%d\n", 0);
451
452 return sprintf(buf, "%d\n", rfkill->user_claim);
453} 451}
454 452
455static ssize_t rfkill_claim_store(struct device *dev, 453static ssize_t rfkill_claim_store(struct device *dev,
456 struct device_attribute *attr, 454 struct device_attribute *attr,
457 const char *buf, size_t count) 455 const char *buf, size_t count)
458{ 456{
459 struct rfkill *rfkill = to_rfkill(dev); 457 return -EOPNOTSUPP;
460 unsigned long claim_tmp;
461 bool claim;
462 int error;
463
464 if (!capable(CAP_NET_ADMIN))
465 return -EPERM;
466
467 if (rfkill->user_claim_unsupported)
468 return -EOPNOTSUPP;
469
470 error = strict_strtoul(buf, 0, &claim_tmp);
471 if (error)
472 return error;
473 claim = !!claim_tmp;
474
475 /*
476 * Take the global lock to make sure the kernel is not in
477 * the middle of rfkill_switch_all
478 */
479 error = mutex_lock_killable(&rfkill_global_mutex);
480 if (error)
481 return error;
482
483 if (rfkill->user_claim != claim) {
484 if (!claim && !rfkill_epo_lock_active) {
485 mutex_lock(&rfkill->mutex);
486 rfkill_toggle_radio(rfkill,
487 rfkill_global_states[rfkill->type].current_state,
488 0);
489 mutex_unlock(&rfkill->mutex);
490 }
491 rfkill->user_claim = claim;
492 }
493
494 mutex_unlock(&rfkill_global_mutex);
495
496 return error ? error : count;
497} 458}
498 459
499static struct device_attribute rfkill_dev_attrs[] = { 460static struct device_attribute rfkill_dev_attrs[] = {
diff --git a/net/wimax/op-rfkill.c b/net/wimax/op-rfkill.c
index 870032faece2..a3616e2ccb8a 100644
--- a/net/wimax/op-rfkill.c
+++ b/net/wimax/op-rfkill.c
@@ -364,7 +364,6 @@ int wimax_rfkill_add(struct wimax_dev *wimax_dev)
364 rfkill->state = RFKILL_STATE_UNBLOCKED; 364 rfkill->state = RFKILL_STATE_UNBLOCKED;
365 rfkill->data = wimax_dev; 365 rfkill->data = wimax_dev;
366 rfkill->toggle_radio = wimax_rfkill_toggle_radio; 366 rfkill->toggle_radio = wimax_rfkill_toggle_radio;
367 rfkill->user_claim_unsupported = 1;
368 367
369 /* Initialize the input device for the hw key */ 368 /* Initialize the input device for the hw key */
370 input_dev = input_allocate_device(); 369 input_dev = input_allocate_device();