NFC: nci: add nci_get_conn_info_by_id function
authorRobert Dolca <robert.dolca@intel.com>
Thu, 22 Oct 2015 09:11:41 +0000 (12:11 +0300)
committerSamuel Ortiz <sameo@linux.intel.com>
Sun, 25 Oct 2015 19:29:11 +0000 (20:29 +0100)
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>
include/net/nfc/nci_core.h
net/nfc/nci/core.c

index 5daf0042261ede7d0d9da0cf2909deb3634fa1c0..0569cb2511354690c9683603c3f48e0cff94dd26 100644 (file)
@@ -374,6 +374,7 @@ void nci_clear_target_list(struct nci_dev *ndev);
 void nci_req_complete(struct nci_dev *ndev, int result);
 struct nci_conn_info *nci_get_conn_info_by_conn_id(struct nci_dev *ndev,
                                                   int conn_id);
+int nci_get_conn_info_by_id(struct nci_dev *ndev, u8 id);
 
 /* ----- NCI status code ----- */
 int nci_to_errno(__u8 code);
index 9d5f7a2b1d036bb66223ed4c49d989cecfe66a57..75bda34fd8e4f7f952ce2ea50d9208e373165111 100644 (file)
@@ -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)