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: <20251120144136.GF661940@google.com>
Date: Thu, 20 Nov 2025 14:41:36 +0000
From: Lee Jones <lee@...nel.org>
To: Vladimir Oltean <vladimir.oltean@....com>
Cc: netdev@...r.kernel.org, Andrew Lunn <andrew@...n.ch>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Russell King <linux@...linux.org.uk>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next 07/15] mfd: core: add ability for cells to probe
 on a custom parent OF node

On Tue, 18 Nov 2025, Vladimir Oltean wrote:

> I would like the "nxp,sja1110a" driver, in the configuration below, to
> be able to probe the drivers for "nxp,sja1110-base-t1-mdio" and for
> "nxp,sja1110-base-tx-mdio" via mfd_add_devices():
> 
> 	ethernet-switch@0 {
> 		compatible = "nxp,sja1110a";
> 
> 		mdios {
> 			mdio@0 {
> 				compatible = "nxp,sja1110-base-t1-mdio";
> 			};
> 
> 			mdio@1 {
> 				compatible = "nxp,sja1110-base-tx-mdio";
> 			};
> 		};
> 	};

This device is not an MFD.

Please find a different way to instantiate these network drivers.

> This isn't currently possible, because mfd assumes that the parent
> OF node ("mdios") == OF node of the parent ("ethernet-switch@0"), which
> in this case isn't true, and as it searches through the children of
> "ethernet-switch@0", it finds no MDIO bus to probe.
> 
> Cc: Lee Jones <lee@...nel.org>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
> ---
>  drivers/mfd/mfd-core.c   | 11 +++++++++--
>  include/linux/mfd/core.h |  7 +++++++
>  2 files changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
> index 7d14a1e7631e..e0b7f93a2654 100644
> --- a/drivers/mfd/mfd-core.c
> +++ b/drivers/mfd/mfd-core.c
> @@ -181,8 +181,14 @@ static int mfd_add_device(struct device *parent, int id,
>  	if (ret < 0)
>  		goto fail_res;
>  
> -	if (IS_ENABLED(CONFIG_OF) && parent->of_node && cell->of_compatible) {
> -		for_each_child_of_node(parent->of_node, np) {
> +	if (IS_ENABLED(CONFIG_OF)) {
> +		const struct device_node *parent_of_node;
> +
> +		parent_of_node = cell->parent_of_node ?: parent->of_node;
> +		if (!parent_of_node || !cell->of_compatible)
> +			goto skip_of;
> +
> +		for_each_child_of_node(parent_of_node, np) {
>  			if (of_device_is_compatible(np, cell->of_compatible)) {
>  				/* Skip 'disabled' devices */
>  				if (!of_device_is_available(np)) {
> @@ -213,6 +219,7 @@ static int mfd_add_device(struct device *parent, int id,
>  				cell->name, platform_id);
>  	}
>  
> +skip_of:
>  	mfd_acpi_add_device(cell, pdev);
>  
>  	if (cell->pdata_size) {
> diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
> index faeea7abd688..2e94ea376125 100644
> --- a/include/linux/mfd/core.h
> +++ b/include/linux/mfd/core.h
> @@ -81,6 +81,13 @@ struct mfd_cell {
>  	/* Software node for the device. */
>  	const struct software_node *swnode;
>  
> +	/*
> +	 * Parent OF node of the device, if different from the OF node
> +	 * of the MFD parent (e.g. there is at least one more hierarchical
> +	 * level between them)
> +	 */
> +	const struct device_node *parent_of_node;
> +
>  	/*
>  	 * Device Tree compatible string
>  	 * See: Documentation/devicetree/usage-model.rst Chapter 2.2 for details
> -- 
> 2.34.1
> 

-- 
Lee Jones [李琼斯]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ