提交 25a1d9dc 编写于 作者: I Ilan Elias 提交者: John W. Linville

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: NIlan Elias <ilane@ti.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 8939e47f
...@@ -87,7 +87,6 @@ struct nfc_genl_data { ...@@ -87,7 +87,6 @@ struct nfc_genl_data {
struct nfc_dev { struct nfc_dev {
unsigned idx; unsigned idx;
unsigned target_idx;
struct nfc_target *targets; struct nfc_target *targets;
int n_targets; int n_targets;
int targets_generation; int targets_generation;
......
...@@ -431,15 +431,10 @@ EXPORT_SYMBOL(nfc_alloc_recv_skb); ...@@ -431,15 +431,10 @@ EXPORT_SYMBOL(nfc_alloc_recv_skb);
int nfc_targets_found(struct nfc_dev *dev, struct nfc_target *targets, int nfc_targets_found(struct nfc_dev *dev, struct nfc_target *targets,
int n_targets) int n_targets)
{ {
int i;
pr_debug("dev_name=%s n_targets=%d\n", dev_name(&dev->dev), n_targets); pr_debug("dev_name=%s n_targets=%d\n", dev_name(&dev->dev), n_targets);
dev->polling = false; dev->polling = false;
for (i = 0; i < n_targets; i++)
targets[i].idx = dev->target_idx++;
spin_lock_bh(&dev->targets_lock); spin_lock_bh(&dev->targets_lock);
dev->targets_generation++; dev->targets_generation++;
......
...@@ -92,18 +92,6 @@ static int rawsock_connect(struct socket *sock, struct sockaddr *_addr, ...@@ -92,18 +92,6 @@ static int rawsock_connect(struct socket *sock, struct sockaddr *_addr,
goto error; goto error;
} }
if (addr->target_idx > dev->target_idx - 1 ||
addr->target_idx < dev->target_idx - dev->n_targets) {
rc = -EINVAL;
goto error;
}
if (addr->target_idx > dev->target_idx - 1 ||
addr->target_idx < dev->target_idx - dev->n_targets) {
rc = -EINVAL;
goto error;
}
rc = nfc_activate_target(dev, addr->target_idx, addr->nfc_protocol); rc = nfc_activate_target(dev, addr->target_idx, addr->nfc_protocol);
if (rc) if (rc)
goto put_dev; goto put_dev;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册