Skip to contentSkip to conversation

spi: spi_sh: calling spi_unregister_master instead of spi_master_put in spi_sh_remove

PATCH Applied Axel Lin 2 participants 4 messages May 11, 2011 – May 19, 2011

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 spi: spi_sh: calling spi_unregister_master instead of spi_master_put in spi_sh_remove

spi_master_put() should only be used in error handling. Once spi_register_master() returns success, we should call spi_unregister_master() instead.

---
 drivers/spi/spi_sh.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/spi_sh.c +1 -1
index 869a07d..9eedd71 100644
@@ -427,10 +427,10 @@ static int __devexit spi_sh_remove(struct platform_device *pdev)
 {
 	struct spi_sh_data *ss = dev_get_drvdata(&pdev->dev);
 
+	spi_unregister_master(ss->master);
 	destroy_workqueue(ss->workqueue);
 	free_irq(ss->irq, ss);
 	iounmap(ss->addr);
-	spi_master_put(ss->master);
 
 	return 0;
 }
Signature · 11 lines
1.7.1




------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
author
#1 lore raw

PATCH 2/2 spi: spi_tegra: calling spi_unregister_master instead of spi_master_put in spi_tegra_remove

spi_master_put() should only be used in error handling. Once spi_register_master() returns success, we should call spi_unregister_master() instead.

---
 drivers/spi/spi_tegra.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/spi_tegra.c +1 -1
index 891e590..6c3aa6e 100644
@@ -578,6 +578,7 @@ static int __devexit spi_tegra_remove(struct platform_device *pdev)
 	master = dev_get_drvdata(&pdev->dev);
 	tspi = spi_master_get_devdata(master);
 
+	spi_unregister_master(master);
 	tegra_dma_free_channel(tspi->rx_dma);
 
 	dma_free_coherent(&pdev->dev, sizeof(u32) * BB_LEN,
@@ -586,7 +587,6 @@ static int __devexit spi_tegra_remove(struct platform_device *pdev)
 	clk_put(tspi->clk);
 	iounmap(tspi->base);
 
-	spi_master_put(master);
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	release_mem_region(r->start, (r->end - r->start) + 1);
 
Signature · 11 lines
1.7.1




------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
Applied
#2 lore raw

Re: [PATCH 2/2] spi: spi_tegra: calling spi_unregister_master instead of spi_master_put in spi_tegra_remove

Quoted 5 lines · Axel Lin

spi_master_put() should only be used in error handling. Once spi_register_master() returns success, we should call spi_unregister_master() instead.

Applied, thanks.

g.

Quoted 29 lines
---
 drivers/spi/spi_tegra.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/spi_tegra.c +1 -1
index 891e590..6c3aa6e 100644
@@ -578,6 +578,7 @@ static int __devexit spi_tegra_remove(struct platform_device *pdev)
 	master = dev_get_drvdata(&pdev->dev);
 	tspi = spi_master_get_devdata(master);
 
+	spi_unregister_master(master);
 	tegra_dma_free_channel(tspi->rx_dma);
 
 	dma_free_coherent(&pdev->dev, sizeof(u32) * BB_LEN,
@@ -586,7 +587,6 @@ static int __devexit spi_tegra_remove(struct platform_device *pdev)
 	clk_put(tspi->clk);
 	iounmap(tspi->base);
 
-	spi_master_put(master);
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	release_mem_region(r->start, (r->end - r->start) + 1);
 
Signature · 1 line
1.7.1
Applied
#3 lore raw
In reply to Axel Lin
Quoted 5 lines · Axel Lin

spi_master_put() should only be used in error handling. Once spi_register_master() returns success, we should call spi_unregister_master() instead.

Applied, thanks.

g.

Quoted 25 lines
---
 drivers/spi/spi_sh.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/spi_sh.c +1 -1
index 869a07d..9eedd71 100644
@@ -427,10 +427,10 @@ static int __devexit spi_sh_remove(struct platform_device *pdev)
 {
 	struct spi_sh_data *ss = dev_get_drvdata(&pdev->dev);
 
+	spi_unregister_master(ss->master);
 	destroy_workqueue(ss->workqueue);
 	free_irq(ss->irq, ss);
 	iounmap(ss->addr);
-	spi_master_put(ss->master);
 
 	return 0;
 }
Signature · 1 line
1.7.1