All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
To: Jingoo Han <jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	'Mark Brown' <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: <linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 1/2] spi: spi-atmel: Use devm_*() functions
Date: Wed, 4 Dec 2013 10:47:36 +0100	[thread overview]
Message-ID: <529EFA38.7050404@atmel.com> (raw)
In-Reply-To: <002b01cef0ae$c8261dc0$58725940$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

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

  parent reply	other threads:[~2013-12-04  9:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Nicolas Ferre [this message]
     [not found]     ` <529EFA38.7050404-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2013-12-04 11:59       ` [PATCH 1/2] spi: spi-atmel: " Mark Brown
     [not found]         ` <20131204115921.GL29268-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-12-04 12:07           ` Nicolas Ferre
2013-12-05  2:27           ` Jingoo Han

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=529EFA38.7050404@atmel.com \
    --to=nicolas.ferre-aife0yeh4naavxtiumwx3w@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=jg1.han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.