Re: [PATCH 2/2] leds: bd2606mvv: Driver for the Rohm 6 Channel i2c LED driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/6/23 22:45, Andreas Kemnade wrote:
On Thu, 6 Apr 2023 11:57:15 +0300
Matti Vaittinen <mazziesaccount@xxxxxxxxx> 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! ~~




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux