summaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2012-03-05 01:03:34 +0100
committerJohn W. Linville <linville@tuxdriver.com>2012-03-06 21:16:19 +0100
commitc970a1ac4e75a5d31c7b6e8e9f0bb192b0a511e7 (patch)
tree8c1e110d2c21b69132b5912a0a8f4e1f65855f15 /net/nfc
parentNFC: Export NFCID1 from pn533 (diff)
downloadlinux-c970a1ac4e75a5d31c7b6e8e9f0bb192b0a511e7.tar.xz
linux-c970a1ac4e75a5d31c7b6e8e9f0bb192b0a511e7.zip
NFC: Add device powered netlink attribute
For user space to know if a device is up or down. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/netlink.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index 07f0348aabf5..a1388e4efd6f 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -48,6 +48,7 @@ static const struct nla_policy nfc_genl_policy[NFC_ATTR_MAX + 1] = {
[NFC_ATTR_PROTOCOLS] = { .type = NLA_U32 },
[NFC_ATTR_COMM_MODE] = { .type = NLA_U8 },
[NFC_ATTR_RF_MODE] = { .type = NLA_U8 },
+ [NFC_ATTR_DEVICE_POWERED] = { .type = NLA_U8 },
};
static int nfc_genl_send_target(struct sk_buff *msg, struct nfc_target *target,
@@ -200,6 +201,7 @@ int nfc_genl_device_added(struct nfc_dev *dev)
NLA_PUT_STRING(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev));
NLA_PUT_U32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx);
NLA_PUT_U32(msg, NFC_ATTR_PROTOCOLS, dev->supported_protocols);
+ NLA_PUT_U8(msg, NFC_ATTR_DEVICE_POWERED, dev->dev_up);
genlmsg_end(msg, hdr);
@@ -261,6 +263,7 @@ static int nfc_genl_send_device(struct sk_buff *msg, struct nfc_dev *dev,
NLA_PUT_STRING(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev));
NLA_PUT_U32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx);
NLA_PUT_U32(msg, NFC_ATTR_PROTOCOLS, dev->supported_protocols);
+ NLA_PUT_U8(msg, NFC_ATTR_DEVICE_POWERED, dev->dev_up);
return genlmsg_end(msg, hdr);