netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: sean.wang@mediatek.com
Cc: john@phrozen.org, davem@davemloft.net, nbd@openwrt.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH net-next 2/4] net-next: mediatek: add platform data to adapt into various hardware
Date: Wed, 12 Jul 2017 16:50:50 +0200	[thread overview]
Message-ID: <20170712145050.GD2557@lunn.ch> (raw)
In-Reply-To: <401e9fa04ea4759c936fa5af11bb2b5c97ef14f0.1499829241.git.sean.wang@mediatek.com>

> +static int mtk_clk_enable(struct mtk_eth *eth)
> +{
> +	int clk, ret;
> +
> +	for (clk = 0; clk < MTK_CLK_MAX ; clk++) {
> +		if (eth->clks[clk]) {
> +			ret = clk_prepare_enable(eth->clks[clk]);
> +			if (ret)
> +				goto err_disable_clks;
> +		}
> +	}
> +
> +	return 0;
> +
> +err_disable_clks:
> +	while (--clk >= 0) {
> +		if (eth->clks[clk])
> +			clk_disable_unprepare(eth->clks[clk]);
> +	}
> +
> +	return ret;
> +}

> +
>  static int mtk_hw_init(struct mtk_eth *eth)
>  {
>  	int i, val;
> @@ -1847,10 +1881,8 @@ static int mtk_hw_init(struct mtk_eth *eth)
>  	pm_runtime_enable(eth->dev);
>  	pm_runtime_get_sync(eth->dev);
>  
> -	clk_prepare_enable(eth->clks[MTK_CLK_ETHIF]);
> -	clk_prepare_enable(eth->clks[MTK_CLK_ESW]);
> -	clk_prepare_enable(eth->clks[MTK_CLK_GP1]);
> -	clk_prepare_enable(eth->clks[MTK_CLK_GP2]);
> +	mtk_clk_enable(eth);
> +

mtk_clk_enable() returns an error code. It is probably a good idea to
use it, especially if it could be EPRODE_DEFER.

    Andrew

  parent reply	other threads:[~2017-07-12 14:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-12  3:37 [PATCH net-next 0/4] net-next: mediatek: add support for ethernet on MT7622 SoC sean.wang
2017-07-12  3:37 ` [PATCH net-next 1/4] dt-bindings: net: mediatek: add support for MediaTek MT7623 and " sean.wang
     [not found] ` <cover.1499829241.git.sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2017-07-12  3:37   ` [PATCH net-next 2/4] net-next: mediatek: add platform data to adapt into various hardware sean.wang-NuS5LvNUpcJWk0Htik3J/w
2017-07-12  4:19     ` Florian Fainelli
2017-07-12 14:50     ` Andrew Lunn [this message]
2017-07-15  1:47       ` Sean Wang
2017-07-12  3:37   ` [PATCH net-next 3/4] net-next: mediatek: add support for MediaTek MT7622 SoC sean.wang-NuS5LvNUpcJWk0Htik3J/w
2017-07-12 15:00     ` Andrew Lunn
2017-07-12  3:37 ` [PATCH net-next 4/4] MAINTAINERS: add Sean/Nelson as MediaTek ethernet maintainers sean.wang
2017-07-12  3:53 ` [PATCH net-next 0/4] net-next: mediatek: add support for ethernet on MT7622 SoC David Miller

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=20170712145050.GD2557@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=john@phrozen.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=nbd@openwrt.org \
    --cc=netdev@vger.kernel.org \
    --cc=sean.wang@mediatek.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;
as well as URLs for NNTP newsgroup(s).