From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06DD87082F; Thu, 22 Jan 2026 14:49:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769093349; cv=none; b=r2KR5loxwEkl8Zlekh8DiZIy+A16xuqHrAnnEmHp4UI3OFHHSeVU06lBEc2FtL3DoA5gOxQErqsPfxZOQBPQ7cSAmttjuWFu7xeYd4h/r51ob61q1j9NwHYJIr/h/RVU2iOv2vnQD8zFBwC7eLFPnu0ElQpS5IeDJHZ8crXqsiw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769093349; c=relaxed/simple; bh=20U0OICFO684mmGGcmK4OTCVjQQ903vGfEP70A+pA2A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=L+bq3eohcEx7s1mfFKWzUGWwh512QkemJ4L42qAkxR76HjDyn5l3BYCZ311HZK89D1t8YtQFZQsQt9aciW88pK5sQuc75s+pM0tYhIskZOS9fi5cXsvHYA5nbWbJxkuCx6i7cB79tLcJh3H8HaeL9y7gyGpZt2zWm51+yWzLMWI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=beOaXzMv; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="beOaXzMv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1769093347; x=1800629347; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=20U0OICFO684mmGGcmK4OTCVjQQ903vGfEP70A+pA2A=; b=beOaXzMvbzYSBIdlF/j2ruVOfGNzaHnVTmCneDbDafSVMKwjlC4Kabws IATLoydpCXzjpTnoelAml/peTSoN2q9jcuWYRotEBGAQn7lnoHyC8gbQt N+8iJ2pHQYnJY+2ZbsqJpTeAMHM6+jzbC6pzXc0m4NVQH2u/Z46hLO4nQ noudfCZ3JZK5SgN2JH/cPh5WQf7ICtozTZH/iN8b0gy9fSKsOW2oLeBht qN/jJGCvL5nEijPZ8mw7mVR4kT0g50Wbyzu5AVbq4R5GDubW8B4MGHJNx uiQgAkMtC/FcpNCB28fJBWrwnSTzzkiqlvfxcX2naNcBlz2y/qORi5oUq w==; X-CSE-ConnectionGUID: eZAmDvwdSl2NG95NQHm2uw== X-CSE-MsgGUID: dSVbuEoiRmaaoNG5v1/d1w== X-IronPort-AV: E=McAfee;i="6800,10657,11679"; a="70382907" X-IronPort-AV: E=Sophos;i="6.21,246,1763452800"; d="scan'208";a="70382907" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2026 06:49:06 -0800 X-CSE-ConnectionGUID: z++1x3EeQ3GBMAdpOtc0Ww== X-CSE-MsgGUID: WLaHyP7tS1S9NKSALD2YIg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,246,1763452800"; d="scan'208";a="206802518" Received: from smoticic-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.245.225]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2026 06:49:01 -0800 Date: Thu, 22 Jan 2026 16:48:58 +0200 From: Andy Shevchenko To: Vladimir Oltean Cc: netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, Herve Codina , Mark Brown , Serge Semin , Maxime Chevallier , Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , devicetree@vger.kernel.org, Choong Yong Liang , Jiawen Wu Subject: Re: [PATCH v2 net-next 03/15] net: mdio: add generic driver for NXP SJA1110 100BASE-TX embedded PHYs Message-ID: References: <20260122105654.105600-1-vladimir.oltean@nxp.com> <20260122105654.105600-4-vladimir.oltean@nxp.com> <20260122133123.w3jr7gdga4fhlj5z@skbuf> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260122133123.w3jr7gdga4fhlj5z@skbuf> Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo 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