From: sashiko-bot@kernel.org
To: "Nora Schiffer" <nora.schiffer@ew.tq-group.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org,
linux-leds@vger.kernel.org, lee@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 8/8] leds: pca995x: Add support for group brightness control
Date: Tue, 15 Sep 2026 14:32:46 +0000 [thread overview]
Message-ID: <20260915143246.CF3C01F000FF@smtp.kernel.org> (raw)
In-Reply-To: <bb9d86b8891d58eab135038dfde70ae024f244c1.1789477502.git.nora.schiffer@ew.tq-group.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] sysfs: race condition between LED registration and parent attributes creation
--
commit 519bef49574c49d4cda0dcf149ce7b8d6e09657e
Author: Nora Schiffer <nora.schiffer@ew.tq-group.com>
leds: pca995x: Add support for group brightness control
When LEDs are set to PWM mode with group control enabled, their
brightness can control using a global "group PWM" setting, modulating
the individual LEDs' brightness with a second PWM running at a different
frequency. This patch introduces sysfs attributes to expose group
brightness control and clear error flags.
> diff --git a/drivers/leds/leds-pca995x.c b/drivers/leds/leds-pca995x.c
> index 963e453ce117d..33da3cd9cbbbf 100644
> --- a/drivers/leds/leds-pca995x.c
> +++ b/drivers/leds/leds-pca995x.c
[ ... ]
> @@ -190,10 +194,41 @@ static ssize_t has_errors_store(struct device *dev, struct device_attribute *att
> return ret ?: count;
> }
>
> +static ssize_t group_brightness_show(struct device *dev, struct device_attribute *attr, char *buf)
> +{
[ ... ]
> +static ssize_t group_brightness_store(struct device *dev, struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
[ ... ]
> static DEVICE_ATTR_RW(has_errors);
> +static DEVICE_ATTR_RW(group_brightness);
>
> static struct attribute *pca995x_attrs[] = {
> &dev_attr_has_errors.attr,
> + &dev_attr_group_brightness.attr,
> NULL,
> };
[Severity: Medium]
Does this attribute registration order create a race condition with userspace?
Looking at pca995x_probe(), devm_led_classdev_register_ext() is called to
register the LEDs, which emits KOBJ_ADD uevents. Later in the function,
sysfs_create_groups() is called to create these parent attributes.
Because the attributes are created after the uevent is emitted, udev rules
triggered by the LED addition might fail to read the new group_brightness
attribute because it is not yet created.
Similarly on device removal, sysfs_remove_groups() is called in
pca995x_remove() before the managed devres cleanup unregisters the child
LED devices. This causes the attributes to disappear while the LEDs are
still registered and potentially active.
Could we avoid this race during teardown and initialization by using
devm_device_add_groups() before registering the LED class devices?
--
Sashiko AI review · https://sashiko.dev/#/patchset/bd687915af26ccdbfc8cc911eee0787fc8145ae1.1789477502.git.nora.schiffer@ew.tq-group.com?part=8
next prev parent reply other threads:[~2026-09-15 14:32 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 13:43 [PATCH v2 1/8] dt-bindings: leds: pca995x: Describe reset-gpios property Nora Schiffer
2026-09-15 13:43 ` [PATCH v2 2/8] dt-bindings: leds: pca995x: Describe nxp,output-gain property Nora Schiffer
2026-09-15 14:22 ` sashiko-bot
2026-09-17 10:16 ` Krzysztof Kozlowski
2026-09-15 13:43 ` [PATCH v2 3/8] leds: pca995x: Fix maximum LED index for 16-channel variants Nora Schiffer
2026-09-15 14:24 ` sashiko-bot
2026-09-15 13:43 ` [PATCH v2 4/8] leds: pca995x: Add support for reset GPIO Nora Schiffer
2026-09-15 14:22 ` sashiko-bot
2026-09-15 13:43 ` [PATCH v2 5/8] leds: pca995x: Make output gain configurable Nora Schiffer
2026-09-15 14:22 ` sashiko-bot
2026-09-22 16:12 ` Lee Jones
2026-09-15 13:43 ` [PATCH v2 6/8] leds: pca995x: Add sysfs files for error reporting Nora Schiffer
2026-09-15 14:23 ` sashiko-bot
2026-09-15 13:43 ` [PATCH v2 7/8] leds: pca995x: Do not use full on LED mode Nora Schiffer
2026-09-15 14:26 ` sashiko-bot
2026-09-15 13:43 ` [PATCH v2 8/8] leds: pca995x: Add support for group brightness control Nora Schiffer
2026-09-15 14:32 ` sashiko-bot [this message]
2026-09-15 14:48 ` Nora Schiffer
2026-09-15 14:20 ` [PATCH v2 1/8] dt-bindings: leds: pca995x: Describe reset-gpios property sashiko-bot
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=20260915143246.CF3C01F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lee@kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=nora.schiffer@ew.tq-group.com \
--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