aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2013-08-21 08:46:20 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-09-24 19:35:41 -0400
commite29a9e2ae165620d202f3ce45abd3a219b13ffb7 (patch)
tree123d29e6ee22d24c36b89387d624733afac3d17d /net
parentfa544fff62aeeb0cf8008c61077aae10fb1407a9 (diff)
NFC: Set active target upon DEP up event reception
As we can potentially get DEP up events without having sent a netlink command, we need to set the active target properly from dep_link_is_up. Spontaneous DEP up events can come from devices that detected an active p2p target. In that case there is no need to call the netlink DEP up command as the link is already up and running. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/nfc/core.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/nfc/core.c b/net/nfc/core.c
index 269ffc5288d0..872529105abc 100644
--- a/net/nfc/core.c
+++ b/net/nfc/core.c
@@ -384,6 +384,19 @@ int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx,
384{ 384{
385 dev->dep_link_up = true; 385 dev->dep_link_up = true;
386 386
387 if (!dev->active_target) {
388 struct nfc_target *target;
389
390 target = nfc_find_target(dev, target_idx);
391 if (target == NULL)
392 return -ENOTCONN;
393
394 dev->active_target = target;
395 }
396
397 dev->polling = false;
398 dev->rf_mode = rf_mode;
399
387 nfc_llcp_mac_is_up(dev, target_idx, comm_mode, rf_mode); 400 nfc_llcp_mac_is_up(dev, target_idx, comm_mode, rf_mode);
388 401
389 return nfc_genl_dep_link_up_event(dev, target_idx, comm_mode, rf_mode); 402 return nfc_genl_dep_link_up_event(dev, target_idx, comm_mode, rf_mode);