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: <20200930162731.GP3996795@lunn.ch>
Date:   Wed, 30 Sep 2020 18:27:31 +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>,
        Jakub Kicinski <kuba@...nel.org>
Subject: Re: [net-next PATCH v1 7/7] net/fsl: Use _ADR ACPI object to
 register PHYs

Hi Calvin

>  	priv->has_a011043 = device_property_read_bool(&pdev->dev,
>  						      "fsl,erratum-a011043");
> -
> -	ret = of_mdiobus_register(bus, np);
> -	if (ret) {
> -		dev_err(&pdev->dev, "cannot register MDIO bus\n");
> +	if (is_of_node(pdev->dev.fwnode)) {
> +		ret = of_mdiobus_register(bus, np);
> +		if (ret) {
> +			dev_err(&pdev->dev, "cannot register MDIO bus\n");
> +			goto err_registration;
> +		}
> +	} else if (is_acpi_node(pdev->dev.fwnode)) {
> +		priv->is_little_endian = true;
> +		/* Mask out all PHYs from auto probing. */
> +		bus->phy_mask = ~0;
> +		ret = mdiobus_register(bus);
> +		if (ret) {
> +			dev_err(&pdev->dev, "mdiobus register err(%d)\n", ret);
> +			return ret;
> +		}
> +
> +		fwnode = pdev->dev.fwnode;

> +	/* Loop over the child nodes and register a phy_device for each PHY */
> +		fwnode_for_each_child_node(fwnode, child) {
> +			status = acpi_evaluate_integer(ACPI_HANDLE_FWNODE(child),
> +						       "_ADR", NULL, &addr);
> +			if (ACPI_FAILURE(status)) {
> +				pr_debug("_ADR returned %d\n", status);
> +				continue;
> +			}
> +
> +			if (addr < 0 || addr >= PHY_MAX_ADDR)
> +				continue;
> +
> +			ret = fwnode_mdiobus_register_phy(bus, child, addr);
> +			if (ret == -ENODEV)
> +				dev_err(&bus->dev,
> +					"MDIO device at address %lld is missing.\n",
> +					addr);
> +		}

Hi Calvin

This looping over the properties should be in the core, in the same
way of_mdiobus_register() loops over the OF properties in the core.
We don't want MDIO drivers doing this in their own way, with their own
bugs.

    Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ