lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 30 Sep 2020 18:34:40 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Calvin Johnson <calvin.johnson@....nxp.com>
Cc:     Grant Likely <grant.likely@....com>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Jeremy Linton <jeremy.linton@....com>,
        Andy Shevchenko <andy.shevchenko@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Russell King - ARM Linux admin <linux@...linux.org.uk>,
        Cristi Sovaiala <cristian.sovaiala@....com>,
        Florin Laurentiu Chiculita <florinlaurentiu.chiculita@....com>,
        Ioana Ciornei <ioana.ciornei@....com>,
        Madalin Bucur <madalin.bucur@....nxp.com>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        linux-kernel@...r.kernel.org, linux.cj@...il.com,
        netdev@...r.kernel.org, linux-acpi@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        Diana Madalina Craciun <diana.craciun@....com>,
        Laurentiu Tudor <laurentiu.tudor@....com>,
        "David S. Miller" <davem@...emloft.net>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Jakub Kicinski <kuba@...nel.org>
Subject: Re: [net-next PATCH v1 3/7] net: phy: Introduce fwnode_get_phy_id()

> +/* Extract the phy ID from the compatible string of the form
> + * ethernet-phy-idAAAA.BBBB.
> + */
> +int fwnode_get_phy_id(struct fwnode_handle *fwnode, u32 *phy_id)
> +{
> +	unsigned int upper, lower;
> +	const char *cp;
> +	int ret;
> +
> +	ret = fwnode_property_read_string(fwnode, "compatible", &cp);
> +	if (ret)
> +		return ret;
> +
> +	if (sscanf(cp, "ethernet-phy-id%4x.%4x", &upper, &lower) == 2) {
> +		*phy_id = ((upper & 0xFFFF) << 16) | (lower & 0xFFFF);
> +		return 0;
> +	}
> +	return -EINVAL;
> +}
> +EXPORT_SYMBOL(fwnode_get_phy_id);

Hi Calvin

Do you really need this? Do you have a board with a broken PHY ID?

>  /**
>   * get_phy_device - reads the specified PHY device and returns its @phy_device
>   *		    struct
> @@ -2866,7 +2888,15 @@ EXPORT_SYMBOL_GPL(device_phy_find_device);
>   */
>  struct fwnode_handle *fwnode_get_phy_node(struct fwnode_handle *fwnode)
>  {
> -	return fwnode_find_reference(fwnode, "phy-handle", 0);
> +	struct fwnode_handle *phy_node;
> +
> +	phy_node = fwnode_find_reference(fwnode, "phy-handle", 0);
> +	if (is_acpi_node(fwnode) || !IS_ERR(phy_node))
> +		return phy_node;
> +	phy_node = fwnode_find_reference(fwnode, "phy", 0);
> +	if (IS_ERR(phy_node))
> +		phy_node = fwnode_find_reference(fwnode, "phy-device", 0);
> +	return phy_node;

Why do you have three different ways to reference a PHY?

    Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ