summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Ricard <christophe.ricard@gmail.com>2015-02-03 19:48:04 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2015-02-04 09:09:53 +0100
commit12bdf27d46c9d5e490fa164551642e065105db78 (patch)
tree477d4c54873b2cb6b6b13afb286f004d95ad4c5f
parentNFC: st21nfca: Add HCI transaction event support (diff)
downloadlinux-12bdf27d46c9d5e490fa164551642e065105db78.tar.xz
linux-12bdf27d46c9d5e490fa164551642e065105db78.zip
NFC: nci: Add reference to the RF logical connection
The NCI_STATIC_RF_CONN_ID logical connection is the most used connection. Keeping it directly accessible in the nci_dev structure will simplify and optimize the access. Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--include/net/nfc/nci_core.h1
-rw-r--r--net/nfc/nci/core.c2
-rw-r--r--net/nfc/nci/ntf.c6
-rw-r--r--net/nfc/nci/rsp.c4
4 files changed, 6 insertions, 7 deletions
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index be858870dace..731fa5be9989 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -189,6 +189,7 @@ struct nci_dev {
__u8 cur_conn_id;
struct list_head conn_info_list;
+ struct nci_conn_info *rf_conn_info;
struct timer_list cmd_timer;
struct timer_list data_timer;
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index f74d420e2ead..17ff5f83393c 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -803,7 +803,7 @@ static int nci_transceive(struct nfc_dev *nfc_dev, struct nfc_target *target,
int rc;
struct nci_conn_info *conn_info;
- conn_info = nci_get_conn_info_by_conn_id(ndev, NCI_STATIC_RF_CONN_ID);
+ conn_info = ndev->rf_conn_info;
if (!conn_info)
return -EPROTO;
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c
index 33f5f00ecf4c..6bbbf6fdacc0 100644
--- a/net/nfc/nci/ntf.c
+++ b/net/nfc/nci/ntf.c
@@ -625,8 +625,7 @@ static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev,
exit:
if (err == NCI_STATUS_OK) {
- conn_info = nci_get_conn_info_by_conn_id(ndev,
- NCI_STATIC_RF_CONN_ID);
+ conn_info = ndev->rf_conn_info;
if (!conn_info)
return;
@@ -684,8 +683,7 @@ static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev,
pr_debug("entry, type 0x%x, reason 0x%x\n", ntf->type, ntf->reason);
- conn_info =
- nci_get_conn_info_by_conn_id(ndev, NCI_STATIC_RF_CONN_ID);
+ conn_info = ndev->rf_conn_info;
if (!conn_info)
return;
diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c
index 31ccf7d05e82..05268eb473df 100644
--- a/net/nfc/nci/rsp.c
+++ b/net/nfc/nci/rsp.c
@@ -148,8 +148,7 @@ static void nci_rf_disc_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
if (status == NCI_STATUS_OK) {
atomic_set(&ndev->state, NCI_DISCOVERY);
- conn_info = nci_get_conn_info_by_conn_id(ndev,
- NCI_STATIC_RF_CONN_ID);
+ conn_info = ndev->rf_conn_info;
if (!conn_info) {
conn_info = devm_kzalloc(&ndev->nfc_dev->dev,
sizeof(struct nci_conn_info),
@@ -161,6 +160,7 @@ static void nci_rf_disc_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
conn_info->conn_id = NCI_STATIC_RF_CONN_ID;
INIT_LIST_HEAD(&conn_info->list);
list_add(&conn_info->list, &ndev->conn_info_list);
+ ndev->rf_conn_info = conn_info;
}
}