From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Andreas Kemnade <andreas@kemnade.info>
Cc: pavel@ucw.cz, lee@kernel.org, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, linux-leds@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
hns@goldelico.com
Subject: Re: [PATCH 2/2] leds: bd2606mvv: Driver for the Rohm 6 Channel i2c LED driver
Date: Fri, 7 Apr 2023 12:56:50 +0300 [thread overview]
Message-ID: <fafac053-6009-562e-8e29-ee6435a3c8d1@gmail.com> (raw)
In-Reply-To: <20230406214539.59dfaac7@aktux>
On 4/6/23 22:45, Andreas Kemnade wrote:
> On Thu, 6 Apr 2023 11:57:15 +0300
> Matti Vaittinen <mazziesaccount@gmail.com> wrote:
>
> [...]
>
>>
>>> + */
>>> +
>>> +#include <linux/i2c.h>
>>> +#include <linux/leds.h>
>>> +#include <linux/module.h>
>>> +#include <linux/of.h>
>>> +#include <linux/of_device.h>
>>> +#include <linux/regmap.h>
>>> +#include <linux/slab.h>
>>> +
>>> +#define BD2606_MAX_LEDS 6
>>> +#define BD2606_MAX_BRIGHTNESS 63
>>> +#define BD2606_REG_PWRCNT 3
>>> +#define ldev_to_led(c) container_of(c, struct bd2606mvv_led, ldev)
>>> +
>>> +struct bd2606mvv_led {
>>> + bool active;
>>
>> I didn't spot where this 'active' was used?
>>
> [..]
>
>>> + if (reg < 0 || reg >= BD2606_MAX_LEDS ||
>>> + priv->leds[reg].active) {
>
> here
>
>>> + of_node_put(child);
>>> + return -EINVAL;
>>> + }
>>> + led = &priv->leds[reg];
>>> +
>>> + led->active = true;
>
> and here
Oh, right. So, if I read this correctly, "active" is only used in the
probe for checking if same 'reg' is given for mone than one LEDs.
If the 'active' is not used after probe then I'd prefer limiting the
life-time to probe. Perhaps drop this from the allocated private data
and just take it from the stack and let it go when probe is done?
This is a minor thing but if there will be other reason(s) to re-spin,
then this might be changed?
Yours,
-- Matti
--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~
prev parent reply other threads:[~2023-04-07 9:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-06 6:08 [PATCH 0/2] leds: Add a driver for the BD2606MVV Andreas Kemnade
2023-04-06 6:08 ` [PATCH 1/2] dt-bindings: leds: ROHM BD2606MVV LED driver Andreas Kemnade
2023-04-06 8:32 ` Matti Vaittinen
2023-04-06 11:33 ` Andreas Kemnade
2023-04-06 12:16 ` Matti Vaittinen
2023-04-06 6:08 ` [PATCH 2/2] leds: bd2606mvv: Driver for the Rohm 6 Channel i2c " Andreas Kemnade
2023-04-06 8:57 ` Matti Vaittinen
2023-04-06 11:43 ` Andreas Kemnade
2023-04-06 12:17 ` Matti Vaittinen
2023-04-06 19:45 ` Andreas Kemnade
2023-04-07 9:56 ` Matti Vaittinen [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=fafac053-6009-562e-8e29-ee6435a3c8d1@gmail.com \
--to=mazziesaccount@gmail.com \
--cc=andreas@kemnade.info \
--cc=devicetree@vger.kernel.org \
--cc=hns@goldelico.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--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