diff mbox series

[RESEND,v6,(corrected,v2),2/2] leds: ktd2692: Make aux-gpios optional

Message ID 20220504153814.11108-3-markuss.broks@gmail.com
State Superseded
Headers show
Series Make AUX gpio pin optional for ktd2692 | expand

Commit Message

Markuss Broks May 4, 2022, 3:38 p.m. UTC
Make the AUX pin optional, since it isn't a core part of functionality,
and the device is designed to be operational with only one CTRL pin.

Also pick up maintenance for the LED driver and the yaml bindings.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Markuss Broks <markuss.broks@gmail.com>
---
 MAINTAINERS                       | 6 ++++++
 drivers/leds/flash/leds-ktd2692.c | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

Comments

Andy Shevchenko May 4, 2022, 3:51 p.m. UTC | #1
On Wed, May 4, 2022 at 5:38 PM Markuss Broks <markuss.broks@gmail.com> wrote:
>
> Make the AUX pin optional, since it isn't a core part of functionality,
> and the device is designed to be operational with only one CTRL pin.
>
> Also pick up maintenance for the LED driver and the yaml bindings.


The MAINTAINERS update seems like it deserves a separate patch.
But most importantly, you need to add a patch that converts the error
reporting to use dev_err_probe(). Currently code has that issue, i.e.
it will print the error message as many times as probe was deferred
due to unreadiness of GPIO.

Something like this

>                 dev_err(dev, "cannot get aux-gpios %d\n", ret);
>                 return ret;

===>

  return dev_err_probe(dev, ret, "cannot get aux-gpios\n");

with a Fixes tag added.
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 2db49ea7ae55..8ef5667a1d98 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10479,6 +10479,12 @@  S:	Maintained
 F:	Documentation/devicetree/bindings/leds/backlight/kinetic,ktd253.yaml
 F:	drivers/video/backlight/ktd253-backlight.c
 
+KTD2692 FLASH LED DRIVER
+M:	Markuss Broks <markuss.broks@gmail.com>
+S:	Maintained
+F:	Documentation/devicetree/bindings/leds/backlight/kinetic,ktd2692.yaml
+F:	drivers/leds/flash/leds-ktd2692.yaml
+
 KTEST
 M:	Steven Rostedt <rostedt@goodmis.org>
 M:	John Hawley <warthog9@eaglescrag.net>
diff --git a/drivers/leds/flash/leds-ktd2692.c b/drivers/leds/flash/leds-ktd2692.c
index f341da1503a4..01ceea83af67 100644
--- a/drivers/leds/flash/leds-ktd2692.c
+++ b/drivers/leds/flash/leds-ktd2692.c
@@ -284,9 +284,9 @@  static int ktd2692_parse_dt(struct ktd2692_context *led, struct device *dev,
 		return ret;
 	}
 
-	led->aux_gpio = devm_gpiod_get(dev, "aux", GPIOD_ASIS);
-	ret = PTR_ERR_OR_ZERO(led->aux_gpio);
-	if (ret) {
+	led->aux_gpio = devm_gpiod_get_optional(dev, "aux", GPIOD_ASIS);
+	if (IS_ERR(led->aux_gpio)) {
+		ret = PTR_ERR(led->aux_gpio);
 		dev_err(dev, "cannot get aux-gpios %d\n", ret);
 		return ret;
 	}