* [PATCH 1/2] spi: spi-atmel: Use devm_*() functions
@ 2013-12-04 5:07 Jingoo Han
[not found] ` <002b01cef0ae$c8261dc0$58725940$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Jingoo Han @ 2013-12-04 5:07 UTC (permalink / raw)
To: 'Mark Brown'
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, 'Jingoo Han',
'Nicolas Ferre'
Use devm_*() functions to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
drivers/spi/spi-atmel.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 273db0b..57fa738 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1510,7 +1510,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
if (irq < 0)
return irq;
- clk = clk_get(&pdev->dev, "spi_clk");
+ clk = devm_clk_get(&pdev->dev, "spi_clk");
if (IS_ERR(clk))
return PTR_ERR(clk);
@@ -1570,14 +1570,14 @@ static int atmel_spi_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "Atmel SPI Controller using PIO only\n");
if (as->use_pdc) {
- ret = request_irq(irq, atmel_spi_pdc_interrupt, 0,
- dev_name(&pdev->dev), master);
+ ret = devm_request_irq(&pdev->dev, irq, atmel_spi_pdc_interrupt,
+ 0, dev_name(&pdev->dev), master);
} else {
tasklet_init(&as->tasklet, atmel_spi_tasklet_func,
(unsigned long)master);
- ret = request_irq(irq, atmel_spi_pio_interrupt, 0,
- dev_name(&pdev->dev), master);
+ ret = devm_request_irq(&pdev->dev, irq, atmel_spi_pio_interrupt,
+ 0, dev_name(&pdev->dev), master);
}
if (ret)
goto out_unmap_regs;
@@ -1603,7 +1603,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "Atmel SPI Controller at 0x%08lx (irq %d)\n",
(unsigned long)regs->start, irq);
- ret = spi_register_master(master);
+ ret = devm_spi_register_master(&pdev->dev, master);
if (ret)
goto out_free_dma;
@@ -1617,7 +1617,6 @@ out_free_dma:
spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
clk_disable_unprepare(clk);
out_free_irq:
- free_irq(irq, master);
out_unmap_regs:
out_free_buffer:
if (!as->use_pdc)
@@ -1625,7 +1624,6 @@ out_free_buffer:
dma_free_coherent(&pdev->dev, BUFFER_SIZE, as->buffer,
as->buffer_dma);
out_free:
- clk_put(clk);
spi_master_put(master);
return ret;
}
@@ -1668,10 +1666,6 @@ static int atmel_spi_remove(struct platform_device *pdev)
as->buffer_dma);
clk_disable_unprepare(as->clk);
- clk_put(as->clk);
- free_irq(as->irq, master);
-
- spi_unregister_master(master);
return 0;
}
--
1.7.10.4
--
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] 7+ messages in thread
* [PATCH 2/2] spi: coldfire-qspi: Use devm_*() functions
[not found] ` <002b01cef0ae$c8261dc0$58725940$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
@ 2013-12-04 5:10 ` Jingoo Han
[not found] ` <002c01cef0af$1b3a4630$51aed290$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-04 9:47 ` [PATCH 1/2] spi: spi-atmel: " Nicolas Ferre
1 sibling, 1 reply; 7+ messages in thread
From: Jingoo Han @ 2013-12-04 5:10 UTC (permalink / raw)
To: 'Mark Brown'
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, 'Jingoo Han',
'Steven King'
Use devm_*() functions to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
drivers/spi/spi-coldfire-qspi.c | 47 ++++++++++++---------------------------
1 file changed, 14 insertions(+), 33 deletions(-)
diff --git a/drivers/spi/spi-coldfire-qspi.c b/drivers/spi/spi-coldfire-qspi.c
index cc5b75d..9ee81a4 100644
--- a/drivers/spi/spi-coldfire-qspi.c
+++ b/drivers/spi/spi-coldfire-qspi.c
@@ -403,38 +403,31 @@ static int mcfqspi_probe(struct platform_device *pdev)
goto fail0;
}
- if (!request_mem_region(res->start, resource_size(res), pdev->name)) {
- dev_dbg(&pdev->dev, "request_mem_region failed\n");
- status = -EBUSY;
+ mcfqspi->iobase = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(mcfqspi->iobase)) {
+ status = PTR_ERR(mcfqspi->iobase);
goto fail0;
}
- mcfqspi->iobase = ioremap(res->start, resource_size(res));
- if (!mcfqspi->iobase) {
- dev_dbg(&pdev->dev, "ioremap failed\n");
- status = -ENOMEM;
- goto fail1;
- }
-
mcfqspi->irq = platform_get_irq(pdev, 0);
if (mcfqspi->irq < 0) {
dev_dbg(&pdev->dev, "platform_get_irq failed\n");
status = -ENXIO;
- goto fail2;
+ goto fail0;
}
- status = request_irq(mcfqspi->irq, mcfqspi_irq_handler, 0,
- pdev->name, mcfqspi);
+ status = devm_request_irq(&pdev->dev, mcfqspi->irq, mcfqspi_irq_handler,
+ 0, pdev->name, mcfqspi);
if (status) {
dev_dbg(&pdev->dev, "request_irq failed\n");
- goto fail2;
+ goto fail0;
}
- mcfqspi->clk = clk_get(&pdev->dev, "qspi_clk");
+ mcfqspi->clk = devm_clk_get(&pdev->dev, "qspi_clk");
if (IS_ERR(mcfqspi->clk)) {
dev_dbg(&pdev->dev, "clk_get failed\n");
status = PTR_ERR(mcfqspi->clk);
- goto fail3;
+ goto fail0;
}
clk_enable(mcfqspi->clk);
@@ -445,7 +438,7 @@ static int mcfqspi_probe(struct platform_device *pdev)
status = mcfqspi_cs_setup(mcfqspi);
if (status) {
dev_dbg(&pdev->dev, "error initializing cs_control\n");
- goto fail4;
+ goto fail1;
}
init_waitqueue_head(&mcfqspi->waitq);
@@ -459,10 +452,10 @@ static int mcfqspi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, master);
- status = spi_register_master(master);
+ status = devm_spi_register_master(&pdev->dev, master);
if (status) {
dev_dbg(&pdev->dev, "spi_register_master failed\n");
- goto fail5;
+ goto fail2;
}
pm_runtime_enable(mcfqspi->dev);
@@ -470,17 +463,10 @@ static int mcfqspi_probe(struct platform_device *pdev)
return 0;
-fail5:
- mcfqspi_cs_teardown(mcfqspi);
-fail4:
- clk_disable(mcfqspi->clk);
- clk_put(mcfqspi->clk);
-fail3:
- free_irq(mcfqspi->irq, mcfqspi);
fail2:
- iounmap(mcfqspi->iobase);
+ mcfqspi_cs_teardown(mcfqspi);
fail1:
- release_mem_region(res->start, resource_size(res));
+ clk_disable(mcfqspi->clk);
fail0:
spi_master_put(master);
@@ -501,11 +487,6 @@ static int mcfqspi_remove(struct platform_device *pdev)
mcfqspi_cs_teardown(mcfqspi);
clk_disable(mcfqspi->clk);
- clk_put(mcfqspi->clk);
- free_irq(mcfqspi->irq, mcfqspi);
- iounmap(mcfqspi->iobase);
- release_mem_region(res->start, resource_size(res));
- spi_unregister_master(master);
return 0;
}
--
1.7.10.4
--
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] 7+ messages in thread
* Re: [PATCH 1/2] spi: spi-atmel: Use devm_*() functions
[not found] ` <002b01cef0ae$c8261dc0$58725940$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-04 5:10 ` [PATCH 2/2] spi: coldfire-qspi: " Jingoo Han
@ 2013-12-04 9:47 ` Nicolas Ferre
[not found] ` <529EFA38.7050404-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
1 sibling, 1 reply; 7+ messages in thread
From: Nicolas Ferre @ 2013-12-04 9:47 UTC (permalink / raw)
To: Jingoo Han, 'Mark Brown'; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA
On 04/12/2013 06:07, Jingoo Han :
> Use devm_*() functions to make cleanup paths simpler.
>
> Signed-off-by: Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---
> drivers/spi/spi-atmel.c | 18 ++++++------------
> 1 file changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
> index 273db0b..57fa738 100644
> --- a/drivers/spi/spi-atmel.c
> +++ b/drivers/spi/spi-atmel.c
> @@ -1510,7 +1510,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
> if (irq < 0)
> return irq;
>
> - clk = clk_get(&pdev->dev, "spi_clk");
> + clk = devm_clk_get(&pdev->dev, "spi_clk");
> if (IS_ERR(clk))
> return PTR_ERR(clk);
>
> @@ -1570,14 +1570,14 @@ static int atmel_spi_probe(struct platform_device *pdev)
> dev_info(&pdev->dev, "Atmel SPI Controller using PIO only\n");
>
> if (as->use_pdc) {
> - ret = request_irq(irq, atmel_spi_pdc_interrupt, 0,
> - dev_name(&pdev->dev), master);
> + ret = devm_request_irq(&pdev->dev, irq, atmel_spi_pdc_interrupt,
> + 0, dev_name(&pdev->dev), master);
> } else {
> tasklet_init(&as->tasklet, atmel_spi_tasklet_func,
> (unsigned long)master);
>
> - ret = request_irq(irq, atmel_spi_pio_interrupt, 0,
> - dev_name(&pdev->dev), master);
> + ret = devm_request_irq(&pdev->dev, irq, atmel_spi_pio_interrupt,
> + 0, dev_name(&pdev->dev), master);
> }
> if (ret)
> goto out_unmap_regs;
> @@ -1603,7 +1603,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
> dev_info(&pdev->dev, "Atmel SPI Controller at 0x%08lx (irq %d)\n",
> (unsigned long)regs->start, irq);
>
> - ret = spi_register_master(master);
> + ret = devm_spi_register_master(&pdev->dev, master);
> if (ret)
> goto out_free_dma;
>
> @@ -1617,7 +1617,6 @@ out_free_dma:
> spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
> clk_disable_unprepare(clk);
> out_free_irq:
> - free_irq(irq, master);
> out_unmap_regs:
> out_free_buffer:
What about taking advantage of this cleanup patch to remove the 3 above
unneeded tags?
Otherwise, you can add my:
Acked-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
> if (!as->use_pdc)
> @@ -1625,7 +1624,6 @@ out_free_buffer:
> dma_free_coherent(&pdev->dev, BUFFER_SIZE, as->buffer,
> as->buffer_dma);
> out_free:
> - clk_put(clk);
> spi_master_put(master);
> return ret;
> }
> @@ -1668,10 +1666,6 @@ static int atmel_spi_remove(struct platform_device *pdev)
> as->buffer_dma);
>
> clk_disable_unprepare(as->clk);
> - clk_put(as->clk);
> - free_irq(as->irq, master);
> -
> - spi_unregister_master(master);
>
> return 0;
> }
>
--
Nicolas Ferre
--
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] 7+ messages in thread
* Re: [PATCH 1/2] spi: spi-atmel: Use devm_*() functions
[not found] ` <529EFA38.7050404-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
@ 2013-12-04 11:59 ` Mark Brown
[not found] ` <20131204115921.GL29268-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2013-12-04 11:59 UTC (permalink / raw)
To: Nicolas Ferre; +Cc: Jingoo Han, linux-spi-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 537 bytes --]
On Wed, Dec 04, 2013 at 10:47:36AM +0100, Nicolas Ferre wrote:
> On 04/12/2013 06:07, Jingoo Han :
> > out_free_irq:
> >- free_irq(irq, master);
> > out_unmap_regs:
> > out_free_buffer:
> What about taking advantage of this cleanup patch to remove the 3
> above unneeded tags?
> Otherwise, you can add my:
> Acked-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
That's a good idea but it means going and changing all the gotos as well
so it probably warrants a separate patch. I applied this one as-is.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] spi: coldfire-qspi: Use devm_*() functions
[not found] ` <002c01cef0af$1b3a4630$51aed290$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
@ 2013-12-04 12:00 ` Mark Brown
0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2013-12-04 12:00 UTC (permalink / raw)
To: Jingoo Han; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, 'Steven King'
[-- Attachment #1: Type: text/plain, Size: 134 bytes --]
On Wed, Dec 04, 2013 at 02:10:10PM +0900, Jingoo Han wrote:
> Use devm_*() functions to make cleanup paths simpler.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] spi: spi-atmel: Use devm_*() functions
[not found] ` <20131204115921.GL29268-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2013-12-04 12:07 ` Nicolas Ferre
2013-12-05 2:27 ` Jingoo Han
1 sibling, 0 replies; 7+ messages in thread
From: Nicolas Ferre @ 2013-12-04 12:07 UTC (permalink / raw)
To: Mark Brown; +Cc: Jingoo Han, linux-spi-u79uwXL29TY76Z2rM5mHXA
On 04/12/2013 12:59, Mark Brown :
> On Wed, Dec 04, 2013 at 10:47:36AM +0100, Nicolas Ferre wrote:
>> On 04/12/2013 06:07, Jingoo Han :
>
>>> out_free_irq:
>>> - free_irq(irq, master);
>>> out_unmap_regs:
>>> out_free_buffer:
>
>> What about taking advantage of this cleanup patch to remove the 3
>> above unneeded tags?
>
>> Otherwise, you can add my:
>> Acked-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
>
> That's a good idea but it means going and changing all the gotos as well
> so it probably warrants a separate patch. I applied this one as-is.
True! Thanks Mark.
Bye,
--
Nicolas Ferre
--
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] 7+ messages in thread
* Re: [PATCH 1/2] spi: spi-atmel: Use devm_*() functions
[not found] ` <20131204115921.GL29268-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-12-04 12:07 ` Nicolas Ferre
@ 2013-12-05 2:27 ` Jingoo Han
1 sibling, 0 replies; 7+ messages in thread
From: Jingoo Han @ 2013-12-05 2:27 UTC (permalink / raw)
To: 'Mark Brown'
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, 'Nicolas Ferre',
'Jingoo Han'
On Wednesday, December 04, 2013 8:59 PM, Mark Brown wrote:
> On Wed, Dec 04, 2013 at 10:47:36AM +0100, Nicolas Ferre wrote:
> > On 04/12/2013 06:07, Jingoo Han :
>
> > > out_free_irq:
> > >- free_irq(irq, master);
> > > out_unmap_regs:
> > > out_free_buffer:
>
> > What about taking advantage of this cleanup patch to remove the 3
> > above unneeded tags?
>
> > Otherwise, you can add my:
> > Acked-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
>
> That's a good idea but it means going and changing all the gotos as well
> so it probably warrants a separate patch. I applied this one as-is.
Hi Mark Brown,
I checked your for-next branch of spi.git.
However, in this commit, 'Acked-by:' was omitted as below:
Signed-off-by: Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---> Acked-by: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Mark Brown <broonie-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
When you merge your topics next time, would you add 'Acked-by:'
to this commit? :-)
Thank you.
Best regards,
Jingoo Han
--
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] 7+ messages in thread
end of thread, other threads:[~2013-12-05 2:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-04 5:07 [PATCH 1/2] spi: spi-atmel: Use devm_*() functions Jingoo Han
[not found] ` <002b01cef0ae$c8261dc0$58725940$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-04 5:10 ` [PATCH 2/2] spi: coldfire-qspi: " Jingoo Han
[not found] ` <002c01cef0af$1b3a4630$51aed290$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-04 12:00 ` Mark Brown
2013-12-04 9:47 ` [PATCH 1/2] spi: spi-atmel: " Nicolas Ferre
[not found] ` <529EFA38.7050404-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2013-12-04 11:59 ` Mark Brown
[not found] ` <20131204115921.GL29268-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-12-04 12:07 ` Nicolas Ferre
2013-12-05 2:27 ` Jingoo Han
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).