U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: Simon Glass <sjg@chromium.org>, "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: "u-boot@lists.denx.de" <u-boot@lists.denx.de>,
	Jerome Forissier <jerome.forissier@arm.com>,
	Tom Rini <trini@konsulko.com>,
	Peter Robinson <pbrobinson@gmail.com>,
	Svyatoslav Ryhel <clamor95@gmail.com>,
	Heiko Schocher <hs@nabladev.com>,
	Marek Vasut <marek.vasut+usb@mailbox.org>,
	Andrew Goodbody <andrew.goodbody@linaro.org>,
	Rasmus Villemoes <ravi@prevas.dk>
Subject: RE: [PATCH 6/6] net: mvpp2: convert FDT access to ofnode API
Date: Wed, 27 May 2026 14:29:37 +0000	[thread overview]
Message-ID: <MRWPR04MB123306B6BA8249EBBC856412A88082@MRWPR04MB12330.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <CAFLszThr_osXm8kdJr8aXEN0uZwk_-FV9EsB2s=oWqTDbu6cUw@mail.gmail.com>

Hi Simon,

Thanks for giving a look.

> Subject: Re: [PATCH 6/6] net: mvpp2: convert FDT access to ofnode API
> 
> Hi Peng,
> 
> On 2026-05-26T07:25:09, Peng Fan (OSS) <peng.fan@oss.nxp.com>
> wrote:
> > net: mvpp2: convert FDT access to ofnode API
> >
> > Convert mvpp2 driver from legacy fdtdec/fdt_* APIs to the ofnode-
> based
> > interfaces.
> >
> > Replace usage of dev_of_offset(), fdtdec_lookup_phandle(),
> > fdtdec_get_int(), fdt_parent_offset(), and related helpers with their
> > ofnode equivalents, including dev_ofnode(), ofnode_parse_phandle(),
> > ofnode_read_s32_default(), ofnode_get_parent(), and
> > ofnode_for_each_subnode().
> >
> > Remove direct dependencies on gd->fdt_blob.
> >
> > Main changes:
> > - Use ofnode_valid() instead of integer checks for node presence
> > - Switch fixed-link detection to ofnode_find_subnode()
> > - Replace uclass_get_device_by_of_offset() with
> >   uclass_get_device_by_ofnode()
> > - Update subnode iteration and device binding to use ofnode
> >
> > [...]
> >
> > drivers/net/mvpp2.c | 54
> > ++++++++++++++++++++++++++---------------------------
> >  1 file changed, 27 insertions(+), 27 deletions(-)
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> > diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c @@ -5436,15
> > +5436,14 @@ static struct driver mvpp2_driver = {
> >   */
> >  static int mvpp2_base_bind(struct udevice *parent)  {
> > -     const void *blob = gd->fdt_blob;
> > -     int node = dev_of_offset(parent);
> > +     ofnode node = dev_ofnode(parent);
> 
> 'node' is now no longer used by the look of it. Do you see a warning?

I use "./tools/buildman/buildman x250 ", I may miss something.
indeed no user, I will remove it. 

> 
> > diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
> > @@ -5478,8 +5477,9 @@ static int mvpp2_base_bind(struct udevice
> *parent)
> >               sprintf(name, 'mvpp2-%d', id);
> >
> >               /* Create child device UCLASS_ETH and bind it */
> > -             device_bind(parent, &mvpp2_driver, name, plat,
> > -                         offset_to_ofnode(subnode), &dev);
> > +             ret = device_bind(parent, &mvpp2_driver, name, plat,
> subnode, &dev);
> > +             if (ret)
> > +                     return ret;
> 
> This is a behavioural change - the old code ignored bind failures and
> continued, the new code aborts and leaks the already-allocated plat
> and name. Probably the right thing, but please mention it in the
> commit message (the "No functional changes" claim is not quite
> accurate) and free plat/name on the error path.

Will update commit message in v2.

> 
> > diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
> > @@ -4731,33 +4731,34 @@ static int mvpp2_port_init(struct
> udevice *dev, struct mvpp2_port *port)
> > -             parent = fdt_parent_offset(gd->fdt_blob, phy_node);
> > -             ret = uclass_get_device_by_of_offset(UCLASS_MDIO, parent,
> > -                                                  &port->mdio_dev);
> > +             parent = ofnode_get_parent(phy_node);
> > +             if (!ofnode_valid(parent))
> > +                     return -ENODEV;
> 
> We should be careful returning -ENODEV as it has a special meaning
> with DM. This is a small behavioural change versus the old code, which
> passed a negative offset straight through. Worth noting in the commit
> message, or drop the check since the call below will return an error

I will drop the check in v2.

Thanks,
Peng.

> anyway.
> 
> Regards,
> Simon

  reply	other threads:[~2026-05-27 14:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26  7:25 [PATCH 0/6] net: Use dev APIs Peng Fan (OSS)
2026-05-26  7:25 ` [PATCH 1/6] net: ethoc: Use dev_read_addr_index() Peng Fan (OSS)
2026-05-27  1:17   ` Simon Glass
2026-05-26  7:25 ` [PATCH 2/6] net: qe: dm_qe_uec: Use dev_read_addr() Peng Fan (OSS)
2026-05-27  1:17   ` Simon Glass
2026-05-26  7:25 ` [PATCH 3/6] net: calxedaxgmac: " Peng Fan (OSS)
2026-05-27  1:17   ` Simon Glass
2026-05-26  7:25 ` [PATCH 4/6] net: dc2114x: Use dev_remap_addr() Peng Fan (OSS)
2026-05-27  1:17   ` Simon Glass
2026-05-26  7:25 ` [PATCH 5/6] net: mvpp2: Use dev_read_addr_index_ptr() Peng Fan (OSS)
2026-05-27  1:17   ` Simon Glass
2026-05-26  7:25 ` [PATCH 6/6] net: mvpp2: convert FDT access to ofnode API Peng Fan (OSS)
2026-05-27  1:20   ` Simon Glass
2026-05-27 14:29     ` Peng Fan (OSS) [this message]
2026-05-27 14:47       ` Tom Rini

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=MRWPR04MB123306B6BA8249EBBC856412A88082@MRWPR04MB12330.eurprd04.prod.outlook.com \
    --to=peng.fan@oss.nxp.com \
    --cc=andrew.goodbody@linaro.org \
    --cc=clamor95@gmail.com \
    --cc=hs@nabladev.com \
    --cc=jerome.forissier@arm.com \
    --cc=marek.vasut+usb@mailbox.org \
    --cc=pbrobinson@gmail.com \
    --cc=ravi@prevas.dk \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox