Messages in this thread | | | Date | Fri, 26 Mar 2021 14:49:39 +0100 | From | Pavel Machek <> | Subject | Re: [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] | |