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]
Message-ID: <YwZDA0CuYwPE6DM2@lunn.ch>
Date:   Wed, 24 Aug 2022 17:25:55 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     "xiaowu.ding" <xiaowu.ding@...uarmicro.com>
Cc:     davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
        pabeni@...hat.com, linux@...linux.org.uk,
        nicolas.ferre@...rochip.com, claudiu.beznea@...rochip.com,
        palmer@...belt.com, paul.walmsley@...ive.com,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-riscv@...ts.infradead.org
Subject: Re: [PATCH net-next] driver: cadence macb driver support acpi mode

> +static int macb_acpi_phylink_connect(struct macb *bp)
> +{
> +	struct fwnode_handle *fwnd = bp->pdev->dev.fwnode;
> +	struct net_device *dev = bp->dev;
> +	struct phy_device *phydev;
> +	int ret;
> +
> +	if (fwnd)
> +		ret = phylink_fwnode_phy_connect(bp->phylink, fwnd, 0);
> +
> +	if (!fwnd || (ret && !macb_acpi_phy_handle_exists(fwnd))) {
> +		phydev = phy_find_first(bp->mii_bus);

Please don't use phy_find_first. That is somewhat historical. Since
this is a new binding, simply error out if
phylink_fwnode_phy_connect() fails.

> +static int macb_acpi_mdiobus_register(struct macb *bp)
> +{
> +	struct platform_device *pdev =	bp->pdev;
> +	struct fwnode_handle *fwnode = pdev->dev.fwnode;
> +	struct fwnode_handle *child;
> +	u32 addr;
> +	int ret;
> +
> +	if (!IS_ERR_OR_NULL(fwnode_find_reference(pdev->dev.fwnode, "fixed-link", 0)))
> +		return mdiobus_register(bp->mii_bus);
> +
> +	fwnode_for_each_child_node(fwnode, child) {
> +		ret = acpi_get_local_address(ACPI_HANDLE_FWNODE(child), &addr);
> +		if (ret || addr >= PHY_MAX_ADDR)
> +			continue;
> +		ret = acpi_mdiobus_register(bp->mii_bus, fwnode);
> +		if (!ret)
> +			return ret;
> +		break;

Why loop looking for a node with a register value < 32?

Please make sure you are conformant with Documentation/firmware-guide/acpi/dsd/phy.rst

       Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ