mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: donggeunyoo.kernel@gmail.com
Cc: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	linux@armlinux.org.uk, daniel@makrotopia.org,
	o.rempel@pengutronix.de, netdev@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH net v3 3/3] net: phy: qca808x: handle the active-high LED polarity mode
Date: Wed, 09 Sep 2026 23:02:26 +0000	[thread overview]
Message-ID: <178899494670.219967.8563823740478760743@kernel.org> (raw)
In-Reply-To: <20260908105959.70453-4-donggeunyoo.kernel@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider:

Critical: 0 · High: 1 · Medium: 0 · Low: 0

- [High] Incomplete fix in drivers/net/phy/qcom/qca808x.c: the new `case
  PHY_LED_ACTIVE_HIGH: active_low = false;` in…

--

net: phy: qca808x: handle the active-high LED polarity mode

This adds a PHY_LED_ACTIVE_HIGH case to qca808x_led_polarity_set() so that
a device tree LED node carrying the 'active-high' property no longer makes
the switch fall into the default case and return -EINVAL, which previously
failed phy_probe().

> diff --git a/drivers/net/phy/qcom/qca808x.c b/drivers/net/phy/qcom/qca808x.c
> index 8eb51b1a006c..3ba58f14e248 100644
> --- a/drivers/net/phy/qcom/qca808x.c
> +++ b/drivers/net/phy/qcom/qca808x.c
> @@ -603,6 +603,9 @@ static int qca808x_led_polarity_set(struct phy_device *phydev, int index,
>  		case PHY_LED_ACTIVE_LOW:
>  			active_low = true;
>  			break;
> +		case PHY_LED_ACTIVE_HIGH:
> +			active_low = false;
> +			break;
>  		default:
>  			return -EINVAL;
>  		}

[Severity: High]
Does this new case leave the LED driven active-low, i.e. the inverse of
what the device tree asked for?

Before this change priv->led_polarity_mode could only hold -1 (never
requested) or 1 (active-low requested).  With the new case an explicit
'active-high' node now stores 0:

drivers/net/phy/qcom/qca808x.c:qca808x_led_polarity_set() {
	...
	/* Save the last PHY polarity mode */
	priv->led_polarity_mode = active_low;

	return phy_modify_mmd(phydev, MDIO_MMD_AN,
			      QCA808X_MMD7_LED_POLARITY_CTRL,
			      QCA808X_LED_ACTIVE_HIGH,
			      active_low ? 0 : QCA808X_LED_ACTIVE_HIGH);
}

The only other place QCA808X_LED_ACTIVE_HIGH gets programmed tests for -1
specifically:

drivers/net/phy/qcom/qca808x.c:qca808x_config_init() {
	/* Default to LED Active High if active-low not in DT */
	if (priv->led_polarity_mode == -1) {
		ret = phy_set_bits_mmd(phydev, MDIO_MMD_AN,
				       QCA808X_MMD7_LED_POLARITY_CTRL,
				       QCA808X_LED_ACTIVE_HIGH);
	...
}

so the newly reachable value 0 skips that write.

phy_init_hw() runs drv->soft_reset (qca808x_soft_reset ->
genphy_soft_reset, BMCR_RESET) before drv->config_init, and it is called
from phy_attach_direct() and again from mdio_bus_phy_resume().  Since
BIT(6) has to be set explicitly for active high:

drivers/net/phy/qcom/qca808x.c:
/* QSDK sets by default 0x46 to this reg that sets BIT 6 for
 * LED to active high. It's not clear what BIT 3 and BIT 4 does.
 */
#define QCA808X_LED_ACTIVE_HIGH			BIT(6)

isn't the single probe-time phy_modify_mmd() write discarded by that reset
and then never restored, leaving the LED active-low?

That would make a device tree that explicitly states 'active-high' behave
worse than one that omits the property entirely, since the omitted case
keeps led_polarity_mode == -1 and does get the bit re-asserted from
config_init.

There is a second effect of the overloaded value: with
priv->led_polarity_mode == 0 the driver's global-polarity bookkeeping
records "active high" while the register says active low, so a second LED
also requesting active-high passes the mismatch check against state that
does not reflect the hardware.

Should qca808x_config_init() also cover the explicit active-high case, for
example by re-asserting the bit whenever led_polarity_mode != 1, or by
using a distinct sentinel for "not requested" rather than overloading -1
and 0?

Related to this, could the commit message paragraph:

  "active_low is already false when no polarity mode is requested, which
  programs QCA808X_LED_ACTIVE_HIGH, so the request is already satisfied and
  only the case label is missing."

be revisited?  In the no-property case led_polarity_set is not called at
all (of_phy_led() only calls it when modes is non-zero), so what programs
QCA808X_LED_ACTIVE_HIGH there is the led_polarity_mode == -1 branch of
qca808x_config_init(), which the new case label makes unreachable for an
explicit active-high request.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260908105959.70453-1-donggeunyoo.kernel%40gmail.com

  parent reply	other threads:[~2026-09-09 23:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 10:59 [PATCH net v3 0/3] net: phy: " Donggeun Yoo
2026-09-08 10:59 ` [PATCH net v3 1/3] net: phy: dp83867: " Donggeun Yoo
2026-09-08 14:02   ` Andrew Lunn
2026-09-08 10:59 ` [PATCH net v3 2/3] net: phy: dp83td510: " Donggeun Yoo
2026-09-08 14:06   ` Andrew Lunn
2026-09-08 10:59 ` [PATCH net v3 3/3] net: phy: qca808x: " Donggeun Yoo
2026-09-08 14:09   ` Andrew Lunn
2026-09-09 23:02   ` netdev-bot+sashiko [this message]
2026-09-10 15:20 ` [PATCH net v3 0/3] net: phy: " patchwork-bot+netdevbpf
2026-09-10 15:50 ` patchwork-bot+netdevbpf

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=178899494670.219967.8563823740478760743@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=donggeunyoo.kernel@gmail.com \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=stable@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

all inboxes | Powered by JetHome®