Linux-LEDs Archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Abdel Alkuor <alkuor@gmail.com>
Cc: "Pavel Machek" <pavel@ucw.cz>, "Rob Herring" <robh+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Alice Chen" <alice_chen@richtek.com>,
	"Jean-Jacques Hiblot" <jjhiblot@traphandler.com>,
	"ChiYuan Huang" <cy_huang@richtek.com>,
	"ChiaEn Wu" <chiaen_wu@richtek.com>,
	"Lukas Bulwahn" <lukas.bulwahn@gmail.com>,
	"André Apitzsch" <git@apitzsch.eu>,
	linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] leds: Add NCP5623 multi-led driver
Date: Tue, 5 Mar 2024 09:04:29 +0000	[thread overview]
Message-ID: <20240305090429.GA5206@google.com> (raw)
In-Reply-To: <ZeaRpSrkeFKAXIlq@abdel>

On Mon, 04 Mar 2024, Abdel Alkuor wrote:

> On Fri, Mar 01, 2024 at 08:50:46AM +0000, Lee Jones wrote:
> 
> Hi Lee,
> > > +#define NCP5623_REG(x)			((x) << 0x5)
> > 
> > What's 0x5?  Probably worth defining.
> This is a function offset. I'll add a define.
> 
> > 
> > > +	guard(mutex)(&ncp->lock);
> > 
> > Are these self-unlocking?
> Correct. Here is a short introduction about it
> https://www.marcusfolkesson.se/blog/mutex-guards-in-the-linux-kernel/

Neat.

> > > +	ncp->old_brightness = brightness;
> > 
> > The nomenclature is confusing here.
> > 
> > For the most part, this will carry the present value, no?
> >
> Yes, I'll change it to current_brightness instead

Just 'brightness' will be fine.

> > > +	ret = ncp5623_write(ncp->client,
> > > +			    NCP5623_DIMMING_TIME_REG, pattern[0].delta_t / 8);
> > 
> > Why 8?  Magic numbers should be replaced with #defines.
> > 
> This is dim step in ms. I'll add a define for it.
> 
> > > +static int ncp5623_pattern_clear(struct led_classdev *led_cdev)
> > > +{
> > > +	return 0;
> > > +}
> > 
> > Not sure I see the point in this.
> > 
> > Is the .pattern_clear() compulsorily?
> >
> Unfortunately, it is. For example, in pattern_trig_store_patterns, when
> hw pattern is used, it is expected to have pattern_clear implemented.
> 
> static ssize_t pattern_trig_store_patterns(struct led_classdev *led_cdev,
>                                             const char *buf, const u32 *buf_int,
>                                             size_t count, bool hw_pattern)
> {
> 	...
>          if (data->is_hw_pattern)
>                  led_cdev->pattern_clear(led_cdev);
>  	...
> }

Something's not right then.  If this is required, are you sure you're
not meant to do something here?  If there are times when this is not
required, it should be possible to omit it.

-- 
Lee Jones [李琼斯]

  reply	other threads:[~2024-03-05  9:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-17 23:09 [PATCH v2 1/2] dt-bindings: leds: Add NCP5623 multi-LED Controller Abdel Alkuor
2024-02-17 23:09 ` [PATCH v2 2/2] leds: Add NCP5623 multi-led driver Abdel Alkuor
2024-03-01  8:50   ` Lee Jones
2024-03-05  3:29     ` Abdel Alkuor
2024-03-05  9:04       ` Lee Jones [this message]
2024-02-20 10:03 ` [PATCH v2 1/2] dt-bindings: leds: Add NCP5623 multi-LED Controller Krzysztof Kozlowski

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=20240305090429.GA5206@google.com \
    --to=lee@kernel.org \
    --cc=alice_chen@richtek.com \
    --cc=alkuor@gmail.com \
    --cc=chiaen_wu@richtek.com \
    --cc=conor+dt@kernel.org \
    --cc=cy_huang@richtek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=git@apitzsch.eu \
    --cc=jjhiblot@traphandler.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).