Skip to content

Commit

Permalink
NFC: nci: add nci_get_conn_info_by_id function
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Robert Dolca authored and Samuel Ortiz committed Oct 25, 2015
1 parent caa575a commit 85b9ce9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/net/nfc/nci_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
13 changes: 13 additions & 0 deletions net/nfc/nci/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 85b9ce9

Please sign in to comment.