[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210326134939.GA11578@duo.ucw.cz>
Date: Fri, 26 Mar 2021 14:49:39 +0100
From: Pavel Machek <pavel@....cz>
To: Hermes Zhang <chenhui.zhang@...s.com>
Cc: dmurphy@...com, robh+dt@...nel.org, linux-leds@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
chenhuiz@...s.com, lkml@...s.com, kernel@...s.com
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@...s.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
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists