[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <fafac053-6009-562e-8e29-ee6435a3c8d1@gmail.com>
Date: Fri, 7 Apr 2023 12:56:50 +0300
From: Matti Vaittinen <mazziesaccount@...il.com>
To: Andreas Kemnade <andreas@...nade.info>
Cc: pavel@....cz, lee@...nel.org, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, linux-leds@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
hns@...delico.com
Subject: Re: [PATCH 2/2] leds: bd2606mvv: Driver for the Rohm 6 Channel i2c
LED driver
On 4/6/23 22:45, Andreas Kemnade wrote:
> On Thu, 6 Apr 2023 11:57:15 +0300
> Matti Vaittinen <mazziesaccount@...il.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! ~~
Powered by blists - more mailing lists