All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@oss.nxp.com>
To: Primoz Fiser <primoz.fiser@norik.com>
Cc: Wei Fang <wei.fang@nxp.com>, Shenwei Wang <shenwei.wang@nxp.com>,
	Clark Wang <xiaoning.wang@nxp.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	davem@davemloft.net, Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	imx@lists.linux.dev, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org, upstream@lists.phytec.de
Subject: Re: [PATCH 2/2] net: stmmac: Populate netdev of_node
Date: Mon, 21 Jul 2025 17:47:05 +0800	[thread overview]
Message-ID: <20250721094705.GF4844@nxa18884-linux.ap.freescale.net> (raw)
In-Reply-To: <20250717090037.4097520-3-primoz.fiser@norik.com>

On Thu, Jul 17, 2025 at 11:00:37AM +0200, Primoz Fiser wrote:
>Populate netdev of_node with device of_node so that the network device
>inherits the device tree node information in case of platform device.
>On the other hand, when stmmac_dvr_probe() is called from pci device,
>of_node will be NULL preserving current behavior.
>
>With this in place, when initiated from platform device, udev will be
>able to export OF_* properties (OF_NAME, OF_FULLNAME, OF_COMPATIBLE,
>OF_ALIAS, etc) for the network interface. These properties are commonly
>used by udev rules and other userspace tools for device identification
>and configuration.
>
>Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
>---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>index f350a6662880..dfd503a87f22 100644
>--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>@@ -7487,6 +7487,7 @@ int stmmac_dvr_probe(struct device *device,
> 		return -ENOMEM;
> 
> 	SET_NETDEV_DEV(ndev, device);
>+	ndev->dev.of_node = device->of_node;

You may need to device_set_node.

TBH: I am not sure why device_set_node does not increments the refcnt,
while device_set_of_node_from_dev has. But this driver supports
non-OF platform, so using device_set_of_node_from_dev may not be good,
and I would suggest use device_set_node.

Regards
Peng

> 
> 	priv = netdev_priv(ndev);
> 	priv->device = device;
>-- 
>2.34.1
>

  reply	other threads:[~2025-07-21  8:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17  9:00 [PATCH 0/2] Populate of_node for i.MX netdevs Primoz Fiser
2025-07-17  9:00 ` [PATCH 1/2] net: fec: fec_probe(): Populate netdev of_node Primoz Fiser
2025-07-21  9:44   ` Peng Fan
2025-07-17  9:00 ` [PATCH 2/2] net: stmmac: " Primoz Fiser
2025-07-21  9:47   ` Peng Fan [this message]
2025-07-17 14:02 ` [PATCH 0/2] Populate of_node for i.MX netdevs Jakub Kicinski
2025-07-18  5:10   ` Primoz Fiser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250721094705.GF4844@nxa18884-linux.ap.freescale.net \
    --to=peng.fan@oss.nxp.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=imx@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=primoz.fiser@norik.com \
    --cc=shenwei.wang@nxp.com \
    --cc=upstream@lists.phytec.de \
    --cc=wei.fang@nxp.com \
    --cc=xiaoning.wang@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.