Article View: linux.kernel.netdev
Article #17388Re: [PATCH net-next] net: dsa: mv88e6xxx: Enable LED control on 88E6171
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 18:28
Date: Mon, 16 Nov 2026 18:28
229 lines
16303 bytes
16303 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 (1) · Medium: 1 · Low: 1 (1)
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] mv88e6xxx_port_setup_leds() (drivers/net/dsa/mv88e6xxx/leds.c)
now installs the four hw_control_* callbacks only when the chip has…
- [Low] The commit message only talks about enabling LEDs on the 88E6171.
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the patch
extends it to the 88E6171 and adds new callbacks that hit it.
- [Low] mv88e6xxx_led_set_blinking_period() ignores its `led` argument
and rewrites the per-port Stretch/Blink register (pointer 0x6, "for…
--
net: dsa: mv88e6xxx: Enable LED control on 88E6171
This patch enables LED control on the 88E6171. That switch has four LEDs
per port and a register layout similar to the 6352 family. The patch also
adds per-chip num_leds and led_hw_triggers fields, LED2/LED3 register
definitions and callbacks, and installs the hw_control callbacks only
when led_hw_triggers is set.
> diff --git a/drivers/net/dsa/mv88e6xxx/leds.c b/drivers/net/dsa/mv88e6xxx/leds.c
> index ab3bc645da566..925c120afba33 100644
> --- a/drivers/net/dsa/mv88e6xxx/leds.c
> +++ b/drivers/net/dsa/mv88e6xxx/leds.c
[ ... ]
> @@ -526,24 +573,40 @@ static int mv88e6xxx_led_blink_set(struct mv88e6xxx_port *p, int led,
> if (err)
> return err;
>
> - err = mv88e6xxx_port_led_read(p->chip, p->port,
> - MV88E6XXX_PORT_LED_CONTROL_POINTER_LED01_CTRL,
> - ®);
> + if (led == 2 || led == 3)
> + err = mv88e6xxx_port_led_read(p->chip, p->port,
> + MV88E6XXX_PORT_LED_CONTROL_POINTER_LED23_CTRL,
> + ®);
[Severity: Low]
This isn't a bug introduced by this patch, but it now affects up to four
LEDs per port instead of two.
The mv88e6xxx_led_set_blinking_period() call just above this ignores its
led argument. It rebuilds the per-port Stretch/Blink register from
scratch:
drivers/net/dsa/mv88e6xxx/leds.c:mv88e6xxx_led_set_blinking_period() {
...
reg = 0;
...
/* Set up blink rate */
reg |= MV88E6XXX_PORT_LED_CONTROL_POINTER_STRETCH_BLINK;
return mv88e6xxx_port_led_write(p->chip, p->port, reg);
}
On the 6171, a blink_set on LED2 can change the blink rate and pulse
stretch of LED0, LED1 or LED3 on the same port. That happens when the
other LED is in forced blink or a hardware activity mode, and the LED
core still holds that LED's old blink_delay_on/off values.
Is it intended that one LED's blink period changes the other LEDs on the
port? The result is only a wrong blink rate. Nothing crashes.
[ ... ]
> @@ -576,6 +639,34 @@ static int mv88e6xxx_led1_blink_set(struct led_classdev *ldev,
> return err;
> }
>
> +static int mv88e6xxx_led2_blink_set(struct led_classdev *ldev,
> + unsigned long *delay_on,
> + unsigned long *delay_off)
> +{
> + struct mv88e6xxx_port *p = container_of(ldev, struct mv88e6xxx_port, led2);
> + int err;
> +
> + mv88e6xxx_reg_lock(p->chip);
> + err = mv88e6xxx_led_blink_set(p, 2, delay_on, delay_off);
> + mv88e6xxx_reg_unlock(p->chip);
> +
> + return err;
> +}
[Severity: High]
This is a pre-existing issue, but this patch extends it to the 88E6171
by adding .port_setup_leds to mv88e6171_ops. The new LED2/LED3
callbacks also hit it.
mv88e6xxx_setup() takes chip->reg_lock and keeps it held during port
setup, LED classdev registration included. If a DT LED node has
linux,default-trigger = "timer", the trigger is activated synchronously
inside registration:
mv88e6xxx_setup()
mv88e6xxx_reg_lock(chip)
mv88e6xxx_setup_port()
mv88e6xxx_port_setup_leds()
devm_led_classdev_register_ext()
led_classdev_register_ext()
led_trigger_set_default()
timer_trig_activate()
led_blink_set()
led_blink_setup()
mv88e6xxx_led2_blink_set()
mv88e6xxx_reg_lock(p->chip)
Can this deadlock probe on the non-recursive reg_lock that the same task
already holds? The LED core's trigger locks would stay held too.
With linux,default-trigger = "netdev", netdev_trig_activate() calls
register_netdevice_notifier(). That takes rtnl while reg_lock is held,
which is the reverse of the rtnl -> reg_lock order used elsewhere in
the driver.
Could the LED classdevs be registered outside the reg_lock section, or
could the lock be dropped around registration?
[ ... ]
> @@ -771,13 +862,13 @@ int mv88e6xxx_port_setup_leds(struct mv88e6xxx_chip *chip, int port)
> }
>
> fwnode_for_each_child_node(leds, led) {
> - /* Reg represent the led number of the port, max 2
> + /* Reg represent the led number of the port, max 4
> * LEDs can be connected to each port, in some designs
> * only one LED is connected.
> */
> if (fwnode_property_read_u32(led, "reg", &led_num))
> continue;
> - if (led_num > 1) {
> + if (led_num >= mv88e6xxx_num_leds(chip)) {
[Severity: Low]
This isn't a bug, but the commit message only says "Enable LED control
on the Marvell 88E6171". The patch also adds the num_leds and
led_hw_triggers fields, edits the 6172/6176/6240/6352 table entries, and
replaces the fixed led_num > 1 check with this table-driven bound.
Should the commit message mention these changes?
Also, a future chip could set .port_setup_leds and leave .num_leds at its
default of 0. Every DT LED would then be rejected with -EINVAL, and
mv88e6xxx_setup_port() would pass that up:
err = chip->info->ops->port_setup_leds(chip, port);
if (err && err != -EOPNOTSUPP)
return err;
All current users of mv88e6xxx_port_setup_leds() set num_leds, so
nothing changes today.
[ ... ]
> @@ -805,17 +900,27 @@ int mv88e6xxx_port_setup_leds(struct mv88e6xxx_chip *chip, int port)
> if (led_num == 0) {
> l->brightness_set_blocking = mv88e6xxx_led0_brightness_set_blocking;
> l->blink_set = mv88e6xxx_led0_blink_set;
> - l->hw_control_is_supported = mv88e6xxx_led0_hw_control_is_supported;
> - l->hw_control_set = mv88e6xxx_led0_hw_control_set;
> - l->hw_control_get = mv88e6xxx_led0_hw_control_get;
> - l->hw_control_get_device = mv88e6xxx_led0_hw_control_get_device;
> - } else {
> + if (mv88e6xxx_has_led_hw_triggers(chip)) {
> + l->hw_control_is_supported = mv88e6xxx_led0_hw_control_is_supported;
> + l->hw_control_set = mv88e6xxx_led0_hw_control_set;
> + l->hw_control_get = mv88e6xxx_led0_hw_control_get;
> + l->hw_control_get_device = mv88e6xxx_led0_hw_control_get_device;
> + }
> + } else if (led_num == 1) {
[ ... ]
> + } else if (led_num == 2) {
> + l->brightness_set_blocking = mv88e6xxx_led2_brightness_set_blocking;
> + l->blink_set = mv88e6xxx_led2_blink_set;
> + } else {
> + l->brightness_set_blocking = mv88e6xxx_led3_brightness_set_blocking;
> + l->blink_set = mv88e6xxx_led3_blink_set;
> }
> l->hw_control_trigger = "netdev";
[Severity: Medium]
The hw_control_* callbacks are now only installed for LED 0 and LED 1 on
chips with led_hw_triggers. hw_control_trigger is still set to "netdev"
for every LED, though.
Two groups of LEDs end up with hw_control_trigger set and all four
hw_control_* callbacks NULL:
- every LED on the 88E6171, which has no .led_hw_triggers in its
mv88e6xxx_table entry
- LED 2 and LED 3 on any chip
The LED core decides whether to expose the offload attribute only from
hw_control_trigger:
drivers/leds/led-triggers.c:led_trigger_is_visible() {
...
if (attr == &dev_attr_trigger_may_offload_to_hw.attr)
return led_cdev->hw_control_trigger ? attr->mode : 0;
...
}
Won't these LEDs show /sys/class/leds/<led>/trigger_may_offload_to_hw and
report "netdev"? The netdev trigger can never offload to them, because
supports_hw_control() fails when the callbacks are NULL.
Documentation/ABI/testing/sysfs-class-led says this file "Only exists
when the LED supports trigger offload".
Could the hw_control_trigger assignment move inside the
mv88e6xxx_has_led_hw_triggers() blocks for LED 0 and LED 1?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261115181305.2860498-1-olek2%40wp.pl
Technical Details
Message-ID:
<179485368308.3136.7792285463770201069@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364625-linux-kernel-netdev=dewy.ruReferences:
<20261115181305.2860498-1-olek2@wp.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364625-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next] net: dsa: mv88e6xxx: Enable LED control on 88E6171 Date: Mon, 16 Nov 2026 18:28:03 +0000 Organization: Usenet Network Message-ID: <179485368308.3136.7792285463770201069@kernel.org> References: <20261115181305.2860498-1-olek2@wp.pl> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2136276"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:BxyogEwKSUX1nqoDwEa0rsS9RvA= sha256:KtpA0EtkhdzCYbWZR7+ih3151n4+BRswfgW91nHBFL8= sha1:k8E1Rny49cRx7NexrALI255R0/k= sha256:LE/5JdG2dIqao4OBSjRmhPeLdkEGOb7u/3u7pSxqLfc= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 27CA3114D29; Mon, 16 Nov 2026 21:28:27 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wYoy_vEFYPv4; Mon, 16 Nov 2026 21:28:22 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-364625-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 47435114D1C; Mon, 16 Nov 2026 21:28:12 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 5E30C25A5D; Mon, 16 Nov 2026 18:28:08 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794853685; b=dlha5W/iwK7BbcbjbmWMQ9ohdqHtxYvoyuHa1hUX4A6bMBBphumnU8FlrwHRIzRHu3LQ ny8YmK6Ov7vGIp0gmey3zuzYtvnFbyFWgz3opNOZl/U39kPBS62Q1LFqjIlzdnwzC4O60 AlBJXTjJYcABRdSHHt5mZiB5SWf3FhK2T51/ZR9QdfZG8tM+7LsvZ4EDBqzvIVkWtTdGK a339UzF2Vfbbeiz8zFhvL47yqAoeW9OryaidYv3/jKVbtiBeUKr/rX6aVm2SM8DUpVU21 tvZ6CXg86GdDFEubOzA4RhQHAjolTX/QY/fQ+UgiYsMfXhLivr1F3wbvIDmGyTwuSZw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794853685; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=fxJgyiv8oOoTp+D10o3vZr2gQ5VGkKt/9+lDC8DjeV8=; b=cz4aDyl9Ij5S9RNWJWEx/WBhiZtnd617/PM3QXY/X0bYrR4xR5uEWKGpUrJcSlHjfqca NHz9ojxBCrSavIlmcHwOVx5OGalRq6f+eKELMra5Hs9Vmu8Y7+NZ7QmsGMBquwbb8KhKg XMvjOKq4DIDNLPOoQ6QBhFUgu6aLTGYqvS2qpDIvE+jdjMw7g8aLCnepycCbJZdmKarFJ DJpV+bi/OetIVQm/yGIvtGeRp+fo0kRtOWREbjuDLwXRTtSxP1KjTaNwKt+Aq7iCkSnFf wXNwOhNP8IKqiV+z8MeWSuX0K9URG+Q6LHjaMm+v/SB8CYiI2dUOLgtFoQRZIqQJs3Q== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LDuzLia+; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00737606A334; Mon, 16 Nov 2026 18:28:05 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LDuzLia+ X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794853684; b=YuKUneAU/5w/ys6IND5sdjSSjW7uq39Fkx16nrOMwYtTsfNzVzdl9nu1Cz3CUcG75EMI 7SKlSEDU2CyUkVqwvRYeXZwb3TevsTcrvjF8QiynwdVM7IyS0ssYH0lkLSnVnlc6YSKis E3cSMDNXky8FW448342h/r6DbTsng2b8w2B40nx1PugnmfX7EsOnM4FlH6gZCs8c5biOP RkuOXoFSYv/c894j47IOpChEzIG71mbAmWwAYlIppCvNw+JiV0effemEOfJeUKUdsU0+U NA8wl4QUYz3SJRiY4/Xfbiqhg23Ax4KGvmhIcT+U1f5o6Bp6R+Gw4M/FC7/ArzcFvpw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794853684; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=fxJgyiv8oOoTp+D10o3vZr2gQ5VGkKt/9+lDC8DjeV8=; b=faxlFgdBPXKKzREws85QaiGZTeGkvAP5ZY0796HJu5agQuQx4s5AccZ2gJfwMTXm30eo FBcV+PRykYkyJMZoe9idLCxE/VXhOZEFVuEZzvuuZ92Y4x8MWWfjH+Dyvv1Miii3nQhU+ XFhytzMkX0tcdYgYYKSaM7+R7ZFcZ3zlu4UcLLFQ6jzeW12uOp4RiD/oEUMzoQ6t54+Od bMFZextfeN6DzJiTQmu8u25s+lm4Lg4ejVhj92/Riur2zc6FHlOa7unBeDn8foLldWb1G jMW9ARWnn57rLut+RJVqq62Ip8hfAdlHOxbgBEN78b/K0VFOADdZjUbbGpf57Av8i3w== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LDuzLia+; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C5EB606A31C; Mon, 16 Nov 2026 18:28:04 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 807661F000C4; Mon, 16 Nov 2026 18:28:03 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794853684; bh=fxJgyiv8oOoTp+D10o3vZr2gQ5VGkKt/9+lDC8DjeV8=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=LDuzLia+wSrpqSKniNnq7YdBi008lPmTmB6a5Mw7m/LdU+dcPV1j0VQ9nifZZQFnT yb9MZImV/S1D7lbk/kcjkXFpISHnmCTjcAsn+VgSd9rm2gWMy8LyMxIT0qMOrLfKu1 j6Mxi7WDHsvhEsABKYCRi+IE7+gLVoZOQP2feZKsd5xQwyOMTHJQ/8oRurun7b+/dO SwIoMHCyUlMRbI1VBnTDX46KBIkklYH6ElSRTh0YetC3g+C+SONPLR1bRsERQgNXPP Qo8VELssED7aMNd4fOrsA3ILxVagE1dWk3Lskq6VTxbzCwJC+SeKXcmD99AdtCIGfT l/CiNmzaCjMcg== X-Cc: andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261115181305.2860498-1-olek2@wp.pl> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list