summaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorRobert Dolca <robert.dolca@intel.com>2015-10-22 11:11:41 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2015-10-25 20:29:11 +0100
commit85b9ce9a21b119a8163f20d60e7f0ce58fffbeef (patch)
tree86c2206f1149930987b1b6b001e5b19a3f09732b /net/nfc
parentNFC: nci: fix possible crash in nci_core_conn_create (diff)
downloadlinux-85b9ce9a21b119a8163f20d60e7f0ce58fffbeef.tar.xz
linux-85b9ce9a21b119a8163f20d60e7f0ce58fffbeef.zip
NFC: nci: add nci_get_conn_info_by_id function
This functin takes as a parameter a pointer to the nci_dev struct and the first byte from the values of the first domain specific parameter that was used for the connection creation. Signed-off-by: Robert Dolca <robert.dolca@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/nci/core.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 9d5f7a2b1d03..75bda34fd8e4 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -64,6 +64,19 @@ struct nci_conn_info *nci_get_conn_info_by_conn_id(struct nci_dev *ndev,
return NULL;
}
+int nci_get_conn_info_by_id(struct nci_dev *ndev, u8 id)
+{
+ struct nci_conn_info *conn_info;
+
+ list_for_each_entry(conn_info, &ndev->conn_info_list, list) {
+ if (conn_info->id == id)
+ return conn_info->conn_id;
+ }
+
+ return -EINVAL;
+}
+EXPORT_SYMBOL(nci_get_conn_info_by_id);
+
/* ---- NCI requests ---- */
void nci_req_complete(struct nci_dev *ndev, int result)