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: <aXI42kYpTGJZrOc8@smile.fi.intel.com>
Date: Thu, 22 Jan 2026 16:48:58 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
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,
	Herve Codina <herve.codina@...tlin.com>,
	Mark Brown <broonie@...nel.org>,
	Serge Semin <fancer.lancer@...il.com>,
	Maxime Chevallier <maxime.chevallier@...tlin.com>,
	Lee Jones <lee@...nel.org>, Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>, devicetree@...r.kernel.org,
	Choong Yong Liang <yong.liang.choong@...ux.intel.com>,
	Jiawen Wu <jiawenwu@...stnetic.com>
Subject: Re: [PATCH v2 net-next 03/15] net: mdio: add generic driver for NXP
 SJA1110 100BASE-TX embedded PHYs

On Thu, Jan 22, 2026 at 03:31:23PM +0200, Vladimir Oltean wrote:
> On Thu, Jan 22, 2026 at 02:20:22PM +0200, Andy Shevchenko wrote:
> > On Thu, Jan 22, 2026 at 12:56:42PM +0200, Vladimir Oltean wrote:

...

> > > +static int mdio_regmap_simple_probe(struct platform_device *pdev)
> > > +{
> > > +	const struct mdio_regmap_simple_data *data;
> > > +	struct mdio_regmap_config config = {};
> > > +	struct device *dev = &pdev->dev;
> > > +	struct regmap *regmap;
> > > +	struct mii_bus *bus;
> > > +
> > > +	if (!dev->of_node || !dev->parent)
> > 
> > dev->of_node check is not needed, see below.
> 
> Oh.... this is a bug. dev->of_node should have been propagated to
> devm_mdio_regmap_register() -> devm_mdiobus_register(), turning it into
> devm_of_mdiobus_register().
> 
> It shows that my SJA1110 testing platform (Bluebox 3) doesn't have the
> CBTX PHY routed to pinout, since I didn't catch this... I'll fix this
> for v3.

Same Q, why not using fwnode APIs to begin with?

> > > +		return -ENODEV;
> > > +
> > > +	regmap = dev_get_regmap(dev->parent, NULL);
> > > +	if (!regmap)
> > > +		return -ENODEV;
> > > +
> > > +	data = device_get_match_data(dev);
> > > +
> > > +	config.regmap = regmap;
> > > +	config.parent = dev;
> > > +	config.name = dev_name(dev);
> > > +	/* The resource is optional, provided for finding the registers
> > > +	 * within a device-wide non-MMIO regmap
> > > +	 */
> > > +	config.resource = platform_get_resource(pdev, IORESOURCE_REG, 0);
> > 
> > > +	if (data) {
> > 
> > We may always require data to be present. As you use a default one anyway.
> > 
> > > +		config.valid_addr = data->valid_addr;
> > > +		config.autoscan = data->autoscan;
> > > +	}
> > 
> > And if it is not provided we will have a crash which is fine. It will just
> > point that the code was not ever been run on real HW.
> 
> Hmm. This patch is super old, so I'm revisiting it with foreign eyes,
> same as you.
> 
> I think the case with .valid_addr = 0 and .autoscan = false will
> constitute the vast majority of instantiations of this driver.
> I would like to avoid the proliferation of the same basic config with
> 100 different names (nxp_sja1110_base_tx, etc).

But you name it as default_blablalbla. That will be just assigned to each
currently "NULL" driver_data. We have examples in the kernel that do this.
IIRC 8250_dw cases, stmmac driver (PCI glue part of it?), et cetera...

> So for v3 I'm planning to:
> - rename nxp_sja1110_base_tx to mdio_regmap_simple_default_data
> - delete the "if (data)" conditional and directly assign from
>   device_get_match_data() to the config structure
> 
> Thanks for taking a look.

You're welcome!

> > > +	return PTR_ERR_OR_ZERO(devm_mdio_regmap_register(dev, &config));
> > > +}

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ