From: Vladimir Oltean <olteanv@gmail.com>
To: "A. Sverdlin" <alexander.sverdlin@siemens.com>
Cc: netdev@vger.kernel.org, Anatolij Gustschin <agust@denx.de>,
Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: [PATCH net v2] net: dsa: lan9303: ensure chip reset and wait for READY status
Date: Fri, 4 Oct 2024 00:15:24 +0300 [thread overview]
Message-ID: <20241003211524.ugrkjjc7legax2ak@skbuf> (raw)
In-Reply-To: <20241002171230.1502325-1-alexander.sverdlin@siemens.com>
On Wed, Oct 02, 2024 at 07:12:28PM +0200, A. Sverdlin wrote:
> @@ -866,6 +869,29 @@ static int lan9303_check_device(struct lan9303 *chip)
> int ret;
> u32 reg;
>
> + /*
> + * In I2C-managed configurations this polling loop will clash with
netdev coding style is with comments like this: /* In I2C managed configurations...
> + * switch's reading of EEPROM right after reset and this behaviour is
> + * not configurable. While lan9303_read() already has quite long retry
> + * timeout, seems not all cases are being detected as arbitration error.
These arbitration errors happen only after reset? So in theory, after
this patch, we could remove the for() loop from lan9303_read()?
> + *
> + * According to datasheet, EEPROM loader has 30ms timeout (in case of
> + * missing EEPROM).
> + *
> + * Loading of the largest supported EEPROM is expected to take at least
> + * 5.9s.
> + */
> + if (read_poll_timeout(lan9303_read, ret, reg & LAN9303_HW_CFG_READY,
Isn't "reg" uninitialized if "ret" is non-zero? So shouldn't be "ret"
also part of the break condition somehow?
> + 20000, 6000000, false,
> + chip->regmap, LAN9303_HW_CFG, ®)) {
> + dev_err(chip->dev, "HW_CFG not ready: 0x%08x\n", reg);
> + return -ENODEV;
What point is there to mangle the return code from read_poll_timeout()
(-ETIMEDOUT) into -ENODEV, instead of just propagating that?
> + }
> + if (ret) {
> + dev_err(chip->dev, "failed to read HW_CFG reg: %d\n", ret);
%pe, ERR_PTR(ret) is nicer for the average, non-expert in errno.h user.
I see this driver isn't using it, so maybe there's an argument about
consistency, but there's a beginning for everything..
> + return ret;
> + }
> +
> ret = lan9303_read(chip->regmap, LAN9303_CHIP_REV, ®);
> if (ret) {
> dev_err(chip->dev, "failed to read chip revision register: %d\n",
> --
> 2.46.2
>
next prev parent reply other threads:[~2024-10-03 21:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-02 17:12 [PATCH net v2] net: dsa: lan9303: ensure chip reset and wait for READY status A. Sverdlin
2024-10-03 21:15 ` Vladimir Oltean [this message]
2024-10-04 7:26 ` Sverdlin, Alexander
2024-10-04 8:16 ` Vladimir Oltean
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=20241003211524.ugrkjjc7legax2ak@skbuf \
--to=olteanv@gmail.com \
--cc=agust@denx.de \
--cc=alexander.sverdlin@siemens.com \
--cc=andrew@lunn.ch \
--cc=f.fainelli@gmail.com \
--cc=netdev@vger.kernel.org \
/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