From: Ilan Elias Date: Thu, 22 Sep 2011 08:13:01 +0000 (+0300) Subject: NFC: implicitly deactivate in nci_start_poll X-Git-Tag: next-20110928~61^2~23 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=de054799b7ffee8ce1e3971a8dcd7816ccf04977;p=karo-tx-linux.git NFC: implicitly deactivate in nci_start_poll When start_poll is called, and a target was implicitly activated, we need to implicitly deactivate it. On the other hand, when the target was activated by the user, we should not deactivate it. Signed-off-by: Ilan Elias Acked-by: Lauro Ramos Venancio Signed-off-by: John W. Linville --- diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index c3dfd4e13bd5..9f17e8ec0ab9 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c @@ -361,8 +361,13 @@ static int nci_start_poll(struct nfc_dev *nfc_dev, __u32 protocols) return -EBUSY; } + if (ndev->target_active_prot) { + nfc_err("there is an active target"); + return -EBUSY; + } + if (test_bit(NCI_POLL_ACTIVE, &ndev->flags)) { - nfc_dbg("target already active, first deactivate..."); + nfc_dbg("target is active, implicitly deactivate..."); rc = nci_request(ndev, nci_rf_deactivate_req, 0, msecs_to_jiffies(NCI_RF_DEACTIVATE_TIMEOUT));