From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Christian Mauderer <oss@c-mauderer.de>, Pavel Machek <pavel@ucw.cz>
Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
Dan Murphy <dmurphy@ti.com>, Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH v2 2/2] leds: spi-byte: add single byte SPI LED driver
Date: Mon, 6 May 2019 20:34:14 +0200 [thread overview]
Message-ID: <cf99d1f1-4cb2-4e60-3ce1-d123f28536bc@gmail.com> (raw)
In-Reply-To: <911128ec-1327-5895-d101-97801e9c777a@c-mauderer.de>
Hi Christian,
On 5/6/19 10:48 AM, Christian Mauderer wrote:
> On 05/05/2019 22:12, Pavel Machek wrote:
>> Hi!
>>
>>>> + led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL);
>>>> + if (!led)
>>>> + return -ENOMEM;
>>>> +
>>>> + led->spi = spi;
>>>> + strlcpy(led->name, name, sizeof(led->name));
>>>> + mutex_init(&led->mutex);
>>>> + led->off_value = off_value;
>>>> + led->max_value = max_value;
>>>> + led->ldev.name = led->name;
>>>> + led->ldev.brightness = LED_OFF;
>>>
>>> This line is redundant - already zeroed by kzalloc.
>>
>> Actually I'd prefer to leave it in. Yes, LED_OFF == 0, and will
>> probably stay == 0 in future, but...
>> Pavel
>>
>
> Before I send v4: Currently the initial value isn't written to the LED
> anywhere. The state that is set by U-Boot is just kept till the first
> write to the brightness file.
>
> I didn't implement "default-state" because the OpenWRT user space sets
> the LED anyway a few seconds later (which is still my use case for that
> driver). But now I noted that there is a remark in the documentation of
> the option "default-state" in devicetree/bindings/leds/common.txt: "The
> default is off if this property is not present."
>
> Should I send an initial value to the device during initialization or is
> it OK to just keep the original state?
Yes, I would make use of default-state in this case.
--
Best regards,
Jacek Anaszewski
next prev parent reply other threads:[~2019-05-06 18:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-05 12:52 [PATCH v2 1/2] dt-bindings: leds: Add binding for spi-byte LED oss
2019-05-05 12:52 ` [PATCH v2 2/2] leds: spi-byte: add single byte SPI LED driver oss
2019-05-05 14:48 ` Jacek Anaszewski
2019-05-05 14:55 ` Christian Mauderer
2019-05-05 20:12 ` Pavel Machek
2019-05-06 8:48 ` Christian Mauderer
2019-05-06 18:34 ` Jacek Anaszewski [this message]
2019-05-06 18:19 ` Jacek Anaszewski
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=cf99d1f1-4cb2-4e60-3ce1-d123f28536bc@gmail.com \
--to=jacek.anaszewski@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dmurphy@ti.com \
--cc=linux-leds@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=oss@c-mauderer.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.