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/rawsock.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/rawsock.c')
-rw-r--r-- | net/nfc/rawsock.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c index 5a839ceb2e82..b2825aa85f64 100644 --- a/net/nfc/rawsock.c +++ b/net/nfc/rawsock.c | |||
@@ -92,6 +92,12 @@ static int rawsock_connect(struct socket *sock, struct sockaddr *_addr, | |||
92 | goto error; | 92 | goto error; |
93 | } | 93 | } |
94 | 94 | ||
95 | if (addr->target_idx > dev->target_idx - 1 || | ||
96 | addr->target_idx < dev->target_idx - dev->n_targets) { | ||
97 | rc = -EINVAL; | ||
98 | goto error; | ||
99 | } | ||
100 | |||
95 | rc = nfc_activate_target(dev, addr->target_idx, addr->nfc_protocol); | 101 | rc = nfc_activate_target(dev, addr->target_idx, addr->nfc_protocol); |
96 | if (rc) | 102 | if (rc) |
97 | goto put_dev; | 103 | goto put_dev; |