From: Vinod Koul <vkoul@kernel.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "Rob Herring" <robh@kernel.org>,
"Madalin Bucur" <madalin.bucur@nxp.com>,
"David S . Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Horatiu Vultur" <horatiu.vultur@microchip.com>,
UNGLinuxDriver@microchip.com,
"Thierry Reding" <thierry.reding@gmail.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Jonathan Hunter" <jonathanh@nvidia.com>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Alan Stern" <stern@rowland.harvard.edu>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>,
"Alim Akhtar" <alim.akhtar@samsung.com>,
"Siddharth Vadapalli" <s-vadapalli@ti.com>,
"Russell King" <linux@armlinux.org.uk>,
netdev@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-pci@vger.kernel.org, linux-phy@lists.infradead.org,
linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH 7/7] usb: host: ohci-exynos: Convert to devm_of_phy_optional_get()
Date: Fri, 20 Jan 2023 13:34:37 +0530 [thread overview]
Message-ID: <Y8pLFZ/K3pNPx5hL@matsya> (raw)
In-Reply-To: <CAMuHMdXFjJJq=XqBZmL+EC9x5DMmucyncKE5ExS89bb00sir1g@mail.gmail.com>
On 20-01-23, 08:56, Geert Uytterhoeven wrote:
> Hi Rob,
>
> On Wed, Jan 18, 2023 at 8:49 PM Rob Herring <robh@kernel.org> wrote:
> > On Wed, Jan 18, 2023 at 12:28 PM Geert Uytterhoeven
> > <geert@linux-m68k.org> wrote:
> > > On Wed, Jan 18, 2023 at 6:30 PM Rob Herring <robh@kernel.org> wrote:
> > > > On Wed, Jan 18, 2023 at 4:15 AM Geert Uytterhoeven
> > > > <geert+renesas@glider.be> wrote:
> > > > > Use the new devm_of_phy_optional_get() helper instead of open-coding the
> > > > > same operation.
> > > > >
> > > > > This lets us drop several checks for IS_ERR(), as phy_power_{on,off}()
> > > > > handle NULL parameters fine.
> > > > >
> > > > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > > > ---
> > > > > drivers/usb/host/ohci-exynos.c | 24 +++++++-----------------
> > > > > 1 file changed, 7 insertions(+), 17 deletions(-)
> > > > >
> > > > > diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
> > > > > index 8d7977fd5d3bd502..8dd9c3b2411c383f 100644
> > > > > --- a/drivers/usb/host/ohci-exynos.c
> > > > > +++ b/drivers/usb/host/ohci-exynos.c
> > > > > @@ -69,19 +69,12 @@ static int exynos_ohci_get_phy(struct device *dev,
> > > > > return -EINVAL;
> > > > > }
> > > > >
> > > > > - phy = devm_of_phy_get(dev, child, NULL);
> > > > > + phy = devm_of_phy_optional_get(dev, child, NULL);
> > > > > exynos_ohci->phy[phy_number] = phy;
> > > > > if (IS_ERR(phy)) {
> > > > > - ret = PTR_ERR(phy);
> > > > > - if (ret == -EPROBE_DEFER) {
> > > > > - of_node_put(child);
> > > > > - return ret;
> > > > > - } else if (ret != -ENOSYS && ret != -ENODEV) {
> > > > > - dev_err(dev,
> > > > > - "Error retrieving usb2 phy: %d\n", ret);
> > > > > - of_node_put(child);
> > > > > - return ret;
> > > > > - }
> > > > > + of_node_put(child);
> > > > > + return dev_err_probe(dev, PTR_ERR(phy),
> > > > > + "Error retrieving usb2 phy\n");
> > > >
> > > > Optional is really the only reason for the caller to decide whether to
> > > > print an error message or not. If we have both flavors of 'get', then
> > > > really the 'get' functions should print an error message.
> > >
> > > In case of a real error, both should print an error message, right?
> > >
> > > Anyway, I understand that's a three step operation:
> > > 1. Introduce and convert to the _optional variant,
> > > 2. Add error printing to callees.
> > > 3. Remove error printing from callers.
> >
> > I think you only need 2 out of 3 steps depending on the situation. In
> > this case, you can add error printing in the _optional variant when
> > you introduce it and then convert callers to it.
> >
> > Where we already have an optional variant, then you need steps 2 and 3.
>
> Right, so the error printing can be done now, while introducing
> devm_of_phy_optional_get().
>
> Vinod: Do you agree?
Ack.. IMO makes it better that way
> If yes, I can respin with that change.
ok
> If not, I'll have to respin anyway, as the bug in
> am65_cpsw_init_serdes_phy() has been fixed in the meantime.
>
> Thanks!
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
>
> --
> linux-phy mailing list
> linux-phy@lists.infradead.org
> https://lists.infradead.org/mailman/listinfo/linux-phy
--
~Vinod
prev parent reply other threads:[~2023-01-20 8:04 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 10:15 [PATCH treewide 0/7] phy: Add devm_of_phy_optional_get() helper Geert Uytterhoeven
2023-01-18 10:15 ` [PATCH 1/7] " Geert Uytterhoeven
2023-01-19 3:28 ` Jakub Kicinski
2023-01-19 11:14 ` Vinod Koul
2023-01-19 17:07 ` Jakub Kicinski
2023-01-18 10:15 ` [PATCH 2/7] net: fman: memac: Convert to devm_of_phy_optional_get() Geert Uytterhoeven
2023-01-19 23:25 ` Sean Anderson
2023-01-18 10:15 ` [PATCH 3/7] net: lan966x: " Geert Uytterhoeven
2023-01-20 8:46 ` Steen Hegelund
2023-01-18 10:15 ` [PATCH 4/7] net: ethernet: ti: am65-cpsw: " Geert Uytterhoeven
2023-01-18 10:15 ` [PATCH 5/7] PCI: tegra: " Geert Uytterhoeven
2023-01-23 18:17 ` Bjorn Helgaas
2023-01-18 10:15 ` [PATCH 6/7] usb: host: ehci-exynos: " Geert Uytterhoeven
2023-01-19 12:17 ` Greg Kroah-Hartman
2023-01-18 10:15 ` [PATCH 7/7] usb: host: ohci-exynos: " Geert Uytterhoeven
2023-01-18 16:18 ` Alan Stern
2023-01-18 16:50 ` Geert Uytterhoeven
2023-01-18 17:01 ` Alan Stern
2023-01-18 17:29 ` Rob Herring
2023-01-18 18:28 ` Geert Uytterhoeven
2023-01-18 19:49 ` Rob Herring
2023-01-20 7:56 ` Geert Uytterhoeven
2023-01-20 8:04 ` Vinod Koul [this message]
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=Y8pLFZ/K3pNPx5hL@matsya \
--to=vkoul@kernel.org \
--cc=UNGLinuxDriver@microchip.com \
--cc=alim.akhtar@samsung.com \
--cc=bhelgaas@google.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=horatiu.vultur@microchip.com \
--cc=jonathanh@nvidia.com \
--cc=kishon@kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=kuba@kernel.org \
--cc=kw@linux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lpieralisi@kernel.org \
--cc=madalin.bucur@nxp.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
--cc=s-vadapalli@ti.com \
--cc=stern@rowland.harvard.edu \
--cc=thierry.reding@gmail.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).