From: Marcin Wojtas <mw@semihalf.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"davem@davemloft.net" <davem@davemloft.net>,
"kuba@kernel.org" <kuba@kernel.org>,
"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
"jaz@semihalf.com" <jaz@semihalf.com>,
"gjb@semihalf.com" <gjb@semihalf.com>,
"upstream@semihalf.com" <upstream@semihalf.com>,
"Samer.El-Haj-Mahmoud@arm.com" <Samer.El-Haj-Mahmoud@arm.com>,
"jon@solid-run.com" <jon@solid-run.com>
Subject: Re: [net-next: PATCH 1/3] net: mvmdio: add ACPI support
Date: Tue, 15 Jun 2021 17:09:12 +0200 [thread overview]
Message-ID: <CAPv3WKeubNaxpv442d57bEqA1ZtPcTXOswcsuCsregW_2Akdww@mail.gmail.com> (raw)
In-Reply-To: <CAHp75VdMsYJMCwH2o14e7nJBTj6A38dkcZJ+0WQfnW=keOyoAg@mail.gmail.com>
Hi,
niedz., 13 cze 2021 o 22:08 Andy Shevchenko
<andy.shevchenko@gmail.com> napisał(a):
>
>
>
> On Sunday, June 13, 2021, Andrew Lunn <andrew@lunn.ch> wrote:
>>
>> > @@ -336,7 +338,7 @@ static int orion_mdio_probe(struct platform_device *pdev)
>> > dev_warn(&pdev->dev,
>> > "unsupported number of clocks, limiting to the first "
>> > __stringify(ARRAY_SIZE(dev->clk)) "\n");
>> > - } else {
>> > + } else if (!has_acpi_companion(&pdev->dev)) {
>> > dev->clk[0] = clk_get(&pdev->dev, NULL);
>> > if (PTR_ERR(dev->clk[0]) == -EPROBE_DEFER) {
>> > ret = -EPROBE_DEFER;
>>
>> Is this needed? As you said, there are no clocks when ACPI is used, So
>> doesn't clk_get() return -ENODEV? Since this is not EPRODE_DEFER, it
>> keeps going. The clk_prepare_enable() won't be called.
>
Indeed, I'll double check if it works and will keep the if {} else {} intact.
>
>
> The better approach is to switch to devm_get_clk_optional() as I have done in several drivers, IIRC recently in mvpp2
>
>
> https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=cf3399b731d36bc780803ff63e4d480a1efa33ac
>
Yes, this would be a nice improvement, however the
devm_get_clk_optional requires clock name (type char *) - mvmdio uses
raw indexes, so this helper unfortunately seems to be not applicable.
>>
>> > - ret = of_mdiobus_register(bus, pdev->dev.of_node);
>> > + if (pdev->dev.of_node)
>> > + ret = of_mdiobus_register(bus, pdev->dev.of_node);
>> > + else if (is_acpi_node(pdev->dev.fwnode))
>> > + ret = acpi_mdiobus_register(bus, pdev->dev.fwnode);
>> > + else
>> > + ret = -EINVAL;
>> > if (ret < 0) {
>> > dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret);
>> > goto out_mdio;
>> > @@ -383,6 +390,9 @@ static int orion_mdio_probe(struct platform_device *pdev)
>> > if (dev->err_interrupt > 0)
>> > writel(0, dev->regs + MVMDIO_ERR_INT_MASK);
>> >
>> > + if (has_acpi_companion(&pdev->dev))
>> > + return ret;
>> > +
>>
>> I think this can also be removed for the same reason.
>>
>> We should try to avoid adding has_acpi_companion() and
>> !pdev->dev.of_node whenever we can. It makes the driver code too much
>> of a maze.
Clock routines silently accept NULL pointers, so it will be safe to
drop this addition in v2.
Best regards,
Marcin
next prev parent reply other threads:[~2021-06-15 15:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-13 18:35 [net-next: PATCH 0/3] ACPI MDIO support for Marvell controllers Marcin Wojtas
2021-06-13 18:35 ` [net-next: PATCH 1/3] net: mvmdio: add ACPI support Marcin Wojtas
2021-06-13 19:20 ` Andrew Lunn
2021-06-15 15:13 ` Marcin Wojtas
2021-06-15 19:53 ` Andy Shevchenko
2021-06-13 19:34 ` Andrew Lunn
[not found] ` <CAHp75VdMsYJMCwH2o14e7nJBTj6A38dkcZJ+0WQfnW=keOyoAg@mail.gmail.com>
2021-06-15 15:09 ` Marcin Wojtas [this message]
2021-06-15 19:50 ` Andy Shevchenko
2021-06-13 18:35 ` [net-next: PATCH 2/3] net: mvpp2: enable using phylink with ACPI Marcin Wojtas
2021-06-13 18:44 ` Russell King (Oracle)
2021-06-13 20:53 ` Marcin Wojtas
2021-06-13 19:47 ` Andrew Lunn
2021-06-13 21:21 ` Marcin Wojtas
2021-06-13 21:35 ` Andrew Lunn
2021-06-13 23:46 ` Marcin Wojtas
2021-06-14 0:08 ` Andrew Lunn
2021-06-13 18:35 ` [net-next: PATCH 3/3] net: mvpp2: remove unused 'has_phy' field Marcin Wojtas
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=CAPv3WKeubNaxpv442d57bEqA1ZtPcTXOswcsuCsregW_2Akdww@mail.gmail.com \
--to=mw@semihalf.com \
--cc=Samer.El-Haj-Mahmoud@arm.com \
--cc=andrew@lunn.ch \
--cc=andy.shevchenko@gmail.com \
--cc=davem@davemloft.net \
--cc=gjb@semihalf.com \
--cc=jaz@semihalf.com \
--cc=jon@solid-run.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=upstream@semihalf.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).