diff mbox

[4/4] NFC: nxp-nci: Allow module removal during download

Message ID 1421940460-14049-5-git-send-email-clement.perrochaud@effinnov.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

clement.perrochaud@effinnov.com Jan. 22, 2015, 3:27 p.m. UTC
From: Clément Perrochaud <clement.perrochaud@nxp.com>

Signed-off-by: Clément Perrochaud <clement.perrochaud@nxp.com>
Signed-off-by: Clément Perrochaud <clement.perrochaud@effinnov.com>
---
 drivers/nfc/nxp-nci/core.c     | 7 +++----
 drivers/nfc/nxp-nci/firmware.c | 9 ++++++---
 2 files changed, 9 insertions(+), 7 deletions(-)

Comments

Samuel Ortiz Jan. 30, 2015, 12:08 a.m. UTC | #1
Hi Clement,

On Thu, Jan 22, 2015 at 04:27:40PM +0100, clement.perrochaud@effinnov.com wrote:
> From: Clément Perrochaud <clement.perrochaud@nxp.com>
> 
> Signed-off-by: Clément Perrochaud <clement.perrochaud@nxp.com>
> Signed-off-by: Clément Perrochaud <clement.perrochaud@effinnov.com>
> ---
>  drivers/nfc/nxp-nci/core.c     | 7 +++----
>  drivers/nfc/nxp-nci/firmware.c | 9 ++++++---
>  2 files changed, 9 insertions(+), 7 deletions(-)
Please squash that one into the first patch.

Cheers,
Samuel.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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);