devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: clement.perrochaud-BPEPtVrvniRWk0Htik3J/w@public.gmane.org
To: linux-nfc-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
Cc: "Clément Perrochaud"
	<clement.perrochaud-3arQi8VN3Tc@public.gmane.org>,
	sunil.jogi-3arQi8VN3Tc@public.gmane.org,
	jerome.pele-3arQi8VN3Tc@public.gmane.org,
	Charles.Gorand-Effinnov-3arQi8VN3Tc@public.gmane.org,
	lauro.venancio-430g2QfJUUCGglJvpFV4uA@public.gmane.org,
	aloisio.almeida-430g2QfJUUCGglJvpFV4uA@public.gmane.org,
	sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	pawel.moll-5wv7dgnIgG8@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org,
	galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	lefrique-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org,
	christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	cuissard-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org,
	bzhao-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org,
	hirent-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org,
	akarwar-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"Clément Perrochaud"
	<clement.perrochaud-BPEPtVrvniRWk0Htik3J/w@public.gmane.org>
Subject: [PATCH 4/4] NFC: nxp-nci: Allow module removal during download
Date: Thu, 22 Jan 2015 16:27:40 +0100	[thread overview]
Message-ID: <1421940460-14049-5-git-send-email-clement.perrochaud@effinnov.com> (raw)
In-Reply-To: <1421940460-14049-1-git-send-email-clement.perrochaud-BPEPtVrvniRWk0Htik3J/w@public.gmane.org>

From: Clément Perrochaud <clement.perrochaud-3arQi8VN3Tc@public.gmane.org>

Signed-off-by: Clément Perrochaud <clement.perrochaud-3arQi8VN3Tc@public.gmane.org>
Signed-off-by: Clément Perrochaud <clement.perrochaud-BPEPtVrvniRWk0Htik3J/w@public.gmane.org>
---
 drivers/nfc/nxp-nci/core.c     | 7 +++----
 drivers/nfc/nxp-nci/firmware.c | 9 ++++++---
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/nfc/nxp-nci/core.c b/drivers/nfc/nxp-nci/core.c
index d3643ef..c15606d 100644
--- a/drivers/nfc/nxp-nci/core.c
+++ b/drivers/nfc/nxp-nci/core.c
@@ -165,12 +165,11 @@ void nxp_nci_remove(struct nci_dev *ndev)
 {
 	struct nxp_nci_info *info = nci_get_drvdata(ndev);
 
-	mutex_lock(&info->info_lock);
-
-	cancel_work_sync(&info->fw_info.work);
-
 	if (info->mode == NXP_NCI_MODE_FW)
 		nxp_nci_fw_work_complete(info, -ESHUTDOWN);
+	cancel_work_sync(&info->fw_info.work);
+
+	mutex_lock(&info->info_lock);
 
 	if (info->phy_ops->disable)
 		info->phy_ops->disable(info->phy_id);
diff --git a/drivers/nfc/nxp-nci/firmware.c b/drivers/nfc/nxp-nci/firmware.c
index 1814e9f..de136e1 100644
--- a/drivers/nfc/nxp-nci/firmware.c
+++ b/drivers/nfc/nxp-nci/firmware.c
@@ -166,7 +166,8 @@ static int nxp_nci_fw_send(struct nxp_nci_info *info)
 
 	if (*fw_info->data == NXP_NCI_FW_CMD_RESET) {
 		fw_info->cmd_result = 0;
-		schedule_work(&fw_info->work);
+		if (fw_info->fw)
+			schedule_work(&fw_info->work);
 	} else {
 		completion_rc = wait_for_completion_interruptible_timeout(
 			&fw_info->cmd_completion, NXP_NCI_FW_ANSWER_TIMEOUT);
@@ -244,7 +245,8 @@ int nxp_nci_fw_download(struct nci_dev *ndev, const char *firmware_name)
 	fw_info->frame_size = 0;
 	fw_info->cmd_result = 0;
 
-	schedule_work(&fw_info->work);
+	if (fw_info->fw)
+		schedule_work(&fw_info->work);
 
 fw_download_exit:
 	mutex_unlock(&info->info_lock);
@@ -316,6 +318,7 @@ void nxp_nci_fw_recv_frame(struct nci_dev *ndev, struct sk_buff *skb)
 		fw_info->cmd_result = -EIO;
 	}
 
-	schedule_work(&fw_info->work);
+	if (fw_info->fw)
+		schedule_work(&fw_info->work);
 }
 EXPORT_SYMBOL(nxp_nci_fw_recv_frame);
-- 
Clément Perrochaud

Eff'Innov Technologies
Caen, Aix-En-Provence, Grenoble

Eff'Innov Technologies
Campus EffiScience
2, Esplanade Anton Philips
14460 Colombelles, FRANCE

http://www.effinnov.com

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-01-22 15:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22 15:27 [PATCH 0/4] NFC: nxp-nci: Add support for NXP-NCI NFC controllers clement.perrochaud-BPEPtVrvniRWk0Htik3J/w
     [not found] ` <1421940460-14049-1-git-send-email-clement.perrochaud-BPEPtVrvniRWk0Htik3J/w@public.gmane.org>
2015-01-22 15:27   ` [PATCH 1/4] NFC: nci: Add FWDL support clement.perrochaud-BPEPtVrvniRWk0Htik3J/w
2015-01-29 23:28     ` Samuel Ortiz
2015-03-09 10:26       ` Clément Perrochaud
2015-01-22 15:27   ` [PATCH 2/4] NFC: nxp-nci: Add support for NXP NCI chips clement.perrochaud-BPEPtVrvniRWk0Htik3J/w
     [not found]     ` <1421940460-14049-3-git-send-email-clement.perrochaud-BPEPtVrvniRWk0Htik3J/w@public.gmane.org>
2015-01-30  0:10       ` Samuel Ortiz
2015-01-22 15:27   ` [PATCH 3/4] NFC: nxp-nci_i2c: Add I2C support to NXP NCI driver clement.perrochaud-BPEPtVrvniRWk0Htik3J/w
2015-01-30  0:07     ` Samuel Ortiz
2015-01-22 15:27   ` clement.perrochaud-BPEPtVrvniRWk0Htik3J/w [this message]
2015-01-30  0:08     ` [PATCH 4/4] NFC: nxp-nci: Allow module removal during download Samuel Ortiz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421940460-14049-5-git-send-email-clement.perrochaud@effinnov.com \
    --to=clement.perrochaud-bpeptvrvnirwk0htik3j/w@public.gmane.org \
    --cc=Charles.Gorand-Effinnov-3arQi8VN3Tc@public.gmane.org \
    --cc=akarwar-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
    --cc=aloisio.almeida-430g2QfJUUCGglJvpFV4uA@public.gmane.org \
    --cc=bzhao-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
    --cc=christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=clement.perrochaud-3arQi8VN3Tc@public.gmane.org \
    --cc=cuissard-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=hirent-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=jerome.pele-3arQi8VN3Tc@public.gmane.org \
    --cc=lauro.venancio-430g2QfJUUCGglJvpFV4uA@public.gmane.org \
    --cc=lefrique-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nfc-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org \
    --cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=sunil.jogi-3arQi8VN3Tc@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).