aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorian@mickler.org <florian@mickler.org>2010-03-13 07:31:05 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-03-19 15:48:25 -0400
commit819bfecc4fc6b6e5a793f719a45b7146ce423b79 (patch)
treea7e646bf8032c29d7a1187301cdfa0d5b726473b
parent09a08cff3d13315c948e6aee5cf912f8f1db54e7 (diff)
rename new rfkill sysfs knobs
This patch renames the (never officially released) sysfs-knobs "blocked_hw" and "blocked_sw" to "hard" and "soft", as the hardware vs software conotation is misleading. It also gets rid of not needed locks around u32-read-access. Signed-off-by: Florian Mickler <florian@mickler.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--Documentation/ABI/stable/sysfs-class-rfkill10
-rw-r--r--net/rfkill/core.c35
2 files changed, 13 insertions, 32 deletions
diff --git a/Documentation/ABI/stable/sysfs-class-rfkill b/Documentation/ABI/stable/sysfs-class-rfkill
index b91c3f37453a..097f522c33bb 100644
--- a/Documentation/ABI/stable/sysfs-class-rfkill
+++ b/Documentation/ABI/stable/sysfs-class-rfkill
@@ -4,7 +4,7 @@ For details to this subsystem look at Documentation/rfkill.txt.
4 4
5For the deprecated /sys/class/rfkill/*/state and 5For the deprecated /sys/class/rfkill/*/state and
6/sys/class/rfkill/*/claim knobs of this interface look in 6/sys/class/rfkill/*/claim knobs of this interface look in
7Documentation/ABI/obsolte/sysfs-class-rfkill. 7Documentation/ABI/obsolete/sysfs-class-rfkill.
8 8
9What: /sys/class/rfkill 9What: /sys/class/rfkill
10Date: 09-Jul-2007 10Date: 09-Jul-2007
@@ -42,8 +42,8 @@ Values: A numeric value.
42 1: true 42 1: true
43 43
44 44
45What: /sys/class/rfkill/rfkill[0-9]+/blocked_hw 45What: /sys/class/rfkill/rfkill[0-9]+/hard
46Date: 23-Feb-2010 46Date: 12-March-2010
47KernelVersion v2.6.34 47KernelVersion v2.6.34
48Contact: linux-wireless@vger.kernel.org 48Contact: linux-wireless@vger.kernel.org
49Description: Current hardblock state. This file is read only. 49Description: Current hardblock state. This file is read only.
@@ -55,8 +55,8 @@ Values: A numeric value.
55 the driver's control. 55 the driver's control.
56 56
57 57
58What: /sys/class/rfkill/rfkill[0-9]+/blocked_sw 58What: /sys/class/rfkill/rfkill[0-9]+/soft
59Date: 23-Feb-2010 59Date: 12-March-2010
60KernelVersion v2.6.34 60KernelVersion v2.6.34
61Contact: linux-wireless@vger.kernel.org 61Contact: linux-wireless@vger.kernel.org
62Description: Current softblock state. This file is read and write. 62Description: Current softblock state. This file is read and write.
diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index 5f33151d70ae..7ae58b5b5a08 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -628,37 +628,25 @@ static ssize_t rfkill_persistent_show(struct device *dev,
628 return sprintf(buf, "%d\n", rfkill->persistent); 628 return sprintf(buf, "%d\n", rfkill->persistent);
629} 629}
630 630
631static ssize_t rfkill_blocked_hw_show(struct device *dev, 631static ssize_t rfkill_hard_show(struct device *dev,
632 struct device_attribute *attr, 632 struct device_attribute *attr,
633 char *buf) 633 char *buf)
634{ 634{
635 struct rfkill *rfkill = to_rfkill(dev); 635 struct rfkill *rfkill = to_rfkill(dev);
636 unsigned long flags;
637 u32 state;
638 636
639 spin_lock_irqsave(&rfkill->lock, flags); 637 return sprintf(buf, "%d\n", (rfkill->state & RFKILL_BLOCK_HW) ? 1 : 0 );
640 state = rfkill->state;
641 spin_unlock_irqrestore(&rfkill->lock, flags);
642
643 return sprintf(buf, "%d\n", (state & RFKILL_BLOCK_HW) ? 1 : 0 );
644} 638}
645 639
646static ssize_t rfkill_blocked_sw_show(struct device *dev, 640static ssize_t rfkill_soft_show(struct device *dev,
647 struct device_attribute *attr, 641 struct device_attribute *attr,
648 char *buf) 642 char *buf)
649{ 643{
650 struct rfkill *rfkill = to_rfkill(dev); 644 struct rfkill *rfkill = to_rfkill(dev);
651 unsigned long flags;
652 u32 state;
653
654 spin_lock_irqsave(&rfkill->lock, flags);
655 state = rfkill->state;
656 spin_unlock_irqrestore(&rfkill->lock, flags);
657 645
658 return sprintf(buf, "%d\n", (state & RFKILL_BLOCK_SW) ? 1 : 0 ); 646 return sprintf(buf, "%d\n", (rfkill->state & RFKILL_BLOCK_SW) ? 1 : 0 );
659} 647}
660 648
661static ssize_t rfkill_blocked_sw_store(struct device *dev, 649static ssize_t rfkill_soft_store(struct device *dev,
662 struct device_attribute *attr, 650 struct device_attribute *attr,
663 const char *buf, size_t count) 651 const char *buf, size_t count)
664{ 652{
@@ -698,14 +686,8 @@ static ssize_t rfkill_state_show(struct device *dev,
698 char *buf) 686 char *buf)
699{ 687{
700 struct rfkill *rfkill = to_rfkill(dev); 688 struct rfkill *rfkill = to_rfkill(dev);
701 unsigned long flags;
702 u32 state;
703
704 spin_lock_irqsave(&rfkill->lock, flags);
705 state = rfkill->state;
706 spin_unlock_irqrestore(&rfkill->lock, flags);
707 689
708 return sprintf(buf, "%d\n", user_state_from_blocked(state)); 690 return sprintf(buf, "%d\n", user_state_from_blocked(rfkill->state));
709} 691}
710 692
711static ssize_t rfkill_state_store(struct device *dev, 693static ssize_t rfkill_state_store(struct device *dev,
@@ -755,9 +737,8 @@ static struct device_attribute rfkill_dev_attrs[] = {
755 __ATTR(persistent, S_IRUGO, rfkill_persistent_show, NULL), 737 __ATTR(persistent, S_IRUGO, rfkill_persistent_show, NULL),
756 __ATTR(state, S_IRUGO|S_IWUSR, rfkill_state_show, rfkill_state_store), 738 __ATTR(state, S_IRUGO|S_IWUSR, rfkill_state_show, rfkill_state_store),
757 __ATTR(claim, S_IRUGO|S_IWUSR, rfkill_claim_show, rfkill_claim_store), 739 __ATTR(claim, S_IRUGO|S_IWUSR, rfkill_claim_show, rfkill_claim_store),
758 __ATTR(sw, S_IRUGO|S_IWUSR, rfkill_blocked_sw_show, 740 __ATTR(soft, S_IRUGO|S_IWUSR, rfkill_soft_show, rfkill_soft_store),
759 rfkill_blocked_sw_store), 741 __ATTR(hard, S_IRUGO, rfkill_hard_show, NULL),
760 __ATTR(hw, S_IRUGO, rfkill_blocked_hw_show, NULL),
761 __ATTR_NULL 742 __ATTR_NULL
762}; 743};
763 744