linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 0/2] spi/qspi: Fix remove path and miscellaneous cleanup.
@ 2013-11-19 13:07 Sourav Poddar
       [not found] ` <1384866436-11542-1-git-send-email-sourav.poddar-l0cyMroinI0@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Sourav Poddar @ 2013-11-19 13:07 UTC (permalink / raw)
  To: broonie-DgEjT+Ai2ygdnm+yROfE0A
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, Sourav Poddar

The patch series fix remove path and did a miscellaneous
cleanup in pm_runtime error check.

Tested on DRA7 board.

Reabsed on Mark Brown tree, branch: topic/qspi.

v1->v2:
- split the patches
- Document the bug fixed.

Sourav Poddar (2):
  spi/qspi: cleanup pm_runtime error check.
  spi/qspi: Fix qspi remove path.

 drivers/spi/spi-ti-qspi.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCHv2 1/2] spi/qspi: cleanup pm_runtime error check.
       [not found] ` <1384866436-11542-1-git-send-email-sourav.poddar-l0cyMroinI0@public.gmane.org>
@ 2013-11-19 13:07   ` Sourav Poddar
  2013-11-19 13:07   ` [PATCHv2 2/2] spi/qspi: Fix qspi remove path Sourav Poddar
  2013-11-19 19:21   ` [PATCHv2 0/2] spi/qspi: Fix remove path and miscellaneous cleanup Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Sourav Poddar @ 2013-11-19 13:07 UTC (permalink / raw)
  To: broonie-DgEjT+Ai2ygdnm+yROfE0A
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, Sourav Poddar

clean up pm_runtime error check in accordance with rest of the check in
the driver.

Signed-off-by: Sourav Poddar <sourav.poddar-l0cyMroinI0@public.gmane.org>
---
 drivers/spi/spi-ti-qspi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
index 0b71270..b6ab396 100644
--- a/drivers/spi/spi-ti-qspi.c
+++ b/drivers/spi/spi-ti-qspi.c
@@ -161,7 +161,7 @@ static int ti_qspi_setup(struct spi_device *spi)
 			qspi->spi_max_frequency, clk_div);
 
 	ret = pm_runtime_get_sync(qspi->dev);
-	if (ret) {
+	if (ret < 0) {
 		dev_err(qspi->dev, "pm_runtime_get_sync() failed\n");
 		return ret;
 	}
-- 
1.7.1

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCHv2 2/2] spi/qspi: Fix qspi remove path.
       [not found] ` <1384866436-11542-1-git-send-email-sourav.poddar-l0cyMroinI0@public.gmane.org>
  2013-11-19 13:07   ` [PATCHv2 1/2] spi/qspi: cleanup pm_runtime error check Sourav Poddar
@ 2013-11-19 13:07   ` Sourav Poddar
  2013-11-19 19:21   ` [PATCHv2 0/2] spi/qspi: Fix remove path and miscellaneous cleanup Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Sourav Poddar @ 2013-11-19 13:07 UTC (permalink / raw)
  To: broonie-DgEjT+Ai2ygdnm+yROfE0A
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, Sourav Poddar

There is a bug in qspi removal path, as a result of which
qspi cannot be removed when used as a module. The patch
solves the bug and qspi can be removed cleanly.

The bugs fixed are:
-pm_runtime used around register access.
- pm_runtime_disable need to be done before removal.
- spi_unregister_master need to be called to unregister
   the spi device.
Tested on DRA7 board.

Signed-off-by: Sourav Poddar <sourav.poddar-l0cyMroinI0@public.gmane.org>
---
 drivers/spi/spi-ti-qspi.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
index b6ab396..033ef8d 100644
--- a/drivers/spi/spi-ti-qspi.c
+++ b/drivers/spi/spi-ti-qspi.c
@@ -517,10 +517,26 @@ free_master:
 
 static int ti_qspi_remove(struct platform_device *pdev)
 {
-	struct	ti_qspi *qspi = platform_get_drvdata(pdev);
+	struct spi_master *master;
+	struct ti_qspi *qspi;
+	int ret;
+
+	master = platform_get_drvdata(pdev);
+	qspi = spi_master_get_devdata(master);
+
+	ret = pm_runtime_get_sync(qspi->dev);
+	if (ret < 0) {
+		dev_err(qspi->dev, "pm_runtime_get_sync() failed\n");
+		return ret;
+	}
 
 	ti_qspi_write(qspi, QSPI_WC_INT_DISABLE, QSPI_INTR_ENABLE_CLEAR_REG);
 
+	pm_runtime_put(qspi->dev);
+	pm_runtime_disable(&pdev->dev);
+
+	spi_unregister_master(master);
+
 	return 0;
 }
 
-- 
1.7.1

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCHv2 0/2] spi/qspi: Fix remove path and miscellaneous cleanup.
       [not found] ` <1384866436-11542-1-git-send-email-sourav.poddar-l0cyMroinI0@public.gmane.org>
  2013-11-19 13:07   ` [PATCHv2 1/2] spi/qspi: cleanup pm_runtime error check Sourav Poddar
  2013-11-19 13:07   ` [PATCHv2 2/2] spi/qspi: Fix qspi remove path Sourav Poddar
@ 2013-11-19 19:21   ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2013-11-19 19:21 UTC (permalink / raw)
  To: Sourav Poddar; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 182 bytes --]

On Tue, Nov 19, 2013 at 06:37:14PM +0530, Sourav Poddar wrote:
> The patch series fix remove path and did a miscellaneous
> cleanup in pm_runtime error check.

Applied both, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-19 19:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-19 13:07 [PATCHv2 0/2] spi/qspi: Fix remove path and miscellaneous cleanup Sourav Poddar
     [not found] ` <1384866436-11542-1-git-send-email-sourav.poddar-l0cyMroinI0@public.gmane.org>
2013-11-19 13:07   ` [PATCHv2 1/2] spi/qspi: cleanup pm_runtime error check Sourav Poddar
2013-11-19 13:07   ` [PATCHv2 2/2] spi/qspi: Fix qspi remove path Sourav Poddar
2013-11-19 19:21   ` [PATCHv2 0/2] spi/qspi: Fix remove path and miscellaneous cleanup Mark Brown

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