lkml.org 
[lkml]   [2021]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/2] leds: leds-multi-gpio: Add multiple GPIOs LED driver
Hi!

> Introduce a new multiple GPIOs LED driver. This LED will made of
> multiple GPIOs (up to 8) and will map different brightness to different
> GPIOs states which defined in dts file.
>
> Signed-off-by: Hermes Zhang <chenhuiz@axis.com>


> index 000000000000..7aef82701f86
> --- /dev/null
> +++ b/drivers/leds/simple/Kconfig
> @@ -0,0 +1,23 @@
> +menuconfig LEDS_SIMPLE
> + bool "Simple LED support"
> + depends on LEDS_CLASS
> + help
> + This option enables simple leds support for the leds class.
> + If unsure, say Y.

No need for new config symbol.

> + if (ret != 1 << gpios->ndescs) {

I'd do (ret != (1 << gpios->ndescs))

> + priv = devm_kzalloc(dev, sizeof(struct multi_gpio_led_priv)
> + + sizeof(u8) * nr_states , GFP_KERNEL);

Sizeof(u8) is always 1, no need for space before , .

> + of_property_read_string(node, "default-state", &state);
> + if (!strcmp(state, "on"))
> + multi_gpio_led_set(&priv->cdev, priv->cdev.max_brightness);
> + else
> + multi_gpio_led_set(&priv->cdev, 0);

No need for default-state handling, unless you are using it.

Best regards,
Pavel

--
http://www.livejournal.com/~pavelmachek
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2021-03-26 14:51    [W:0.067 / U:0.640 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site