Re: [net-next PATCH v5 07/15] net: mdiobus: Introduce fwnode_mdiobus_register_phy()

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

 



On Mon, Feb 08, 2021 at 08:42:36PM +0530, Calvin Johnson wrote:
> +int fwnode_mdiobus_register_phy(struct mii_bus *bus,
> +				struct fwnode_handle *child, u32 addr)
> +{
> +	struct mii_timestamper *mii_ts;

If you initialise this to NULL...

> +	struct phy_device *phy;
> +	bool is_c45 = false;
> +	u32 phy_id;
> +	int rc;
> +
> +	if (is_of_node(child)) {
> +		mii_ts = of_find_mii_timestamper(to_of_node(child));
> +		if (IS_ERR(mii_ts))
> +			return PTR_ERR(mii_ts);
> +	}
> +
> +	rc = fwnode_property_match_string(child, "compatible", "ethernet-phy-ieee802.3-c45");
> +	if (rc >= 0)
> +		is_c45 = true;
> +
> +	if (is_c45 || fwnode_get_phy_id(child, &phy_id))
> +		phy = get_phy_device(bus, addr, is_c45);
> +	else
> +		phy = phy_device_create(bus, addr, phy_id, 0, NULL);
> +	if (IS_ERR(phy)) {
> +		if (mii_ts && is_of_node(child))

Then you don't need is_of_node() here.

> +		/* phy->mii_ts may already be defined by the PHY driver. A
> +		 * mii_timestamper probed via the device tree will still have
> +		 * precedence.
> +		 */
> +		if (mii_ts)
> +			phy->mii_ts = mii_ts;

Should this be moved out of the if() case?

I'm thinking of the future where we may end up adding mii timestamper
support for ACPI.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!



[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