diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2015-02-03 19:48:08 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2015-02-04 09:15:18 +0100 |
commit | fa00e8fed457841cb24219dbe3cfba7d56de6317 (patch) | |
tree | ce8a4fa1b3719974644294685e5936fe9bead51d | |
parent | 15d4a8da0e440faf589a26346c8287e1ed0abe6c (diff) | |
download | linux-exynos-fa00e8fed457841cb24219dbe3cfba7d56de6317.tar.gz linux-exynos-fa00e8fed457841cb24219dbe3cfba7d56de6317.tar.bz2 linux-exynos-fa00e8fed457841cb24219dbe3cfba7d56de6317.zip |
NFC: nci: Move NFCEE discovery logic
NFCEE_DISCOVER_CMD is a specified NCI command used to discover
NFCEE IDs.
Move nci_nfcee_discover() call to nci_discover_se() in order to
guarantee:
- NFCEE_DISCOVER_CMD run when the NCI state machine is initialized
- NFCEE_DISCOVER_CMD is not run in case there is not discover_se
hook defined by a NFC device driver.
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | drivers/nfc/st21nfcb/st21nfcb_se.c | 4 | ||||
-rw-r--r-- | net/nfc/nci/core.c | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/drivers/nfc/st21nfcb/st21nfcb_se.c b/drivers/nfc/st21nfcb/st21nfcb_se.c index d23e8f27c4aa..7c82e9d87a65 100644 --- a/drivers/nfc/st21nfcb/st21nfcb_se.c +++ b/drivers/nfc/st21nfcb/st21nfcb_se.c @@ -499,10 +499,6 @@ static int st21nfcb_hci_network_init(struct nci_dev *ndev) struct nci_conn_info *conn_info; int r, dev_num; - r = nci_nfcee_discover(ndev, NCI_NFCEE_DISCOVERY_ACTION_ENABLE); - if (r != NCI_STATUS_OK) - goto exit; - dest_params = kzalloc(sizeof(struct core_conn_create_dest_spec_params) + sizeof(struct dest_spec_params), GFP_KERNEL); diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index ddfe91e43c88..9575a1892607 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c @@ -880,10 +880,16 @@ static int nci_disable_se(struct nfc_dev *nfc_dev, u32 se_idx) static int nci_discover_se(struct nfc_dev *nfc_dev) { + int r; struct nci_dev *ndev = nfc_get_drvdata(nfc_dev); - if (ndev->ops->discover_se) + if (ndev->ops->discover_se) { + r = nci_nfcee_discover(ndev, NCI_NFCEE_DISCOVERY_ACTION_ENABLE); + if (r != NCI_STATUS_OK) + return -EPROTO; + return ndev->ops->discover_se(ndev); + } return 0; } |