video: backlight: ili9320: Make ili9320_remove() return void

Started by Uwe Kleine-König on Oct 19, 2021 · 5 messages from 3 authors · Last reply Oct 20, 2021

Subsystems (3)

Maintainers (5)

Show 1 more
STALE1856d LANDED

Status: Landed in mainline as 3976e974df1f on 2021-10-20.

open the first message on its own page

Message details and related content
Up to now ili9320_remove() returns zero unconditionally. Make it return
void instead which makes it easier to see in the callers that there is
no error to handle.

Also the return value of spi remove callbacks is ignored anyway.

Signed-off-by: Uwe Kleine-König <redacted>
---
 drivers/video/backlight/ili9320.c   | 3 +--
 drivers/video/backlight/ili9320.h   | 2 +-
 drivers/video/backlight/vgg2432a4.c | 4 +++-
 3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/video/backlight/ili9320.c b/drivers/video/backlight/ili9320.c
index 168ac79523d7..2acd2708f8ca 100644
--- a/drivers/video/backlight/ili9320.c
+++ b/drivers/video/backlight/ili9320.c
@@ -251,10 +251,9 @@ int ili9320_probe_spi(struct spi_device *spi,
 }
 EXPORT_SYMBOL_GPL(ili9320_probe_spi);
 
-int ili9320_remove(struct ili9320 *ili)
+void ili9320_remove(struct ili9320 *ili)
 {
 	ili9320_power(ili, FB_BLANK_POWERDOWN);
-	return 0;
 }
 EXPORT_SYMBOL_GPL(ili9320_remove);
 
diff --git a/drivers/video/backlight/ili9320.h b/drivers/video/backlight/ili9320.h
index fc59e389d59a..8213cc6e9184 100644
--- a/drivers/video/backlight/ili9320.h
+++ b/drivers/video/backlight/ili9320.h
@@ -68,7 +68,7 @@ extern int ili9320_write_regs(struct ili9320 *ili,
 extern int ili9320_probe_spi(struct spi_device *spi,
 			     struct ili9320_client *cli);
 
-extern int ili9320_remove(struct ili9320 *lcd);
+extern void ili9320_remove(struct ili9320 *lcd);
 extern void ili9320_shutdown(struct ili9320 *lcd);
 
 /* PM */
diff --git a/drivers/video/backlight/vgg2432a4.c b/drivers/video/backlight/vgg2432a4.c
index 9bf277ca4ae9..3567b45f9ba9 100644
--- a/drivers/video/backlight/vgg2432a4.c
+++ b/drivers/video/backlight/vgg2432a4.c
@@ -235,7 +235,9 @@ static int vgg2432a4_probe(struct spi_device *spi)
 
 static int vgg2432a4_remove(struct spi_device *spi)
 {
-	return ili9320_remove(spi_get_drvdata(spi));
+	ili9320_remove(spi_get_drvdata(spi));
+
+	return 0;
 }
 
 static void vgg2432a4_shutdown(struct spi_device *spi)
-- 
2.30.2
Message details and related content
On Tue, Oct 19, 2021 at 02:09:27PM +0200, Uwe Kleine-König wrote:
Up to now ili9320_remove() returns zero unconditionally. Make it return
void instead which makes it easier to see in the callers that there is
no error to handle.
Ultimately the actions here boil down to an SPI write which could fail
so we could make an attempt to correct the broken error propagation
inside ili9320.c instead...

Also the return value of spi remove callbacks is ignored anyway.
... which does inform the above question.

Is this patch a local fix or part of a larger plan to eventually change
the return value of the spi_remove to void?


Daniel.

quoted hunk
Signed-off-by: Uwe Kleine-König <redacted>
---
 drivers/video/backlight/ili9320.c   | 3 +--
 drivers/video/backlight/ili9320.h   | 2 +-
 drivers/video/backlight/vgg2432a4.c | 4 +++-
 3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/video/backlight/ili9320.c b/drivers/video/backlight/ili9320.c
index 168ac79523d7..2acd2708f8ca 100644
--- a/drivers/video/backlight/ili9320.c
+++ b/drivers/video/backlight/ili9320.c
@@ -251,10 +251,9 @@ int ili9320_probe_spi(struct spi_device *spi,
 }
 EXPORT_SYMBOL_GPL(ili9320_probe_spi);
 
-int ili9320_remove(struct ili9320 *ili)
+void ili9320_remove(struct ili9320 *ili)
 {
 	ili9320_power(ili, FB_BLANK_POWERDOWN);
-	return 0;
 }
 EXPORT_SYMBOL_GPL(ili9320_remove);
 
diff --git a/drivers/video/backlight/ili9320.h b/drivers/video/backlight/ili9320.h
index fc59e389d59a..8213cc6e9184 100644
--- a/drivers/video/backlight/ili9320.h
+++ b/drivers/video/backlight/ili9320.h
@@ -68,7 +68,7 @@ extern int ili9320_write_regs(struct ili9320 *ili,
 extern int ili9320_probe_spi(struct spi_device *spi,
 			     struct ili9320_client *cli);
 
-extern int ili9320_remove(struct ili9320 *lcd);
+extern void ili9320_remove(struct ili9320 *lcd);
 extern void ili9320_shutdown(struct ili9320 *lcd);
 
 /* PM */
diff --git a/drivers/video/backlight/vgg2432a4.c b/drivers/video/backlight/vgg2432a4.c
index 9bf277ca4ae9..3567b45f9ba9 100644
--- a/drivers/video/backlight/vgg2432a4.c

15 more quoted lines

Message details and related content
On Tue, Oct 19, 2021 at 04:30:37PM +0100, Daniel Thompson wrote:
On Tue, Oct 19, 2021 at 02:09:27PM +0200, Uwe Kleine-König wrote:
quoted
Up to now ili9320_remove() returns zero unconditionally. Make it return
void instead which makes it easier to see in the callers that there is
no error to handle.
Ultimately the actions here boil down to an SPI write which could fail
so we could make an attempt to correct the broken error propagation
inside ili9320.c instead...
quoted
Also the return value of spi remove callbacks is ignored anyway.
... which does inform the above question.

Is this patch a local fix or part of a larger plan to eventually change
the return value of the spi_remove to void?
This is the motivation yes, so there isn't any sane way to propagate an
error. The only thing you could sensibly do is to print an error
message. But the device will go away no matter what you do. (Well, you
could do an endless-loop to "delay" removing, but ...)

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
Message details and related content
On Tue, Oct 19, 2021 at 06:36:21PM +0200, Uwe Kleine-König wrote:
On Tue, Oct 19, 2021 at 04:30:37PM +0100, Daniel Thompson wrote:
quoted
On Tue, Oct 19, 2021 at 02:09:27PM +0200, Uwe Kleine-König wrote:
quoted
Up to now ili9320_remove() returns zero unconditionally. Make it return
void instead which makes it easier to see in the callers that there is
no error to handle.
Ultimately the actions here boil down to an SPI write which could fail
so we could make an attempt to correct the broken error propagation
inside ili9320.c instead...
quoted
Also the return value of spi remove callbacks is ignored anyway.
... which does inform the above question.

Is this patch a local fix or part of a larger plan to eventually change
the return value of the spi_remove to void?
This is the motivation yes, so there isn't any sane way to propagate an
error. The only thing you could sensibly do is to print an error
message. But the device will go away no matter what you do. (Well, you
could do an endless-loop to "delay" removing, but ...)
Great. Thanks for confirming... and in that case:

Reviewed-by: Daniel Thompson <redacted>


Daniel.
Message details and related content
On Tue, 19 Oct 2021, Uwe Kleine-König wrote:
Up to now ili9320_remove() returns zero unconditionally. Make it return
void instead which makes it easier to see in the callers that there is
no error to handle.

Also the return value of spi remove callbacks is ignored anyway.

Signed-off-by: Uwe Kleine-König <redacted>
---
 drivers/video/backlight/ili9320.c   | 3 +--
 drivers/video/backlight/ili9320.h   | 2 +-
 drivers/video/backlight/vgg2432a4.c | 4 +++-
 3 files changed, 5 insertions(+), 4 deletions(-)
Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help