linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13] Make some spi device drivers return zero in .remove()
@ 2021-10-11 13:27 Uwe Kleine-König
  2021-10-11 13:27 ` [PATCH 07/13] mfd: mc13xxx: Make mc13xxx_common_exit() return void Uwe Kleine-König
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2021-10-11 13:27 UTC (permalink / raw)
  To: Alexandre Torgue, Dmitry Torokhov, Greg Kroah-Hartman,
	Guenter Roeck, Jarkko Sakkinen, Jean Delvare, Jiri Slaby,
	Lee Jones, Mauro Carvalho Chehab, Maxime Coquelin,
	Michael Hennerich, Peter Huewe, Thierry Reding,
	Yasunari Takiguchi
  Cc: Mark Brown, Wolfram Sang, Rafael J. Wysocki,
	Jason Gunthorpe linux-integrity @ vger . kernel . org,
	Sam Ravnborg, dri-devel, kernel, linux-hwmon, linux-i2c,
	linux-input, linux-kernel, linux-media, linux-serial, linux-spi,
	linux-staging, linux-stm32

Hello,

this series is part of my new quest to make spi remove callbacks return
void. Today they return an int, but the only result of returning a
non-zero value is a warning message. So it's a bad idea to return an
error code in the expectation that not freeing some resources is ok
then. The same holds true for i2c and platform devices which benefit en
passant for a few drivers.

The patches in this series address some of the spi drivers that might
return non-zero and adapt them accordingly to return zero instead. For
most drivers it's just about not hiding the fact that they already
return zero.

Given that there are quite some more patches of this type to create
before I can change the spi remove callback, I suggest the respecive
subsystem maintainers pick up these patches. There are no
interdependencies in this series.

Uwe Kleine-König (13):
  drm/panel: s6e63m0: Make s6e63m0_remove() return void
  hwmon: adt7x10: Make adt7x10_remove() return void
  hwmon: max31722: Warn about failure to put device in stand-by in
    .remove()
  input: adxl34xx: Make adxl34x_remove() return void
  input: touchscreen: tsc200x: Make tsc200x_remove() return void
  media: cxd2880: Eliminate dead code
  mfd: mc13xxx: Make mc13xxx_common_exit() return void
  mfd: stmpe: Make stmpe_remove() return void
  mfd: tps65912: Make tps65912_device_exit() return void
  serial: max310x: Make max310x_remove() return void
  serial: sc16is7xx: Make sc16is7xx_remove() return void
  staging: fbtft: Make fbtft_remove_common() return void
  tpm: st33zp24: Make st33zp24_remove() return void

 drivers/char/tpm/st33zp24/i2c.c                   |  5 +----
 drivers/char/tpm/st33zp24/spi.c                   |  5 +----
 drivers/char/tpm/st33zp24/st33zp24.c              |  3 +--
 drivers/char/tpm/st33zp24/st33zp24.h              |  2 +-
 drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c |  3 ++-
 drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c |  3 ++-
 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c     |  4 +---
 drivers/gpu/drm/panel/panel-samsung-s6e63m0.h     |  2 +-
 drivers/hwmon/adt7310.c                           |  3 ++-
 drivers/hwmon/adt7410.c                           |  3 ++-
 drivers/hwmon/adt7x10.c                           |  3 +--
 drivers/hwmon/adt7x10.h                           |  2 +-
 drivers/hwmon/max31722.c                          |  8 +++++++-
 drivers/input/misc/adxl34x-i2c.c                  |  4 +++-
 drivers/input/misc/adxl34x-spi.c                  |  4 +++-
 drivers/input/misc/adxl34x.c                      |  4 +---
 drivers/input/misc/adxl34x.h                      |  2 +-
 drivers/input/touchscreen/tsc2004.c               |  4 +++-
 drivers/input/touchscreen/tsc2005.c               |  4 +++-
 drivers/input/touchscreen/tsc200x-core.c          |  4 +---
 drivers/input/touchscreen/tsc200x-core.h          |  2 +-
 drivers/media/spi/cxd2880-spi.c                   | 13 +------------
 drivers/mfd/mc13xxx-core.c                        |  4 +---
 drivers/mfd/mc13xxx-i2c.c                         |  3 ++-
 drivers/mfd/mc13xxx-spi.c                         |  3 ++-
 drivers/mfd/mc13xxx.h                             |  2 +-
 drivers/mfd/stmpe-i2c.c                           |  4 +++-
 drivers/mfd/stmpe-spi.c                           |  4 +++-
 drivers/mfd/stmpe.c                               |  4 +---
 drivers/mfd/stmpe.h                               |  2 +-
 drivers/mfd/tps65912-core.c                       |  4 +---
 drivers/mfd/tps65912-i2c.c                        |  4 +++-
 drivers/mfd/tps65912-spi.c                        |  4 +++-
 drivers/staging/fbtft/fbtft-core.c                |  8 +-------
 drivers/staging/fbtft/fbtft.h                     |  6 ++++--
 drivers/tty/serial/max310x.c                      |  7 +++----
 drivers/tty/serial/sc16is7xx.c                    | 10 +++++++---
 include/linux/mfd/tps65912.h                      |  2 +-
 38 files changed, 77 insertions(+), 81 deletions(-)


base-commit: 9e1ff307c779ce1f0f810c7ecce3d95bbae40896
-- 
2.30.2


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

* [PATCH 07/13] mfd: mc13xxx: Make mc13xxx_common_exit() return void
  2021-10-11 13:27 [PATCH 00/13] Make some spi device drivers return zero in .remove() Uwe Kleine-König
@ 2021-10-11 13:27 ` Uwe Kleine-König
  2021-10-11 13:27 ` [PATCH 08/13] mfd: stmpe: Make stmpe_remove() " Uwe Kleine-König
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2021-10-11 13:27 UTC (permalink / raw)
  To: Lee Jones
  Cc: Mark Brown, linux-spi, kernel, linux-kernel, Wolfram Sang, linux-i2c

Up to now mc13xxx_common_exit() 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 i2c and spi remove callbacks is ignored anyway.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/mfd/mc13xxx-core.c | 4 +---
 drivers/mfd/mc13xxx-i2c.c  | 3 ++-
 drivers/mfd/mc13xxx-spi.c  | 3 ++-
 drivers/mfd/mc13xxx.h      | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 1abe7432aad8..8a4f1d90dcfd 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -496,15 +496,13 @@ int mc13xxx_common_init(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(mc13xxx_common_init);
 
-int mc13xxx_common_exit(struct device *dev)
+void mc13xxx_common_exit(struct device *dev)
 {
 	struct mc13xxx *mc13xxx = dev_get_drvdata(dev);
 
 	mfd_remove_devices(dev);
 	regmap_del_irq_chip(mc13xxx->irq, mc13xxx->irq_data);
 	mutex_destroy(&mc13xxx->lock);
-
-	return 0;
 }
 EXPORT_SYMBOL_GPL(mc13xxx_common_exit);
 
diff --git a/drivers/mfd/mc13xxx-i2c.c b/drivers/mfd/mc13xxx-i2c.c
index 65b4dd8e5afb..fb937f66277e 100644
--- a/drivers/mfd/mc13xxx-i2c.c
+++ b/drivers/mfd/mc13xxx-i2c.c
@@ -87,7 +87,8 @@ static int mc13xxx_i2c_probe(struct i2c_client *client,
 
 static int mc13xxx_i2c_remove(struct i2c_client *client)
 {
-	return mc13xxx_common_exit(&client->dev);
+	mc13xxx_common_exit(&client->dev);
+	return 0;
 }
 
 static struct i2c_driver mc13xxx_i2c_driver = {
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 286ddcf5ddc6..f60227723b4a 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -168,7 +168,8 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
 
 static int mc13xxx_spi_remove(struct spi_device *spi)
 {
-	return mc13xxx_common_exit(&spi->dev);
+	mc13xxx_common_exit(&spi->dev);
+	return 0
 }
 
 static struct spi_driver mc13xxx_spi_driver = {
diff --git a/drivers/mfd/mc13xxx.h b/drivers/mfd/mc13xxx.h
index ce6eec52e8eb..bd5ba9a0e14f 100644
--- a/drivers/mfd/mc13xxx.h
+++ b/drivers/mfd/mc13xxx.h
@@ -44,6 +44,6 @@ struct mc13xxx {
 };
 
 int mc13xxx_common_init(struct device *dev);
-int mc13xxx_common_exit(struct device *dev);
+void mc13xxx_common_exit(struct device *dev);
 
 #endif /* __DRIVERS_MFD_MC13XXX_H */
-- 
2.30.2


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

* [PATCH 08/13] mfd: stmpe: Make stmpe_remove() return void
  2021-10-11 13:27 [PATCH 00/13] Make some spi device drivers return zero in .remove() Uwe Kleine-König
  2021-10-11 13:27 ` [PATCH 07/13] mfd: mc13xxx: Make mc13xxx_common_exit() return void Uwe Kleine-König
@ 2021-10-11 13:27 ` Uwe Kleine-König
  2021-10-11 13:27 ` [PATCH 09/13] mfd: tps65912: Make tps65912_device_exit() " Uwe Kleine-König
  2021-10-11 20:42 ` [PATCH 00/13] Make some spi device drivers return zero in .remove() Uwe Kleine-König
  3 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2021-10-11 13:27 UTC (permalink / raw)
  To: Lee Jones, Maxime Coquelin, Alexandre Torgue
  Cc: Mark Brown, linux-spi, kernel, linux-stm32, linux-kernel,
	Wolfram Sang, linux-i2c

Up to now stmpe_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 i2c and spi remove callbacks is ignored anyway.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/mfd/stmpe-i2c.c | 4 +++-
 drivers/mfd/stmpe-spi.c | 4 +++-
 drivers/mfd/stmpe.c     | 4 +---
 drivers/mfd/stmpe.h     | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/stmpe-i2c.c b/drivers/mfd/stmpe-i2c.c
index cd2f45257dc1..d3eedf3d607e 100644
--- a/drivers/mfd/stmpe-i2c.c
+++ b/drivers/mfd/stmpe-i2c.c
@@ -95,7 +95,9 @@ static int stmpe_i2c_remove(struct i2c_client *i2c)
 {
 	struct stmpe *stmpe = dev_get_drvdata(&i2c->dev);
 
-	return stmpe_remove(stmpe);
+	stmpe_remove(stmpe);
+
+	return 0;
 }
 
 static const struct i2c_device_id stmpe_i2c_id[] = {
diff --git a/drivers/mfd/stmpe-spi.c b/drivers/mfd/stmpe-spi.c
index 7351734f7593..6c5915016be5 100644
--- a/drivers/mfd/stmpe-spi.c
+++ b/drivers/mfd/stmpe-spi.c
@@ -106,7 +106,9 @@ static int stmpe_spi_remove(struct spi_device *spi)
 {
 	struct stmpe *stmpe = spi_get_drvdata(spi);
 
-	return stmpe_remove(stmpe);
+	stmpe_remove(stmpe);
+
+	return 0;
 }
 
 static const struct of_device_id stmpe_spi_of_match[] = {
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
index 58d09c615e67..e928df95e316 100644
--- a/drivers/mfd/stmpe.c
+++ b/drivers/mfd/stmpe.c
@@ -1496,7 +1496,7 @@ int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum)
 	return ret;
 }
 
-int stmpe_remove(struct stmpe *stmpe)
+void stmpe_remove(struct stmpe *stmpe)
 {
 	if (!IS_ERR(stmpe->vio))
 		regulator_disable(stmpe->vio);
@@ -1506,8 +1506,6 @@ int stmpe_remove(struct stmpe *stmpe)
 	__stmpe_disable(stmpe, STMPE_BLOCK_ADC);
 
 	mfd_remove_devices(stmpe->dev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM
diff --git a/drivers/mfd/stmpe.h b/drivers/mfd/stmpe.h
index 83491e99ba3c..1b4f91d03bbf 100644
--- a/drivers/mfd/stmpe.h
+++ b/drivers/mfd/stmpe.h
@@ -98,7 +98,7 @@ struct stmpe_client_info {
 };
 
 int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum);
-int stmpe_remove(struct stmpe *stmpe);
+void stmpe_remove(struct stmpe *stmpe);
 
 #define STMPE_ICR_LSB_HIGH	(1 << 2)
 #define STMPE_ICR_LSB_EDGE	(1 << 1)
-- 
2.30.2


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

* [PATCH 09/13] mfd: tps65912: Make tps65912_device_exit() return void
  2021-10-11 13:27 [PATCH 00/13] Make some spi device drivers return zero in .remove() Uwe Kleine-König
  2021-10-11 13:27 ` [PATCH 07/13] mfd: mc13xxx: Make mc13xxx_common_exit() return void Uwe Kleine-König
  2021-10-11 13:27 ` [PATCH 08/13] mfd: stmpe: Make stmpe_remove() " Uwe Kleine-König
@ 2021-10-11 13:27 ` Uwe Kleine-König
  2021-10-11 20:42 ` [PATCH 00/13] Make some spi device drivers return zero in .remove() Uwe Kleine-König
  3 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2021-10-11 13:27 UTC (permalink / raw)
  To: Lee Jones
  Cc: Mark Brown, linux-spi, kernel, linux-kernel, Wolfram Sang, linux-i2c

Up to now tps65912_device_exit() 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 i2c and spi remove callbacks is ignored anyway.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/mfd/tps65912-core.c  | 4 +---
 drivers/mfd/tps65912-i2c.c   | 4 +++-
 drivers/mfd/tps65912-spi.c   | 4 +++-
 include/linux/mfd/tps65912.h | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/tps65912-core.c b/drivers/mfd/tps65912-core.c
index b55b1d5d6955..c282a05e7146 100644
--- a/drivers/mfd/tps65912-core.c
+++ b/drivers/mfd/tps65912-core.c
@@ -115,11 +115,9 @@ int tps65912_device_init(struct tps65912 *tps)
 }
 EXPORT_SYMBOL_GPL(tps65912_device_init);
 
-int tps65912_device_exit(struct tps65912 *tps)
+void tps65912_device_exit(struct tps65912 *tps)
 {
 	regmap_del_irq_chip(tps->irq, tps->irq_data);
-
-	return 0;
 }
 EXPORT_SYMBOL_GPL(tps65912_device_exit);
 
diff --git a/drivers/mfd/tps65912-i2c.c b/drivers/mfd/tps65912-i2c.c
index f7c22ea7b36c..06eb2784d322 100644
--- a/drivers/mfd/tps65912-i2c.c
+++ b/drivers/mfd/tps65912-i2c.c
@@ -55,7 +55,9 @@ static int tps65912_i2c_remove(struct i2c_client *client)
 {
 	struct tps65912 *tps = i2c_get_clientdata(client);
 
-	return tps65912_device_exit(tps);
+	tps65912_device_exit(tps);
+
+	return 0;
 }
 
 static const struct i2c_device_id tps65912_i2c_id_table[] = {
diff --git a/drivers/mfd/tps65912-spi.c b/drivers/mfd/tps65912-spi.c
index 21a8d6ac5c4a..d701926aa46e 100644
--- a/drivers/mfd/tps65912-spi.c
+++ b/drivers/mfd/tps65912-spi.c
@@ -54,7 +54,9 @@ static int tps65912_spi_remove(struct spi_device *spi)
 {
 	struct tps65912 *tps = spi_get_drvdata(spi);
 
-	return tps65912_device_exit(tps);
+	tps65912_device_exit(tps);
+
+	return 0;
 }
 
 static const struct spi_device_id tps65912_spi_id_table[] = {
diff --git a/include/linux/mfd/tps65912.h b/include/linux/mfd/tps65912.h
index 7943e413deae..8a61386cb8c1 100644
--- a/include/linux/mfd/tps65912.h
+++ b/include/linux/mfd/tps65912.h
@@ -322,6 +322,6 @@ struct tps65912 {
 extern const struct regmap_config tps65912_regmap_config;
 
 int tps65912_device_init(struct tps65912 *tps);
-int tps65912_device_exit(struct tps65912 *tps);
+void tps65912_device_exit(struct tps65912 *tps);
 
 #endif /*  __LINUX_MFD_TPS65912_H */
-- 
2.30.2


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

* Re: [PATCH 00/13] Make some spi device drivers return zero in .remove()
  2021-10-11 13:27 [PATCH 00/13] Make some spi device drivers return zero in .remove() Uwe Kleine-König
                   ` (2 preceding siblings ...)
  2021-10-11 13:27 ` [PATCH 09/13] mfd: tps65912: Make tps65912_device_exit() " Uwe Kleine-König
@ 2021-10-11 20:42 ` Uwe Kleine-König
  3 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2021-10-11 20:42 UTC (permalink / raw)
  To: Alexandre Torgue, Dmitry Torokhov, Greg Kroah-Hartman,
	Guenter Roeck, Jarkko Sakkinen, Jean Delvare, Jiri Slaby,
	Lee Jones, Mauro Carvalho Chehab, Maxime Coquelin,
	Michael Hennerich, Peter Huewe, Thierry Reding,
	Yasunari Takiguchi
  Cc: linux-hwmon, linux-serial, Rafael J. Wysocki, linux-staging,
	linux-kernel, dri-devel, linux-spi, Wolfram Sang,
	Jason Gunthorpe linux-integrity @ vger . kernel . org,
	Mark Brown, linux-i2c, kernel, linux-input, Sam Ravnborg,
	linux-stm32, linux-media

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

Hello,

On Mon, Oct 11, 2021 at 03:27:41PM +0200, Uwe Kleine-König wrote:
> this series is part of my new quest to make spi remove callbacks return
> void. Today they return an int, but the only result of returning a
> non-zero value is a warning message. So it's a bad idea to return an
> error code in the expectation that not freeing some resources is ok
> then. The same holds true for i2c and platform devices which benefit en
> passant for a few drivers.
> 
> The patches in this series address some of the spi drivers that might
> return non-zero and adapt them accordingly to return zero instead. For
> most drivers it's just about not hiding the fact that they already
> return zero.
> 
> Given that there are quite some more patches of this type to create
> before I can change the spi remove callback, I suggest the respecive
> subsystem maintainers pick up these patches. There are no
> interdependencies in this series.
> 
> Uwe Kleine-König (13):
>   drm/panel: s6e63m0: Make s6e63m0_remove() return void
>   hwmon: adt7x10: Make adt7x10_remove() return void
>   hwmon: max31722: Warn about failure to put device in stand-by in
>     .remove()
>   input: adxl34xx: Make adxl34x_remove() return void
>   input: touchscreen: tsc200x: Make tsc200x_remove() return void
>   media: cxd2880: Eliminate dead code
>   mfd: mc13xxx: Make mc13xxx_common_exit() return void
>   mfd: stmpe: Make stmpe_remove() return void
>   mfd: tps65912: Make tps65912_device_exit() return void
>   serial: max310x: Make max310x_remove() return void
>   serial: sc16is7xx: Make sc16is7xx_remove() return void
>   staging: fbtft: Make fbtft_remove_common() return void
>   tpm: st33zp24: Make st33zp24_remove() return void

I thought I would be a good enough programmer to not need build tests.
Obviously I was wrong and introduced build problems with the following
patches:

	input: touchscreen: tsc200x: Make tsc200x_remove() return void
	mfd: mc13xxx: Make mc13xxx_common_exit() return void
	serial: max310x: Make max310x_remove() return void
	serial: sc16is7xx: Make sc16is7xx_remove() return void

Please don't apply these (unless you also fix the trivial problems in
them). I will prepare a v2 soon.

Best regards and sorry for the inconvenience,
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] 5+ messages in thread

end of thread, other threads:[~2021-10-11 20:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-11 13:27 [PATCH 00/13] Make some spi device drivers return zero in .remove() Uwe Kleine-König
2021-10-11 13:27 ` [PATCH 07/13] mfd: mc13xxx: Make mc13xxx_common_exit() return void Uwe Kleine-König
2021-10-11 13:27 ` [PATCH 08/13] mfd: stmpe: Make stmpe_remove() " Uwe Kleine-König
2021-10-11 13:27 ` [PATCH 09/13] mfd: tps65912: Make tps65912_device_exit() " Uwe Kleine-König
2021-10-11 20:42 ` [PATCH 00/13] Make some spi device drivers return zero in .remove() Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).