All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] leds: lm3692x: Return 0 from remove callback
@ 2022-02-06 22:08 Uwe Kleine-König
  2022-02-07 15:23 ` Andy Shevchenko
  2022-02-12 12:03 ` Pavel Machek
  0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2022-02-06 22:08 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-leds, kernel

The only difference between returning zero or a non-zero value is that
for the non-zero case the i2c will print a generic error message
("remove failed (-ESOMETHING), will be ignored").

In this case however the driver itself already emitted a more helpful
error message, so the additional error message isn't helpful at all.

The long-term goal is to make the i2c remove callback return void, making
all implementations return 0 is preparatory work for this change.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/leds/leds-lm3692x.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c
index afe6fb297855..87cd24ce3f95 100644
--- a/drivers/leds/leds-lm3692x.c
+++ b/drivers/leds/leds-lm3692x.c
@@ -494,11 +494,8 @@ static int lm3692x_probe(struct i2c_client *client,
 static int lm3692x_remove(struct i2c_client *client)
 {
 	struct lm3692x_led *led = i2c_get_clientdata(client);
-	int ret;
 
-	ret = lm3692x_leds_disable(led);
-	if (ret)
-		return ret;
+	lm3692x_leds_disable(led);
 	mutex_destroy(&led->lock);
 
 	return 0;

base-commit: dcb85f85fa6f142aae1fe86f399d4503d49f2b60
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] leds: lm3692x: Return 0 from remove callback
  2022-02-06 22:08 [PATCH] leds: lm3692x: Return 0 from remove callback Uwe Kleine-König
@ 2022-02-07 15:23 ` Andy Shevchenko
  2022-02-08  8:45   ` Uwe Kleine-König
  2022-02-12 12:03 ` Pavel Machek
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2022-02-07 15:23 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Pavel Machek, Linux LED Subsystem, Sascha Hauer

On Mon, Feb 7, 2022 at 5:08 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> The only difference between returning zero or a non-zero value is that
> for the non-zero case the i2c will print a generic error message
> ("remove failed (-ESOMETHING), will be ignored").
>
> In this case however the driver itself already emitted a more helpful
> error message, so the additional error message isn't helpful at all.
>
> The long-term goal is to make the i2c remove callback return void, making
> all implementations return 0 is preparatory work for this change.

...

> +       lm3692x_leds_disable(led);

Since it emits a message, perhaps converting it to void also can be
done here. Otherwise what's the point to have it int?

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] leds: lm3692x: Return 0 from remove callback
  2022-02-07 15:23 ` Andy Shevchenko
@ 2022-02-08  8:45   ` Uwe Kleine-König
  0 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2022-02-08  8:45 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Sascha Hauer, Linux LED Subsystem, Pavel Machek

[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]

On Mon, Feb 07, 2022 at 05:23:40PM +0200, Andy Shevchenko wrote:
> On Mon, Feb 7, 2022 at 5:08 PM Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de> wrote:
> >
> > The only difference between returning zero or a non-zero value is that
> > for the non-zero case the i2c will print a generic error message
> > ("remove failed (-ESOMETHING), will be ignored").
> >
> > In this case however the driver itself already emitted a more helpful
> > error message, so the additional error message isn't helpful at all.
> >
> > The long-term goal is to make the i2c remove callback return void, making
> > all implementations return 0 is preparatory work for this change.
> 
> ...
> 
> > +       lm3692x_leds_disable(led);
> 
> Since it emits a message, perhaps converting it to void also can be
> done here. Otherwise what's the point to have it int?

There is another caller (lm3692x_leds_disable) where the return value is
used. So I didn't convert it to return void.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] leds: lm3692x: Return 0 from remove callback
  2022-02-06 22:08 [PATCH] leds: lm3692x: Return 0 from remove callback Uwe Kleine-König
  2022-02-07 15:23 ` Andy Shevchenko
@ 2022-02-12 12:03 ` Pavel Machek
  1 sibling, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2022-02-12 12:03 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: linux-leds, kernel

[-- Attachment #1: Type: text/plain, Size: 594 bytes --]

Hi!

> The only difference between returning zero or a non-zero value is that
> for the non-zero case the i2c will print a generic error message
> ("remove failed (-ESOMETHING), will be ignored").
> 
> In this case however the driver itself already emitted a more helpful
> error message, so the additional error message isn't helpful at all.
> 
> The long-term goal is to make the i2c remove callback return void, making
> all implementations return 0 is preparatory work for this change.

Thanks, applied.
									Pavel
									
-- 
http://www.livejournal.com/~pavelmachek

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-12 12:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-06 22:08 [PATCH] leds: lm3692x: Return 0 from remove callback Uwe Kleine-König
2022-02-07 15:23 ` Andy Shevchenko
2022-02-08  8:45   ` Uwe Kleine-König
2022-02-12 12:03 ` Pavel Machek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.