netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@collabora.com
Subject: Re: [PATCHv2 1/2] net: ethernet: stmmac: dwmac-rk: rework optional clock handling
Date: Wed, 5 Apr 2023 19:42:05 +0200	[thread overview]
Message-ID: <ZC2y7TWGbh9ZSuhs@corigine.com> (raw)
In-Reply-To: <20230405161043.46190-2-sebastian.reichel@collabora.com>

On Wed, Apr 05, 2023 at 06:10:42PM +0200, Sebastian Reichel wrote:
> The clock requesting code is quite repetitive. Fix this by requesting
> the clocks in a loop. Also use devm_clk_get_optional instead of
> devm_clk_get, since the old code effectively handles them as optional
> clocks. This removes error messages about missing clocks for platforms
> not using them and correct -EPROBE_DEFER handling.
> 
> The new code also tries to get "clk_mac_ref" and "clk_mac_refout" when
> the PHY is not configured as PHY_INTERFACE_MODE_RMII to keep the code
> simple. This is possible since we use devm_clk_get_optional() for the
> clock lookup anyways.
> 
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> Fixes: 7ad269ea1a2b7 ("GMAC: add driver for Rockchip RK3288 SoCs integrated GMAC")
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

Reviewed-by: Simon Horman <simon.horman@corigine.com>

> +	for (i=0; i < ARRAY_SIZE(clocks); i++) {

nit: spaces around '='. i.e. 'i = 0;'

> +		*clocks[i].ptr = devm_clk_get_optional(dev, clocks[i].name);
> +		if (IS_ERR(*clocks[i].ptr))
> +			return dev_err_probe(dev, PTR_ERR(*clocks[i].ptr),
> +					     "cannot get clock %s\n",
> +					     clocks[i].name);
>  	}

...

  reply	other threads:[~2023-04-05 17:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-05 16:10 [PATCHv2 0/2] Fix RK3588 error prints Sebastian Reichel
2023-04-05 16:10 ` [PATCHv2 1/2] net: ethernet: stmmac: dwmac-rk: rework optional clock handling Sebastian Reichel
2023-04-05 17:42   ` Simon Horman [this message]
2023-04-05 19:05   ` Andrew Lunn
2023-04-05 16:10 ` [PATCHv2 2/2] net: ethernet: stmmac: dwmac-rk: fix optional phy regulator handling Sebastian Reichel
2023-04-05 17:43   ` Simon Horman
2023-04-05 18:20     ` Sebastian Reichel

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=ZC2y7TWGbh9ZSuhs@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=joabreu@synopsys.com \
    --cc=kernel@collabora.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peppe.cavallaro@st.com \
    --cc=sebastian.reichel@collabora.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).