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  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, 1 Jul 2020 15:24:54 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Calvin Johnson <calvin.johnson@....nxp.com>
Cc:     Jeremy Linton <jeremy.linton@....com>,
        Russell King - ARM Linux admin <linux@...linux.org.uk>,
        Jon <jon@...id-run.com>,
        Cristi Sovaiala <cristian.sovaiala@....com>,
        Ioana Ciornei <ioana.ciornei@....com>,
        Andy Shevchenko <andy.shevchenko@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Madalin Bucur <madalin.bucur@....nxp.com>,
        netdev@...r.kernel.org, linux-acpi@...r.kernel.org,
        linux.cj@...il.com, "David S. Miller" <davem@...emloft.net>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Jakub Kicinski <kuba@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [net-next PATCH v2 1/3] net: phy: introduce find_phy_device()

> +struct phy_device *find_phy_device(struct fwnode_handle *fwnode)

We should consider the naming convention. All phylib phy functions
start with phy_. We already have phy_find_first(), so maybe
phy_find_by_fwnode() to follow the pattern?

> +{
> +	struct fwnode_handle *fwnode_mdio;
> +	struct platform_device *pdev;
> +	struct mii_bus *mdio;
> +	struct device *dev;
> +	int addr;
> +	int err;
> +
> +	fwnode_mdio = fwnode_find_reference(fwnode, "mdio-handle", 0);
> +	dev = bus_find_device_by_fwnode(&platform_bus_type, fwnode_mdio);
> +	if (IS_ERR_OR_NULL(dev))
> +		return NULL;
> +	pdev =  to_platform_device(dev);
> +	mdio = platform_get_drvdata(pdev);

That is a big assumption to make. Please take a look at the
class_find_device_by_*() functions, as used by of_mdio_find_bus(),
mdio_find_bus(), etc.

	Andrew

Powered by blists - more mailing lists