From: sashiko-bot@kernel.org
To: "Edelweise Escala" <edelweise.escala@analog.com>
Cc: devicetree@vger.kernel.org, linux-leds@vger.kernel.org,
lee@kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v13 2/2] leds: ltc3220: Add Support for LTC3220 18 channel LED Driver
Date: Thu, 09 Jul 2026 00:55:32 +0000 [thread overview]
Message-ID: <20260709005533.6680A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709-ltc3220-driver-v13-2-9b53237642eb@analog.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Aggregated LED mode breaks after suspend/resume because regcache_sync() overwrites LEDs 2-18 with zeros.
- [Medium] Missing LED_CORE_SUSPENDRESUME flag and missing locking in suspend/resume handlers allow race conditions.
--
--- Patch [2]: [PATCH v13 2/2] leds: ltc3220: Add Support for LTC3220 18 channel LED Driver ---
commit 530249002ce164e8156c89d4dcd1994b3713c0c8
Author: Edelweise Escala <edelweise.escala@analog.com>
leds: ltc3220: Add Support for LTC3220 18 channel LED Driver
Add driver for the LTC3220 18-channel LED driver with I2C interface, individual
brightness control, and hardware-assisted blink/gradation features.
> diff --git a/drivers/leds/leds-ltc3220.c b/drivers/leds/leds-ltc3220.c
> --- /dev/null
> +++ b/drivers/leds/leds-ltc3220.c
[ ... ]
> @@ -371,20 +371,11 @@ static int ltc3220_suspend(struct device *dev)
> {
> struct ltc3220 *ltc3220 = i2c_get_clientdata(to_i2c_client(dev));
> int ret;
>
[Severity: Medium]
Should ltc3220->lock be held here?
Because LED_CORE_SUSPENDRESUME is not set on the led_classdev, triggers and
sysfs writes can still fire during suspend, potentially racing with these
state changes and executing I2C writes while the device is in shutdown.
> ret = regmap_update_bits(ltc3220->regmap, LTC3220_COMMAND_REG,
> LTC3220_SHUTDOWN_MASK, LTC3220_SHUTDOWN_MASK);
> if (ret)
> return ret;
[ ... ]
> @@ -391,24 +382,15 @@ static int ltc3220_resume(struct device *dev)
> {
> struct ltc3220 *ltc3220 = i2c_get_clientdata(to_i2c_client(dev));
> bool quick_write_enabled;
> unsigned int command_reg;
> int ret;
[ ... ]
> if (quick_write_enabled) {
> ret = regmap_update_bits(ltc3220->regmap, LTC3220_COMMAND_REG,
> LTC3220_QUICK_WRITE_MASK, 0);
> if (ret)
> return ret;
> }
>
> ret = regmap_update_bits(ltc3220->regmap, LTC3220_COMMAND_REG,
> LTC3220_SHUTDOWN_MASK, 0);
> if (ret)
> return ret;
>
> usleep_range(10000, 12000);
>
[Severity: Medium]
Because the driver does not set LED_CORE_SUSPENDRESUME or hold ltc3220->lock
during resume, can an LED trigger fire during this sleep?
If a trigger calls ltc3220_set_led_data() here while QUICK_WRITE is temporarily
disabled, the write would only apply to a single LED instead of broadcasting
to all channels.
> ret = regcache_sync(ltc3220->regmap);
[Severity: High]
Does this regcache_sync() break aggregated LED mode?
Since the cache for LEDs 2-18 contains zeros from their initial state, and
QUICK_WRITE is disabled during the sync, this looks like it will explicitly
write zeros to those channels, leaving most LEDs permanently off after resume.
> if (ret)
> return ret;
[ ... ]
> @@ -499,19 +481,10 @@ static int ltc3220_probe(struct i2c_client *client)
[ ... ]
> /* Second pass: register LEDs after validation */
> device_for_each_child_node_scoped(&client->dev, child) {
> struct led_init_data init_data = {};
> struct ltc3220_uled_cfg *led;
> u32 source;
[ ... ]
> init_data.fwnode = child;
> init_data.devicename = "ltc3220";
>
> led_index = source - 1;
> led = <c3220->uled_cfg[led_index];
>
[Severity: Medium]
Does this led_cdev need the LED_CORE_SUSPENDRESUME flag set in its flags
field so the LED core knows to suspend triggers during system suspend?
> ret = devm_led_classdev_register_ext(&client->dev, &led->led_cdev, &init_data);
> if (ret)
> return dev_err_probe(&client->dev, ret, "Failed to register LED class\n");
> }
>
> return 0;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709-ltc3220-driver-v13-0-9b53237642eb@analog.com?part=2
next prev parent reply other threads:[~2026-07-09 0:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 0:41 [PATCH v13 0/2] Add Support for LTC3220 18 Channel LED Driver Edelweise Escala
2026-07-09 0:41 ` [PATCH v13 1/2] dt-bindings: leds: Add LTC3220 18 channel " Edelweise Escala
2026-07-09 0:53 ` sashiko-bot
2026-07-09 1:12 ` Escala, Edelweise
2026-07-09 0:41 ` [PATCH v13 2/2] leds: ltc3220: Add Support for " Edelweise Escala
2026-07-09 0:55 ` sashiko-bot [this message]
2026-07-09 1:07 ` Escala, Edelweise
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=20260709005533.6680A1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=edelweise.escala@analog.com \
--cc=lee@kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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