diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 00:04:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 00:04:44 -0400 |
commit | f8965467f366fd18f01feafb5db10512d7b4422c (patch) | |
tree | 3706a9cd779859271ca61b85c63a1bc3f82d626e /net/rfkill/core.c | |
parent | a26272e5200765691e67d6780e52b32498fdb659 (diff) | |
parent | 2ec8c6bb5d8f3a62a79f463525054bae1e3d4487 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1674 commits)
qlcnic: adding co maintainer
ixgbe: add support for active DA cables
ixgbe: dcb, do not tag tc_prio_control frames
ixgbe: fix ixgbe_tx_is_paused logic
ixgbe: always enable vlan strip/insert when DCB is enabled
ixgbe: remove some redundant code in setting FCoE FIP filter
ixgbe: fix wrong offset to fc_frame_header in ixgbe_fcoe_ddp
ixgbe: fix header len when unsplit packet overflows to data buffer
ipv6: Never schedule DAD timer on dead address
ipv6: Use POSTDAD state
ipv6: Use state_lock to protect ifa state
ipv6: Replace inet6_ifaddr->dead with state
cxgb4: notify upper drivers if the device is already up when they load
cxgb4: keep interrupts available when the ports are brought down
cxgb4: fix initial addition of MAC address
cnic: Return SPQ credit to bnx2x after ring setup and shutdown.
cnic: Convert cnic_local_flags to atomic ops.
can: Fix SJA1000 command register writes on SMP systems
bridge: fix build for CONFIG_SYSFS disabled
ARCNET: Limit com20020 PCI ID matches for SOHARD cards
...
Fix up various conflicts with pcmcia tree drivers/net/
{pcmcia/3c589_cs.c, wireless/orinoco/orinoco_cs.c and
wireless/orinoco/spectrum_cs.c} and feature removal
(Documentation/feature-removal-schedule.txt).
Also fix a non-content conflict due to pm_qos_requirement getting
renamed in the PM tree (now pm_qos_request) in net/mac80211/scan.c
Diffstat (limited to 'net/rfkill/core.c')
-rw-r--r-- | net/rfkill/core.c | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/net/rfkill/core.c b/net/rfkill/core.c index a9fa86f65983..51875a0c5d48 100644 --- a/net/rfkill/core.c +++ b/net/rfkill/core.c | |||
@@ -629,6 +629,49 @@ static ssize_t rfkill_persistent_show(struct device *dev, | |||
629 | return sprintf(buf, "%d\n", rfkill->persistent); | 629 | return sprintf(buf, "%d\n", rfkill->persistent); |
630 | } | 630 | } |
631 | 631 | ||
632 | static ssize_t rfkill_hard_show(struct device *dev, | ||
633 | struct device_attribute *attr, | ||
634 | char *buf) | ||
635 | { | ||
636 | struct rfkill *rfkill = to_rfkill(dev); | ||
637 | |||
638 | return sprintf(buf, "%d\n", (rfkill->state & RFKILL_BLOCK_HW) ? 1 : 0 ); | ||
639 | } | ||
640 | |||
641 | static ssize_t rfkill_soft_show(struct device *dev, | ||
642 | struct device_attribute *attr, | ||
643 | char *buf) | ||
644 | { | ||
645 | struct rfkill *rfkill = to_rfkill(dev); | ||
646 | |||
647 | return sprintf(buf, "%d\n", (rfkill->state & RFKILL_BLOCK_SW) ? 1 : 0 ); | ||
648 | } | ||
649 | |||
650 | static ssize_t rfkill_soft_store(struct device *dev, | ||
651 | struct device_attribute *attr, | ||
652 | const char *buf, size_t count) | ||
653 | { | ||
654 | struct rfkill *rfkill = to_rfkill(dev); | ||
655 | unsigned long state; | ||
656 | int err; | ||
657 | |||
658 | if (!capable(CAP_NET_ADMIN)) | ||
659 | return -EPERM; | ||
660 | |||
661 | err = strict_strtoul(buf, 0, &state); | ||
662 | if (err) | ||
663 | return err; | ||
664 | |||
665 | if (state > 1 ) | ||
666 | return -EINVAL; | ||
667 | |||
668 | mutex_lock(&rfkill_global_mutex); | ||
669 | rfkill_set_block(rfkill, state); | ||
670 | mutex_unlock(&rfkill_global_mutex); | ||
671 | |||
672 | return err ?: count; | ||
673 | } | ||
674 | |||
632 | static u8 user_state_from_blocked(unsigned long state) | 675 | static u8 user_state_from_blocked(unsigned long state) |
633 | { | 676 | { |
634 | if (state & RFKILL_BLOCK_HW) | 677 | if (state & RFKILL_BLOCK_HW) |
@@ -644,14 +687,8 @@ static ssize_t rfkill_state_show(struct device *dev, | |||
644 | char *buf) | 687 | char *buf) |
645 | { | 688 | { |
646 | struct rfkill *rfkill = to_rfkill(dev); | 689 | struct rfkill *rfkill = to_rfkill(dev); |
647 | unsigned long flags; | ||
648 | u32 state; | ||
649 | |||
650 | spin_lock_irqsave(&rfkill->lock, flags); | ||
651 | state = rfkill->state; | ||
652 | spin_unlock_irqrestore(&rfkill->lock, flags); | ||
653 | 690 | ||
654 | return sprintf(buf, "%d\n", user_state_from_blocked(state)); | 691 | return sprintf(buf, "%d\n", user_state_from_blocked(rfkill->state)); |
655 | } | 692 | } |
656 | 693 | ||
657 | static ssize_t rfkill_state_store(struct device *dev, | 694 | static ssize_t rfkill_state_store(struct device *dev, |
@@ -701,6 +738,8 @@ static struct device_attribute rfkill_dev_attrs[] = { | |||
701 | __ATTR(persistent, S_IRUGO, rfkill_persistent_show, NULL), | 738 | __ATTR(persistent, S_IRUGO, rfkill_persistent_show, NULL), |
702 | __ATTR(state, S_IRUGO|S_IWUSR, rfkill_state_show, rfkill_state_store), | 739 | __ATTR(state, S_IRUGO|S_IWUSR, rfkill_state_show, rfkill_state_store), |
703 | __ATTR(claim, S_IRUGO|S_IWUSR, rfkill_claim_show, rfkill_claim_store), | 740 | __ATTR(claim, S_IRUGO|S_IWUSR, rfkill_claim_show, rfkill_claim_store), |
741 | __ATTR(soft, S_IRUGO|S_IWUSR, rfkill_soft_show, rfkill_soft_store), | ||
742 | __ATTR(hard, S_IRUGO, rfkill_hard_show, NULL), | ||
704 | __ATTR_NULL | 743 | __ATTR_NULL |
705 | }; | 744 | }; |
706 | 745 | ||