summaryrefslogtreecommitdiff
path: root/net/nfc/nci/rsp.c
diff options
context:
space:
mode:
authorChristophe Ricard <christophe.ricard@gmail.com>2015-02-01 22:26:08 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2015-02-02 21:50:31 +0100
commit4aeee6871e8c3b043ef02996db8ac70a1af8be92 (patch)
tree9a49decf9d2be10bdb6b5ec71dd5959df9b5bc81 /net/nfc/nci/rsp.c
parent86b3bfe914f41c2d47d5882d06e1261cc58fb5e9 (diff)
NFC: nci: Add dynamic logical connections support
The current NCI core only support the RF static connection. For other NFC features such as Secure Element communication, we may need to create logical connections to the NFCEE (Execution Environment. In order to track each logical connection ID dynamically, we add a linked list of connection info pointers to the nci_dev structure. Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/nci/rsp.c')
-rw-r--r--net/nfc/nci/rsp.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c
index 041de51ccdbe..93b914937263 100644
--- a/net/nfc/nci/rsp.c
+++ b/net/nfc/nci/rsp.c
@@ -140,13 +140,31 @@ static void nci_rf_disc_map_rsp_packet(struct nci_dev *ndev,
static void nci_rf_disc_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)
{
+ struct nci_conn_info *conn_info;
__u8 status = skb->data[0];
pr_debug("status 0x%x\n", status);
- if (status == NCI_STATUS_OK)
+ 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);
+ if (!conn_info) {
+ conn_info = devm_kzalloc(&ndev->nfc_dev->dev,
+ sizeof(struct nci_conn_info),
+ GFP_KERNEL);
+ if (!conn_info) {
+ status = NCI_STATUS_REJECTED;
+ goto exit;
+ }
+ conn_info->conn_id = NCI_STATIC_RF_CONN_ID;
+ INIT_LIST_HEAD(&conn_info->list);
+ list_add(&conn_info->list, &ndev->conn_info_list);
+ }
+ }
+
+exit:
nci_req_complete(ndev, status);
}