From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Soren Brinkmann <soren.brinkmann@xilinx.com>,
<netdev@vger.kernel.org>, David Miller <davem@davemloft.net>
Cc: <linux-kernel@vger.kernel.org>, Michal Simek <michal.simek@xilinx.com>
Subject: Re: [PATCH RFC 2/5] net: macb: Migrate to devm clock interface
Date: Tue, 15 Oct 2013 09:44:37 +0200 [thread overview]
Message-ID: <525CF265.20506@atmel.com> (raw)
In-Reply-To: <1381795140-10792-3-git-send-email-soren.brinkmann@xilinx.com>
On 15/10/2013 01:58, Soren Brinkmann :
> Migrate to using the device managed intreface for clocks and clean up
> the associated error paths.
>
> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> drivers/net/ethernet/cadence/macb.c | 32 ++++++++++++++++++++------------
> 1 file changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
> index 389ccf1362d5..62aa136889a4 100644
> --- a/drivers/net/ethernet/cadence/macb.c
> +++ b/drivers/net/ethernet/cadence/macb.c
> @@ -1790,19 +1790,31 @@ static int __init macb_probe(struct platform_device *pdev)
> spin_lock_init(&bp->lock);
> INIT_WORK(&bp->tx_error_task, macb_tx_error_task);
>
> - bp->pclk = clk_get(&pdev->dev, "pclk");
> + bp->pclk = devm_clk_get(&pdev->dev, "pclk");
> if (IS_ERR(bp->pclk)) {
> - dev_err(&pdev->dev, "failed to get macb_clk\n");
> + err = PTR_ERR(bp->pclk);
> + dev_err(&pdev->dev, "failed to get macb_clk (%u)\n", err);
> goto err_out_free_dev;
> }
> - clk_prepare_enable(bp->pclk);
>
> - bp->hclk = clk_get(&pdev->dev, "hclk");
> + bp->hclk = devm_clk_get(&pdev->dev, "hclk");
> if (IS_ERR(bp->hclk)) {
> - dev_err(&pdev->dev, "failed to get hclk\n");
> - goto err_out_put_pclk;
> + err = PTR_ERR(bp->hclk);
> + dev_err(&pdev->dev, "failed to get hclk (%u)\n", err);
> + goto err_out_free_dev;
> + }
> +
> + err = clk_prepare_enable(bp->pclk);
> + if (err) {
> + dev_err(&pdev->dev, "failed to enable pclk (%u)\n", err);
> + goto err_out_free_dev;
> + }
> +
> + err = clk_prepare_enable(bp->hclk);
> + if (err) {
> + dev_err(&pdev->dev, "failed to enable hclk (%u)\n", err);
> + goto err_out_disable_pclk;
> }
> - clk_prepare_enable(bp->hclk);
>
> bp->regs = ioremap(regs->start, resource_size(regs));
> if (!bp->regs) {
> @@ -1908,10 +1920,8 @@ err_out_iounmap:
> iounmap(bp->regs);
> err_out_disable_clocks:
> clk_disable_unprepare(bp->hclk);
> - clk_put(bp->hclk);
> +err_out_disable_pclk:
> clk_disable_unprepare(bp->pclk);
> -err_out_put_pclk:
> - clk_put(bp->pclk);
> err_out_free_dev:
> free_netdev(dev);
> err_out:
> @@ -1936,9 +1946,7 @@ static int __exit macb_remove(struct platform_device *pdev)
> free_irq(dev->irq, dev);
> iounmap(bp->regs);
> clk_disable_unprepare(bp->hclk);
> - clk_put(bp->hclk);
> clk_disable_unprepare(bp->pclk);
> - clk_put(bp->pclk);
> free_netdev(dev);
> }
>
>
--
Nicolas Ferre
next prev parent reply other threads:[~2013-10-15 7:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-14 23:58 [PATCH RFC 0/5] Ethernet support for Zynq Soren Brinkmann
2013-10-14 23:58 ` [PATCH RFC 1/5] net: macb: Migrate to dev_pm_ops Soren Brinkmann
2013-10-15 7:41 ` Nicolas Ferre
2013-10-14 23:58 ` [PATCH RFC 2/5] net: macb: Migrate to devm clock interface Soren Brinkmann
2013-10-15 7:44 ` Nicolas Ferre [this message]
2013-10-14 23:58 ` [PATCH RFC 3/5] net: macb: Use devm_ioremap() Soren Brinkmann
2013-10-15 7:45 ` Nicolas Ferre
2013-10-14 23:58 ` [PATCH RFC 4/5] net: macb: Use devm_request_irq() Soren Brinkmann
2013-10-15 7:46 ` Nicolas Ferre
2013-10-15 19:21 ` Sergei Shtylyov
2013-10-15 20:20 ` Sören Brinkmann
2013-10-15 20:38 ` Sergei Shtylyov
2013-10-14 23:59 ` [PATCH RFC 5/5] net: macb: Adjust tx_clk when link speed changes Soren Brinkmann
2013-10-15 7:54 ` Nicolas Ferre
2013-10-15 7:58 ` Michal Simek
2013-10-15 15:34 ` Sören Brinkmann
2013-11-22 19:31 ` Sören Brinkmann
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=525CF265.20506@atmel.com \
--to=nicolas.ferre@atmel.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=netdev@vger.kernel.org \
--cc=soren.brinkmann@xilinx.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox