From: Imre Kaloz <kaloz@kernel.org>
To: Lee Jones <lee@kernel.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
Pavel Machek <pavel@kernel.org>,
linux-leds@vger.kernel.org
Subject: Re: [PATCH v2 51/53] leds: Add driver for the SGI Fuel and Tezro front-panel LEDs
Date: Tue, 20 Oct 2026 23:08:30 +0200 [thread overview]
Message-ID: <20261020210831.12225-1-kaloz@kernel.org> (raw)
In-Reply-To: <179198335037.839288.6380344650126608454@kernel.org>
On Tue, 20 Oct 2026, Lee Jones wrote:
> > +struct ip35_leds;
>
> Can you find another way to avoid: leds->led->leds->led->leds ...
I can, and it comes out nicer too. The LED core registers the classdev
with &pdev->dev as its parent, so the callbacks can get at the shared
state through dev_get_drvdata(cdev->dev->parent). I'll set it with
platform_set_drvdata() before the registration loop, drop the forward
declaration and the back-pointer, and have the update helper take both
the shared state and the LED:
static int ip35_led_update(struct ip35_leds *leds,
struct ip35_led *led, unsigned int state)
> > + struct mutex lock; /* protects ->state of both LEDs */
>
> Not sure that comment is required.
Agreed, gone.
> > + mutex_lock(&leds->lock);
>
> guard(mutex)(&leds->lock) ?
Will do. The explicit mutex_unlock() goes with it.
> > + for (i = 0; i < ARRAY_SIZE(leds->led); i++) {
>
> for (int i = 0; ...
Will do, here and in probe.
> > + *delay_on = 1000;
> > + *delay_off = 1000;
>
> If the hardware only supports a fixed 2s period (1000ms on / 1000ms
> off), shouldn't we only accept it when '*delay_on == 0 && *delay_off
> == 0' (or when both are already 1000) and return '-EINVAL' otherwise
> so the LED core falls back to software blinking for other requested
> rates?
You're right, and that is the better behaviour.
> > +static struct platform_driver ip35_leds_driver = {
> > + .probe = ip35_leds_probe,
> > + .driver = {
> > + .name = "ip35-leds",
> > + },
> > +};
>
> This padding is creeping me out.
>
> Why would you line-up things that aren't at the same level?
Old habits, and no good reason beyond that :) The tab alignment on
.probe, .driver and .name goes; v3 will use a single space before each '='.
Thanks a lot for the thorough review,
Imre
next prev parent reply other threads:[~2026-10-20 21:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 13:16 [PATCH v2 00/53] MIPS: SGI-IP27: add support for the IP35 (Bedrock hub) machines Imre Kaloz
2026-10-13 13:17 ` [PATCH v2 50/53] MIPS: SGI-IP27: add L1 front-panel LED and display requests Imre Kaloz
2026-10-13 13:17 ` [PATCH v2 51/53] leds: Add driver for the SGI Fuel and Tezro front-panel LEDs Imre Kaloz
2026-10-20 12:20 ` Lee Jones
2026-10-20 21:08 ` Imre Kaloz [this message]
2026-10-13 13:17 ` [PATCH v2 52/53] MIPS: SGI-IP27: show the OS state on the Fuel and Tezro front panels Imre Kaloz
2026-10-13 13:17 ` [PATCH v2 53/53] MIPS: ip27_defconfig: enable the Fuel and Tezro front-panel LEDs Imre Kaloz
2026-10-13 13:35 ` [PATCH v2 00/53] MIPS: SGI-IP27: add support for the IP35 (Bedrock hub) machines Niklas Cassel
2026-10-13 14:25 ` Imre Kaloz
2026-10-20 18:06 ` Jakub Kicinski
2026-10-20 20:42 ` Imre Kaloz
2026-10-20 21:56 ` Jakub Kicinski
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=20261020210831.12225-1-kaloz@kernel.org \
--to=kaloz@kernel.org \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=tsbogend@alpha.franken.de \
/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