From c4fbb6515a4dcec83d340247639b5644c4745528 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Tue, 10 Apr 2012 19:43:09 +0200 Subject: 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 Signed-off-by: John W. Linville --- net/nfc/core.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'net/nfc/core.c') 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); int nfc_targets_found(struct nfc_dev *dev, struct nfc_target *targets, int n_targets) { + int i; + pr_debug("dev_name=%s n_targets=%d\n", dev_name(&dev->dev), n_targets); dev->polling = false; + for (i = 0; i < n_targets; i++) + targets[i].idx = dev->target_idx++; + spin_lock_bh(&dev->targets_lock); dev->targets_generation++; -- cgit v1.2.2