netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Buday Csaba <buday.csaba@prolan.hu>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Philipp Zabel <p.zabel@pengutronix.de>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v4 4/4] net: mdio: reset PHY before attempting to access registers in fwnode_mdiobus_register_phy
Date: Wed, 29 Oct 2025 08:24:26 +0100	[thread overview]
Message-ID: <aQHBKitU6Gyjk37e@debianbuilder> (raw)
In-Reply-To: <20251028182605.06840664@kernel.org>

On Tue, Oct 28, 2025 at 06:26:05PM -0700, Jakub Kicinski wrote:
> On Wed, 22 Oct 2025 11:08:53 +0200 Buday Csaba wrote:
> > +/* Hard-reset a PHY before registration */
> > +static int fwnode_reset_phy(struct mii_bus *bus, u32 addr,
> > +			    struct fwnode_handle *phy_node)
> > +{
> > +	struct mdio_device *tmpdev;
> > +	int err;
> > +
> > +	tmpdev = mdio_device_create(bus, addr);
> > +	if (IS_ERR(tmpdev))
> > +		return PTR_ERR(tmpdev);
> > +
> > +	fwnode_handle_get(phy_node);
> > +	device_set_node(&tmpdev->dev, phy_node);
> > +	err = mdio_device_register_reset(tmpdev);
> > +	if (err) {
> > +		mdio_device_free(tmpdev);
> > +		return err;
> 
> Should we worry about -EPROBE_DEFER on any of the error paths here?
> If not maybe consider making this function void? We can add errors
> back if the caller starts to care.

That is a very valid point, thanks! I think I can handle that correctly,
by propagating that (or any other) error codes to the caller of
fwnode_mdiobus_register_phy(). fwnode_reset_phy() does nothing that
would not be expected to occur during the normal registration, so if
it fails here, it would fail later as well.

> 
> > +	}
> > +
> > +	if (mdio_device_has_reset(tmpdev)) {
> > +		dev_info(&bus->dev,
> > +			 "PHY device at address %d not detected, resetting PHY.",
> > +			 addr);
> 
> IDK if this is still strictly necessary but I guess \n at the end of
> the info msg would be idiomatic
> 

I will separate the error message to another patch, then the maintainers
can decide wheter to merge it or not.

Thanks for the feedback!
I should be able to send v5 soon.

Csaba


      reply	other threads:[~2025-10-29  7:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22  9:08 [PATCH net-next v4 0/4] net: mdio: implement optional PHY reset before MDIO access Buday Csaba
2025-10-22  9:08 ` [PATCH net-next v4 1/4] net: mdio: common handling of phy reset properties Buday Csaba
2025-10-29  1:22   ` Jakub Kicinski
2025-10-22  9:08 ` [PATCH net-next v4 2/4] net: mdio: change property read from fwnode_property_read_u32() to device_property_read_u32() Buday Csaba
2025-10-22  9:08 ` [PATCH net-next v4 3/4] net: mdio: introduce mdio_device_has_reset() Buday Csaba
2025-10-22  9:08 ` [PATCH net-next v4 4/4] net: mdio: reset PHY before attempting to access registers in fwnode_mdiobus_register_phy Buday Csaba
2025-10-29  1:26   ` Jakub Kicinski
2025-10-29  7:24     ` Buday Csaba [this message]

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=aQHBKitU6Gyjk37e@debianbuilder \
    --to=buday.csaba@prolan.hu \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=pabeni@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).