Skip to content

Commit

Permalink
NFC: nci: Add reference to the RF logical connection
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christophe Ricard authored and Samuel Ortiz committed Feb 4, 2015
1 parent 26fc6c7 commit 12bdf27
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 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 @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion net/nfc/nci/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 2 additions & 4 deletions net/nfc/nci/ntf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions net/nfc/nci/rsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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;
}
}

Expand Down

0 comments on commit 12bdf27

Please sign in to comment.