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, 16 Jun 2021 21:33:14 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Marcin Wojtas <mw@...ihalf.com>
Cc:     linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
        davem@...emloft.net, kuba@...nel.org, linux@...linux.org.uk,
        jaz@...ihalf.com, gjb@...ihalf.com, upstream@...ihalf.com,
        Samer.El-Haj-Mahmoud@....com, jon@...id-run.com, tn@...ihalf.com,
        rjw@...ysocki.net, lenb@...nel.org
Subject: Re: [net-next: PATCH v2 2/7] net: mdiobus: Introduce
 fwnode_mdbiobus_register()

On Wed, Jun 16, 2021 at 09:07:54PM +0200, Marcin Wojtas wrote:
> This patch introduces a new helper function that
> wraps acpi_/of_ mdiobus_register() and allows its
> usage via common fwnode_ interface.
> 
> Fall back to raw mdiobus_register() in case CONFIG_FWNODE_MDIO
> is not enabled, in order to satisfy compatibility
> in all future user drivers.

> Signed-off-by: Marcin Wojtas <mw@...ihalf.com>
> ---
>  include/linux/fwnode_mdio.h    | 12 +++++++++++
>  drivers/net/mdio/fwnode_mdio.c | 22 ++++++++++++++++++++
>  2 files changed, 34 insertions(+)
> 
> diff --git a/include/linux/fwnode_mdio.h b/include/linux/fwnode_mdio.h
> index faf603c48c86..13d4ae8fee0a 100644
> --- a/include/linux/fwnode_mdio.h
> +++ b/include/linux/fwnode_mdio.h
> @@ -16,6 +16,7 @@ int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
>  int fwnode_mdiobus_register_phy(struct mii_bus *bus,
>  				struct fwnode_handle *child, u32 addr);
>  
> +int fwnode_mdiobus_register(struct mii_bus *bus, struct fwnode_handle *fwnode);
>  #else /* CONFIG_FWNODE_MDIO */
>  int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
>  				       struct phy_device *phy,
> @@ -30,6 +31,17 @@ static inline int fwnode_mdiobus_register_phy(struct mii_bus *bus,
>  {
>  	return -EINVAL;
>  }
> +
> +static inline int fwnode_mdiobus_register(struct mii_bus *bus,
> +					  struct fwnode_handle *fwnode)
> +{
> +	/*
> +	 * Fall back to mdiobus_register() function to register a bus.
> +	 * This way, we don't have to keep compat bits around in drivers.
> +	 */
> +
> +	return mdiobus_register(mdio);
> +}

I'm not sure this fallback is correct.

Any driver which decides to use fwmode is going to select it. If it is
not selected, you want a link time error, or a compiler time error to
tell you, you are missing FWNODE_MDIO. Calling mdiobus_register() is
unlikely to work, or the driver would of done that directly.

	 Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ