Linux LED subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Markus Probst" <markus.probst@posteo.de>
Cc: linux-leds@vger.kernel.org, lee@kernel.org, robh@kernel.org,
	devicetree@vger.kernel.org, ojeda@kernel.org,
	conor+dt@kernel.org
Subject: Re: [PATCH v17 2/2] platform: Add initial synology microp driver
Date: Fri, 24 Jul 2026 15:11:04 +0000	[thread overview]
Message-ID: <20260724151104.EAA651F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260724-synology_microp_initial-v17-2-e2f70b4dc691@posteo.de>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Hardware blinking is not disabled when setting a solid brightness.
- [Medium] StatusLedHandler::blink_set does not update delay_on and delay_off when subled_intensity == 0, causing incorrect sysfs blink rate reporting.
--

--- Patch [2]: [PATCH v17 2/2] platform: Add initial synology microp driver ---
commit 4d27f9676f69d36945bb122b6d9df48adadc7625
Author: Markus Probst <markus.probst@posteo.de>

platform: Add initial synology microp driver

This commit adds an initial Synology microp driver written in Rust to
control the power, status, alert, and USB LEDs on Synology NAS devices.
The driver targets a microcontroller found on these devices.

> diff --git a/drivers/platform/synology_microp/led.rs b/drivers/platform/synology_microp/led.rs
> new file mode 100644
> index 0000000000000..ce57adfd307f2
> --- /dev/null
> +++ b/drivers/platform/synology_microp/led.rs

[ ... ]

> +    fn brightness_set<'bound>(
> +        &self,
> +        dev: &'bound Self::Bus,
> +        _classdev: &led::Device<'bound, Self>,
> +        brightness: u32,
> +    ) -> Result<()> {
> +        let mut blink = self.blink.lock();
> +        (self.command)(if brightness == 0 {
> +            *blink = false;
> +            State::Off
> +        } else if *blink {
> +            State::Blink

[Severity: Medium]
Does this prevent transitioning the LED from a blinking state to a solid ON
state?

If userspace sets a hardware blink, the blink variable becomes true. Later, if
userspace writes a non-zero brightness to turn the LED solid ON, this code
path checks the blink variable and issues State::Blink instead of State::On,
leaving the hardware in a blinking state.

> +        } else {
> +            State::On
> +        })
> +        .write(dev)?;
> +
> +        Ok(())
> +    }

[ ... ]

> +    fn brightness_set<'bound>(
> +        &self,
> +        dev: &'bound Self::Bus,
> +        classdev: &led::MultiColorDevice<'bound, Self>,
> +        brightness: u32,
> +    ) -> Result<()> {
> +        let mut blink = self.blink.lock();
> +        if brightness == 0 {
> +            *blink = false;
> +        }
> +
> +        let amber_brightness = classdev.subleds()[1].brightness();
> +
> +        let (color, subled_brightness) = if amber_brightness == 0 {
> +            (StatusLedColor::Green, classdev.subleds()[0].brightness())
> +        } else {
> +            (StatusLedColor::Amber, amber_brightness)
> +        };
> +
> +        Command::StatusLed(
> +            color,
> +            if subled_brightness == 0 {
> +                State::Off
> +            } else if *blink {
> +                State::Blink

[Severity: Medium]
Similarly here, does this prevent the multi-color status LED from being set to
a solid ON state once it is blinking?

> +            } else {
> +                State::On
> +            },
> +        )
> +        .write(dev)
> +    }

[ ... ]

> +    fn blink_set<'bound>(
> +        &self,
> +        dev: &'bound Self::Bus,
> +        classdev: &led::MultiColorDevice<'bound, Self>,
> +        delay_on: &mut usize,
> +        delay_off: &mut usize,
> +    ) -> Result<()> {
> +        let mut blink = self.blink.lock();
> +        *blink = true;
> +
> +        let amber_intensity = classdev.subleds()[1].intensity();
> +
> +        let (color, subled_intensity) = if amber_intensity == 0 {
> +            (StatusLedColor::Green, classdev.subleds()[0].intensity())
> +        } else {
> +            (StatusLedColor::Amber, amber_intensity)
> +        };
> +        Command::StatusLed(
> +            color,
> +            if *delay_on == 0 && *delay_off != 0 {
> +                *blink = false;
> +                State::Off
> +            } else if subled_intensity == 0 {
> +                State::Off

[Severity: Medium]
Are delay_on and delay_off left un-updated when subled_intensity is 0?

If userspace configures a blink rate while the multi-color LED intensity is 0,
this returns State::Off to the hardware but successfully returns to the LED
core without updating the delay values to the fixed hardware blink rate.
This can cause sysfs to report the user-provided values rather than the actual
hardware rate.

> +            } else if *delay_on != 0 && *delay_off == 0 {
> +                *blink = false;
> +                State::On
> +            } else {
> +                *delay_on = BLINK_DELAY.as_millis() as usize;
> +                *delay_off = BLINK_DELAY.as_millis() as usize;
> +
> +                State::Blink
> +            },
> +        )
> +        .write(dev)
> +    }
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260724-synology_microp_initial-v17-0-e2f70b4dc691@posteo.de?part=2

      reply	other threads:[~2026-07-24 15:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24 14:55 [PATCH v17 0/2] Introduce Synology Microp driver Markus Probst
2026-07-24 14:55 ` [PATCH v17 1/2] dt-bindings: embedded-controller: Add synology microp devices Markus Probst
2026-07-24 15:04   ` sashiko-bot
2026-07-24 14:55 ` [PATCH v17 2/2] platform: Add initial synology microp driver Markus Probst
2026-07-24 15:11   ` sashiko-bot [this message]

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=20260724151104.EAA651F000E9@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=markus.probst@posteo.de \
    --cc=ojeda@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