diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2012-04-10 13:43:09 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-04-12 15:10:37 -0400 |
commit | c4fbb6515a4dcec83d340247639b5644c4745528 (patch) | |
tree | 9123c1e0b56ea1f9910ce4db1e9046bd5a8a29c4 /net/nfc/core.c | |
parent | 0efbf7fb308d0c6f8419922850a2d0b45d4d4401 (diff) |
NFC: The core part should generate the target index
The target index can be used by userspace to uniquely identify a target
and thus should be kept unique, per NFC adapter. Moreover, some protocols
do not provide a logical index when discovering new targets, so we have to
generate one for them.
For NCI or pn533 to fetch their logical index, we added a logical_idx field
to the target structure.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/nfc/core.c')
-rw-r--r-- | net/nfc/core.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/nfc/core.c b/net/nfc/core.c index deb4721ce8a..d92400087b6 100644 --- a/net/nfc/core.c +++ b/net/nfc/core.c | |||
@@ -428,10 +428,15 @@ EXPORT_SYMBOL(nfc_alloc_recv_skb); | |||
428 | int nfc_targets_found(struct nfc_dev *dev, | 428 | int nfc_targets_found(struct nfc_dev *dev, |
429 | struct nfc_target *targets, int n_targets) | 429 | struct nfc_target *targets, int n_targets) |
430 | { | 430 | { |
431 | int i; | ||
432 | |||
431 | pr_debug("dev_name=%s n_targets=%d\n", dev_name(&dev->dev), n_targets); | 433 | pr_debug("dev_name=%s n_targets=%d\n", dev_name(&dev->dev), n_targets); |
432 | 434 | ||
433 | dev->polling = false; | 435 | dev->polling = false; |
434 | 436 | ||
437 | for (i = 0; i < n_targets; i++) | ||
438 | targets[i].idx = dev->target_idx++; | ||
439 | |||
435 | spin_lock_bh(&dev->targets_lock); | 440 | spin_lock_bh(&dev->targets_lock); |
436 | 441 | ||
437 | dev->targets_generation++; | 442 | dev->targets_generation++; |