diff options
author | OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> | 2017-02-03 20:15:55 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2017-04-01 17:04:29 -0400 |
commit | 85a2566d70a851c85806f687b93a9559bb8a3b11 (patch) | |
tree | 124a1b187a6a8833b4960c675c7246070fe6bb53 /net/nfc | |
parent | 9728ee92f740acc65d54e6c62b9124cd0676cba9 (diff) |
nfc: Send same info for both of NFC_CMD_GET_DEVICE and NFC_EVENT_DEVICE_ADDED
Now, NFC_EVENT_DEVICE_ADDED doesn't send NFC_ATTR_RF_MODE. But
NFC_CMD_GET_DEVICE send.
To get NFC_ATTR_RF_MODE, we have to call NFC_CMD_GET_DEVICE just for
NFC_ATTR_RF_MODE when get NFC_EVENT_DEVICE_ADDED.
This fixes those inconsistent.
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r-- | net/nfc/netlink.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index 03f3d5c7beb8..4c95319dc22b 100644 --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c | |||
@@ -303,6 +303,17 @@ free_msg: | |||
303 | return -EMSGSIZE; | 303 | return -EMSGSIZE; |
304 | } | 304 | } |
305 | 305 | ||
306 | static int nfc_genl_setup_device_added(struct nfc_dev *dev, struct sk_buff *msg) | ||
307 | { | ||
308 | if (nla_put_string(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev)) || | ||
309 | nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || | ||
310 | nla_put_u32(msg, NFC_ATTR_PROTOCOLS, dev->supported_protocols) || | ||
311 | nla_put_u8(msg, NFC_ATTR_DEVICE_POWERED, dev->dev_up) || | ||
312 | nla_put_u8(msg, NFC_ATTR_RF_MODE, dev->rf_mode)) | ||
313 | return -1; | ||
314 | return 0; | ||
315 | } | ||
316 | |||
306 | int nfc_genl_device_added(struct nfc_dev *dev) | 317 | int nfc_genl_device_added(struct nfc_dev *dev) |
307 | { | 318 | { |
308 | struct sk_buff *msg; | 319 | struct sk_buff *msg; |
@@ -317,10 +328,7 @@ int nfc_genl_device_added(struct nfc_dev *dev) | |||
317 | if (!hdr) | 328 | if (!hdr) |
318 | goto free_msg; | 329 | goto free_msg; |
319 | 330 | ||
320 | if (nla_put_string(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev)) || | 331 | if (nfc_genl_setup_device_added(dev, msg)) |
321 | nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || | ||
322 | nla_put_u32(msg, NFC_ATTR_PROTOCOLS, dev->supported_protocols) || | ||
323 | nla_put_u8(msg, NFC_ATTR_DEVICE_POWERED, dev->dev_up)) | ||
324 | goto nla_put_failure; | 332 | goto nla_put_failure; |
325 | 333 | ||
326 | genlmsg_end(msg, hdr); | 334 | genlmsg_end(msg, hdr); |
@@ -596,11 +604,7 @@ static int nfc_genl_send_device(struct sk_buff *msg, struct nfc_dev *dev, | |||
596 | if (cb) | 604 | if (cb) |
597 | genl_dump_check_consistent(cb, hdr, &nfc_genl_family); | 605 | genl_dump_check_consistent(cb, hdr, &nfc_genl_family); |
598 | 606 | ||
599 | if (nla_put_string(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev)) || | 607 | if (nfc_genl_setup_device_added(dev, msg)) |
600 | nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || | ||
601 | nla_put_u32(msg, NFC_ATTR_PROTOCOLS, dev->supported_protocols) || | ||
602 | nla_put_u8(msg, NFC_ATTR_DEVICE_POWERED, dev->dev_up) || | ||
603 | nla_put_u8(msg, NFC_ATTR_RF_MODE, dev->rf_mode)) | ||
604 | goto nla_put_failure; | 608 | goto nla_put_failure; |
605 | 609 | ||
606 | genlmsg_end(msg, hdr); | 610 | genlmsg_end(msg, hdr); |