All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josua Mayer <josua@solid-run.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH 3/4] net: mvmdio: print warning when orion-mdio has too many clocks
Date: Sat, 6 Jul 2019 18:21:34 +0200	[thread overview]
Message-ID: <8d24d716-2f64-37d3-a7f2-1725d48c7d5f@solid-run.com> (raw)
In-Reply-To: <20190706160925.GI4428@lunn.ch>

Hi Andrew,

Am 06.07.19 um 18:09 schrieb Andrew Lunn:
> On Sat, Jul 06, 2019 at 05:18:59PM +0200, josua@solid-run.com wrote:
>> From: Josua Mayer <josua@solid-run.com>
>>
>> Print a warning when device tree specifies more than the maximum of four
>> clocks supported by orion-mdio. Because reading from mdio can lock up
>> the Armada 8k when a required clock is not initialized, it is important
>> to notify the user when a specified clock is ignored.
>>
>> Signed-off-by: Josua Mayer <josua@solid-run.com>
>> ---
>>  drivers/net/ethernet/marvell/mvmdio.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
>> index e17d563e97a6..89a99bf8e87b 100644
>> --- a/drivers/net/ethernet/marvell/mvmdio.c
>> +++ b/drivers/net/ethernet/marvell/mvmdio.c
>> @@ -326,6 +326,10 @@ static int orion_mdio_probe(struct platform_device *pdev)
>>  		clk_prepare_enable(dev->clk[i]);
>>  	}
>>  
>> +	if (!IS_ERR(of_clk_get(pdev->dev.of_node, i)))
>> +		dev_warn(dev, "unsupported number of clocks, limiting to the first "
>> +			 __stringify(ARRAY_SIZE(dev->clk)) "\n");
>> +
> Hi Josua
>
> Humm. Say getting clock 0 returned -EINVAL, or some other error code.
> We break out of the loop, since such errors are being ignored. We then
> hit this new code. Getting clock 1 works, and then we incorrectly
> print this message.

Good point about breaking out of the loop! I did indeed not take the
break condition of the loop into account.

I can not exactly follow your example though. The first failure of
of_clk_get will trigger break and exit the loop,
and then we would indeed print the wrong message ... .

>
> Rather than getting the i'th clock, get ARRAY_SIZE(dev->clk)'th clock.
I will gladly make the change in a v2.
>        Andrew

-
Josua


  reply	other threads:[~2019-07-06 16:21 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-06 15:18 [PATCH 0/4] Fix hang of Armada 8040 SoC in orion-mdio josua
2019-07-06 15:18 ` [PATCH 1/4] dt-bindings: allow up to four clocks for orion-mdio josua
2019-07-06 15:47   ` Andrew Lunn
2019-07-09  1:32   ` Rob Herring
2019-07-09  2:41     ` Andrew Lunn
2019-07-09 22:03       ` Rob Herring
2019-07-18  1:31         ` Andrew Lunn
2019-07-06 15:18 ` [PATCH 2/4] net: mvmdio: allow up to four clocks to be specified " josua
2019-07-06 15:47   ` Andrew Lunn
2019-07-06 15:18 ` [PATCH 3/4] net: mvmdio: print warning when orion-mdio has too many clocks josua
2019-07-06 16:09   ` Andrew Lunn
2019-07-06 16:21     ` Josua Mayer [this message]
2019-07-07  5:04   ` kbuild test robot
2019-07-06 15:19 ` [PATCH 4/4] net: mvmdio: defer probe of orion-mdio if a clock is not ready josua
2019-07-06 15:54   ` Andrew Lunn
2019-07-07  5:21   ` kbuild test robot
2019-07-09 13:00 ` [PATCH v2 0/4] Fix hang of Armada 8040 SoC in orion-mdio josua
2019-07-09 13:00   ` [PATCH v2 1/4] dt-bindings: allow up to four clocks for orion-mdio josua
2019-07-09 22:07     ` Rob Herring
2019-07-09 13:00   ` [PATCH v2 2/4] net: mvmdio: allow up to four clocks to be specified " josua
2019-07-09 13:01   ` [PATCH v2 3/4] net: mvmdio: print warning when orion-mdio has too many clocks josua
2019-07-09 13:14     ` Andrew Lunn
2019-07-09 13:01   ` [PATCH v2 4/4] net: mvmdio: defer probe of orion-mdio if a clock is not ready josua
2019-07-09 13:15     ` Andrew Lunn
2019-07-09 20:03   ` [PATCH v2 0/4] Fix hang of Armada 8040 SoC in orion-mdio 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=8d24d716-2f64-37d3-a7f2-1725d48c7d5f@solid-run.com \
    --to=josua@solid-run.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.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.