aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2012-03-04 19:03:34 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-03-06 15:16:19 -0500
commitc970a1ac4e75a5d31c7b6e8e9f0bb192b0a511e7 (patch)
tree8c1e110d2c21b69132b5912a0a8f4e1f65855f15
parentc3b1e1e8a76fdaa507daaa95ba7bd1d8d0c74b6b (diff)
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>
-rw-r--r--include/linux/nfc.h1
-rw-r--r--net/nfc/netlink.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/nfc.h b/include/linux/nfc.h
index b4999abcb2a2..39c1fcf089c0 100644
--- a/include/linux/nfc.h
+++ b/include/linux/nfc.h
@@ -107,6 +107,7 @@ enum nfc_attrs {
107 NFC_ATTR_TARGET_SENSF_RES, 107 NFC_ATTR_TARGET_SENSF_RES,
108 NFC_ATTR_COMM_MODE, 108 NFC_ATTR_COMM_MODE,
109 NFC_ATTR_RF_MODE, 109 NFC_ATTR_RF_MODE,
110 NFC_ATTR_DEVICE_POWERED,
110/* private: internal use only */ 111/* private: internal use only */
111 __NFC_ATTR_AFTER_LAST 112 __NFC_ATTR_AFTER_LAST
112}; 113};
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] = {
48 [NFC_ATTR_PROTOCOLS] = { .type = NLA_U32 }, 48 [NFC_ATTR_PROTOCOLS] = { .type = NLA_U32 },
49 [NFC_ATTR_COMM_MODE] = { .type = NLA_U8 }, 49 [NFC_ATTR_COMM_MODE] = { .type = NLA_U8 },
50 [NFC_ATTR_RF_MODE] = { .type = NLA_U8 }, 50 [NFC_ATTR_RF_MODE] = { .type = NLA_U8 },
51 [NFC_ATTR_DEVICE_POWERED] = { .type = NLA_U8 },
51}; 52};
52 53
53static int nfc_genl_send_target(struct sk_buff *msg, struct nfc_target *target, 54static 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)
200 NLA_PUT_STRING(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev)); 201 NLA_PUT_STRING(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev));
201 NLA_PUT_U32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx); 202 NLA_PUT_U32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx);
202 NLA_PUT_U32(msg, NFC_ATTR_PROTOCOLS, dev->supported_protocols); 203 NLA_PUT_U32(msg, NFC_ATTR_PROTOCOLS, dev->supported_protocols);
204 NLA_PUT_U8(msg, NFC_ATTR_DEVICE_POWERED, dev->dev_up);
203 205
204 genlmsg_end(msg, hdr); 206 genlmsg_end(msg, hdr);
205 207
@@ -261,6 +263,7 @@ static int nfc_genl_send_device(struct sk_buff *msg, struct nfc_dev *dev,
261 NLA_PUT_STRING(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev)); 263 NLA_PUT_STRING(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev));
262 NLA_PUT_U32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx); 264 NLA_PUT_U32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx);
263 NLA_PUT_U32(msg, NFC_ATTR_PROTOCOLS, dev->supported_protocols); 265 NLA_PUT_U32(msg, NFC_ATTR_PROTOCOLS, dev->supported_protocols);
266 NLA_PUT_U8(msg, NFC_ATTR_DEVICE_POWERED, dev->dev_up);
264 267
265 return genlmsg_end(msg, hdr); 268 return genlmsg_end(msg, hdr);
266 269