aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/netlink.c
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2012-05-15 09:57:06 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-06-04 15:34:29 -0400
commitfe7c580073280c15bb4eb4f82bf20dddc1a68383 (patch)
tree0b71c488d1b3cdd87dd5e05ccd0224b496fec2f9 /net/nfc/netlink.c
parentab73b751303bc60d7d9fba875c958dedfe14754c (diff)
NFC: Add target mode protocols to the polling loop startup routine
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/netlink.c')
-rw-r--r--net/nfc/netlink.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index 581d419083aa..a18fd56798fc 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -49,6 +49,8 @@ static const struct nla_policy nfc_genl_policy[NFC_ATTR_MAX + 1] = {
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 [NFC_ATTR_DEVICE_POWERED] = { .type = NLA_U8 },
52 [NFC_ATTR_IM_PROTOCOLS] = { .type = NLA_U32 },
53 [NFC_ATTR_TM_PROTOCOLS] = { .type = NLA_U32 },
52}; 54};
53 55
54static int nfc_genl_send_target(struct sk_buff *msg, struct nfc_target *target, 56static int nfc_genl_send_target(struct sk_buff *msg, struct nfc_target *target,
@@ -519,16 +521,25 @@ static int nfc_genl_start_poll(struct sk_buff *skb, struct genl_info *info)
519 struct nfc_dev *dev; 521 struct nfc_dev *dev;
520 int rc; 522 int rc;
521 u32 idx; 523 u32 idx;
522 u32 protocols; 524 u32 im_protocols = 0, tm_protocols = 0;
523 525
524 pr_debug("Poll start\n"); 526 pr_debug("Poll start\n");
525 527
526 if (!info->attrs[NFC_ATTR_DEVICE_INDEX] || 528 if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
527 !info->attrs[NFC_ATTR_PROTOCOLS]) 529 ((!info->attrs[NFC_ATTR_IM_PROTOCOLS] &&
530 !info->attrs[NFC_ATTR_PROTOCOLS]) &&
531 !info->attrs[NFC_ATTR_TM_PROTOCOLS]))
528 return -EINVAL; 532 return -EINVAL;
529 533
530 idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]); 534 idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);
531 protocols = nla_get_u32(info->attrs[NFC_ATTR_PROTOCOLS]); 535
536 if (info->attrs[NFC_ATTR_TM_PROTOCOLS])
537 tm_protocols = nla_get_u32(info->attrs[NFC_ATTR_TM_PROTOCOLS]);
538 else if (info->attrs[NFC_ATTR_PROTOCOLS])
539 tm_protocols = nla_get_u32(info->attrs[NFC_ATTR_PROTOCOLS]);
540
541 if (info->attrs[NFC_ATTR_IM_PROTOCOLS])
542 im_protocols = nla_get_u32(info->attrs[NFC_ATTR_IM_PROTOCOLS]);
532 543
533 dev = nfc_get_device(idx); 544 dev = nfc_get_device(idx);
534 if (!dev) 545 if (!dev)
@@ -536,7 +547,7 @@ static int nfc_genl_start_poll(struct sk_buff *skb, struct genl_info *info)
536 547
537 mutex_lock(&dev->genl_data.genl_data_mutex); 548 mutex_lock(&dev->genl_data.genl_data_mutex);
538 549
539 rc = nfc_start_poll(dev, protocols); 550 rc = nfc_start_poll(dev, im_protocols, tm_protocols);
540 if (!rc) 551 if (!rc)
541 dev->genl_data.poll_req_pid = info->snd_pid; 552 dev->genl_data.poll_req_pid = info->snd_pid;
542 553