diff options
author | Ilan Elias <ilane@ti.com> | 2012-01-18 06:16:13 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-01-24 14:32:28 -0500 |
commit | 25a1d9dc850b1bdcc4760eb625f0a67057f54d26 (patch) | |
tree | d717fdf49f8183899f8c98ce8860c5b1c4dceb2d /net | |
parent | 8939e47fc953cce6ef53e79e9ff9b53319d1a72d (diff) |
NFC: NFC core layer should not set the target_idx
The NFC core layer should not set the target_idx.
Instead, the driver layer (e.g. NCI, PN533) should set the
target_idx, so that it will be able to identify the target
when its I/F (e.g. activate_target) is called.
This is required in order to support multiple targets.
Note that currently supported drivers (PN533 and NCI) don't
use the target_idx in their implementation.
Signed-off-by: Ilan Elias <ilane@ti.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/nfc/core.c | 5 | ||||
-rw-r--r-- | net/nfc/rawsock.c | 12 |
2 files changed, 0 insertions, 17 deletions
diff --git a/net/nfc/core.c b/net/nfc/core.c index 3ddf6e698df0..6089aca67b14 100644 --- a/net/nfc/core.c +++ b/net/nfc/core.c | |||
@@ -431,15 +431,10 @@ EXPORT_SYMBOL(nfc_alloc_recv_skb); | |||
431 | int nfc_targets_found(struct nfc_dev *dev, struct nfc_target *targets, | 431 | int nfc_targets_found(struct nfc_dev *dev, struct nfc_target *targets, |
432 | int n_targets) | 432 | int n_targets) |
433 | { | 433 | { |
434 | int i; | ||
435 | |||
436 | pr_debug("dev_name=%s n_targets=%d\n", dev_name(&dev->dev), n_targets); | 434 | pr_debug("dev_name=%s n_targets=%d\n", dev_name(&dev->dev), n_targets); |
437 | 435 | ||
438 | dev->polling = false; | 436 | dev->polling = false; |
439 | 437 | ||
440 | for (i = 0; i < n_targets; i++) | ||
441 | targets[i].idx = dev->target_idx++; | ||
442 | |||
443 | spin_lock_bh(&dev->targets_lock); | 438 | spin_lock_bh(&dev->targets_lock); |
444 | 439 | ||
445 | dev->targets_generation++; | 440 | dev->targets_generation++; |
diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c index 2e2f8c6a61fe..5325439b0c60 100644 --- a/net/nfc/rawsock.c +++ b/net/nfc/rawsock.c | |||
@@ -92,18 +92,6 @@ 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 | |||
101 | if (addr->target_idx > dev->target_idx - 1 || | ||
102 | addr->target_idx < dev->target_idx - dev->n_targets) { | ||
103 | rc = -EINVAL; | ||
104 | goto error; | ||
105 | } | ||
106 | |||
107 | rc = nfc_activate_target(dev, addr->target_idx, addr->nfc_protocol); | 95 | rc = nfc_activate_target(dev, addr->target_idx, addr->nfc_protocol); |
108 | if (rc) | 96 | if (rc) |
109 | goto put_dev; | 97 | goto put_dev; |