Re: [PATCH 7/7] usb: host: ohci-exynos: Convert to devm_of_phy_optional_get()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alan,

On Wed, Jan 18, 2023 at 5:26 PM Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> On Wed, Jan 18, 2023 at 11:15:20AM +0100, Geert Uytterhoeven 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.
>
> The patch ignores a possible -ENOSYS error return.  Is it known that
> this will never happen?

While some phy_*() dummies in include/linux/phy/phy.h do return -ENOSYS
if CONFIG_GENERIC_PHY is not enabled, devm_of_phy_optional_get()
returns NULL in that case, so I think this cannot happen.

> > --- 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");
> >               }
> >       }
> >

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

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



[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux for Synopsys ARC Processors]    
  • [Linux on Unisoc (RDA Micro) SoCs]     [Linux Actions SoC]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  •   Powered by Linux