Re: [net-next PATCH v5 5/6] phylink: introduce phylink_fwnode_phy_connect()

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

 



On Fri, Jul 10, 2020 at 7:32 PM Calvin Johnson
<calvin.johnson@xxxxxxxxxxx> wrote:
>
> Define phylink_fwnode_phy_connect() to connect phy specified by
> a fwnode to a phylink instance.

...

> +int phylink_fwnode_phy_connect(struct phylink *pl,
> +                              struct fwnode_handle *fwnode,
> +                              u32 flags)
> +{
> +       struct phy_device *phy_dev;

> +       int ret = 0;

This assignment is redundant and actually entire var is not needed.

> +       if (is_of_node(fwnode)) {
> +               ret = phylink_of_phy_connect(pl, to_of_node(fwnode), flags);
> +       } else if (is_acpi_device_node(fwnode)) {
> +               phy_dev = phy_find_by_mdio_handle(fwnode);
> +               if (!phy_dev)
> +                       return -ENODEV;
> +               ret = phylink_connect_phy(pl, phy_dev);
> +       } else {
> +               ret = -EINVAL;
> +       }
> +
> +       return ret;

You may refactor in the similar way, i.e.

if (is_of_node(...))
  return phy...
if (is_acpi_device_node(...)) {
  ... return phylink_connect_phy();
}
return -EINVAL;

> +}

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux