chrome-platform.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/27] platform: Convert to platform remove callback returning void
@ 2023-09-27  8:10 Uwe Kleine-König
  2023-09-27  8:10 ` [PATCH 01/27] platform/chrome: cros_ec_chardev: " Uwe Kleine-König
                   ` (15 more replies)
  0 siblings, 16 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2023-09-27  8:10 UTC (permalink / raw
  To: Benson Leung, Tzung-Bi Shih, Prashant Malani, Guenter Roeck,
	Brian Norris, Zhengkang Huang, Dongliang Mu, Greg Kroah-Hartman,
	Hans de Goede, Ilpo Järvinen, Mark Gross, Vadim Pasternak,
	Gerd Haeussler, Xing Tong Wu, Tobias Schaffner
  Cc: chrome-platform, linux-kernel, platform-driver-x86, kernel

Hello,

this series converts all platform drivers below drivers/platform to use
.remove_new(). The motivation is to get rid of an integer return code
that is (mostly) ignored by the platform driver core and error prone on
the driver side.

See commit 5c5a7680e67b ("platform: Provide a remove callback that
returns no value") for an extended explanation and the eventual goal.

As there is no single maintainer team for drivers/platform, I suggest
the individual maintainers to pick up "their" patches. The only
inter-dependency in this series is that the patches #24 - #27 depend on
#23. Otherwise there are no inter-dependencies, so that should work
fine. As there are still quite a few drivers to convert in other areas
than drivers/platform, I'm happy about every patch that makes it in and
there is no need for further coordination. So even if there is a merge
conflict with one patch until you apply or a subject prefix is
suboptimal, please don't let you stop by negative feedback for other
patches (unless it applies to "your" patches, too, of course).

Best regards and thanks for considering,
Uwe

Uwe Kleine-König (27):
  platform/chrome: cros_ec_chardev: Convert to platform remove callback
    returning void
  platform/chrome: cros_ec_debugfs: Convert to platform remove callback
    returning void
  platform/chrome: cros_ec_lightbar: Convert to platform remove callback
    returning void
  platform/chrome: cros_ec_lpc: Convert to platform remove callback
    returning void
  platform/chrome: cros_ec_sysfs: Convert to platform remove callback
    returning void
  platform/chrome: cros_ec_vbc: Convert to platform remove callback
    returning void
  platform/chrome: cros_typec_switch: Convert to platform remove
    callback returning void
  platform/chrome: cros_usbpd_logger: Convert to platform remove
    callback returning void
  platform/chrome: cros_usbpd_notify: Convert to platform remove
    callback returning void
  platform/chrome/wilco_ec: core: Convert to platform remove callback
    returning void
  platform/chrome/wilco_ec: debugfs: Convert to platform remove callback
    returning void
  platform/chrome/wilco_ec: telemetry: Convert to platform remove
    callback returning void
  platform/goldfish: goldfish_pipe: Convert to platform remove callback
    returning void
  platform/mellanox: mlxbf-bootctl: Convert to platform remove callback
    returning void
  platform/mellanox: mlxbf-tmfifo: Convert to platform remove callback
    returning void
  platform/mellanox: mlxreg-hotplug: Convert to platform remove callback
    returning void
  platform/mellanox: mlxreg-io: Convert to platform remove callback
    returning void
  platform/mellanox: mlxreg-lc: Convert to platform remove callback
    returning void
  platform/mellanox: nvsw-sn2201: Convert to platform remove callback
    returning void
  platform/x86/intel: bytcrc_pwrsrc: Convert to platform remove callback
    returning void
  platform/x86: mlx-platform: Convert to platform remove callback
    returning void
  platform/x86: sel3350-platform: Convert to platform remove callback
    returning void
  platform/x86/siemens: simatic-ipc-batt: Simplify
    simatic_ipc_batt_remove()
  platform/x86/siemens: simatic-ipc-batt: Convert to platform remove
    callback returning void
  platform/x86/siemens: simatic-ipc-batt-apollolake: Convert to platform
    remove callback returning void
  platform/x86/siemens: simatic-ipc-batt-elkhartlake: Convert to
    platform remove callback returning void
  platform/x86/siemens: simatic-ipc-batt-f7188x: Convert to platform
    remove callback returning void

 drivers/platform/chrome/cros_ec_chardev.c            |  6 ++----
 drivers/platform/chrome/cros_ec_debugfs.c            |  6 ++----
 drivers/platform/chrome/cros_ec_lightbar.c           |  6 ++----
 drivers/platform/chrome/cros_ec_lpc.c                |  6 ++----
 drivers/platform/chrome/cros_ec_sysfs.c              |  6 ++----
 drivers/platform/chrome/cros_ec_vbc.c                |  6 ++----
 drivers/platform/chrome/cros_typec_switch.c          |  5 ++---
 drivers/platform/chrome/cros_usbpd_logger.c          |  6 ++----
 drivers/platform/chrome/cros_usbpd_notify.c          | 12 ++++--------
 drivers/platform/chrome/wilco_ec/core.c              |  5 ++---
 drivers/platform/chrome/wilco_ec/debugfs.c           |  6 ++----
 drivers/platform/chrome/wilco_ec/telemetry.c         |  6 ++----
 drivers/platform/goldfish/goldfish_pipe.c            |  5 ++---
 drivers/platform/mellanox/mlxbf-bootctl.c            |  6 ++----
 drivers/platform/mellanox/mlxbf-tmfifo.c             |  6 ++----
 drivers/platform/mellanox/mlxreg-hotplug.c           |  6 ++----
 drivers/platform/mellanox/mlxreg-io.c                |  6 ++----
 drivers/platform/mellanox/mlxreg-lc.c                |  8 +++-----
 drivers/platform/mellanox/nvsw-sn2201.c              |  6 ++----
 drivers/platform/x86/intel/bytcrc_pwrsrc.c           |  5 ++---
 drivers/platform/x86/mlx-platform.c                  |  5 ++---
 drivers/platform/x86/sel3350-platform.c              |  6 ++----
 .../x86/siemens/simatic-ipc-batt-apollolake.c        |  6 +++---
 .../x86/siemens/simatic-ipc-batt-elkhartlake.c       |  6 +++---
 .../platform/x86/siemens/simatic-ipc-batt-f7188x.c   |  6 +++---
 drivers/platform/x86/siemens/simatic-ipc-batt.c      |  9 ++++-----
 drivers/platform/x86/siemens/simatic-ipc-batt.h      |  4 ++--
 27 files changed, 62 insertions(+), 104 deletions(-)

base-commit: 18030226a48de1fbfabf4ae16aaa2695a484254f
-- 
2.40.1


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

* [PATCH 01/27] platform/chrome: cros_ec_chardev: Convert to platform remove callback returning void
  2023-09-27  8:10 [PATCH 00/27] platform: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-09-27  8:10 ` Uwe Kleine-König
  2023-09-27  8:10 ` [PATCH 02/27] platform/chrome: cros_ec_debugfs: " Uwe Kleine-König
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2023-09-27  8:10 UTC (permalink / raw
  To: Benson Leung, Tzung-Bi Shih
  Cc: Guenter Roeck, chrome-platform, linux-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/platform/chrome/cros_ec_chardev.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_chardev.c b/drivers/platform/chrome/cros_ec_chardev.c
index d6de5a294128..81950bb2c6da 100644
--- a/drivers/platform/chrome/cros_ec_chardev.c
+++ b/drivers/platform/chrome/cros_ec_chardev.c
@@ -396,13 +396,11 @@ static int cros_ec_chardev_probe(struct platform_device *pdev)
 	return misc_register(&data->misc);
 }
 
-static int cros_ec_chardev_remove(struct platform_device *pdev)
+static void cros_ec_chardev_remove(struct platform_device *pdev)
 {
 	struct chardev_data *data = dev_get_drvdata(&pdev->dev);
 
 	misc_deregister(&data->misc);
-
-	return 0;
 }
 
 static struct platform_driver cros_ec_chardev_driver = {
@@ -410,7 +408,7 @@ static struct platform_driver cros_ec_chardev_driver = {
 		.name = DRV_NAME,
 	},
 	.probe = cros_ec_chardev_probe,
-	.remove = cros_ec_chardev_remove,
+	.remove_new = cros_ec_chardev_remove,
 };
 
 module_platform_driver(cros_ec_chardev_driver);
-- 
2.40.1


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

* [PATCH 02/27] platform/chrome: cros_ec_debugfs: Convert to platform remove callback returning void
  2023-09-27  8:10 [PATCH 00/27] platform: Convert to platform remove callback returning void Uwe Kleine-König
  2023-09-27  8:10 ` [PATCH 01/27] platform/chrome: cros_ec_chardev: " Uwe Kleine-König
@ 2023-09-27  8:10 ` Uwe Kleine-König
  2023-09-27  8:10 ` [PATCH 03/27] platform/chrome: cros_ec_lightbar: " Uwe Kleine-König
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2023-09-27  8:10 UTC (permalink / raw
  To: Benson Leung, Tzung-Bi Shih
  Cc: Guenter Roeck, chrome-platform, linux-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/platform/chrome/cros_ec_debugfs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c
index c876120e0ebc..091fdc154d79 100644
--- a/drivers/platform/chrome/cros_ec_debugfs.c
+++ b/drivers/platform/chrome/cros_ec_debugfs.c
@@ -533,14 +533,12 @@ static int cros_ec_debugfs_probe(struct platform_device *pd)
 	return ret;
 }
 
-static int cros_ec_debugfs_remove(struct platform_device *pd)
+static void cros_ec_debugfs_remove(struct platform_device *pd)
 {
 	struct cros_ec_dev *ec = dev_get_drvdata(pd->dev.parent);
 
 	debugfs_remove_recursive(ec->debug_info->dir);
 	cros_ec_cleanup_console_log(ec->debug_info);
-
-	return 0;
 }
 
 static int __maybe_unused cros_ec_debugfs_suspend(struct device *dev)
@@ -573,7 +571,7 @@ static struct platform_driver cros_ec_debugfs_driver = {
 		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 	},
 	.probe = cros_ec_debugfs_probe,
-	.remove = cros_ec_debugfs_remove,
+	.remove_new = cros_ec_debugfs_remove,
 };
 
 module_platform_driver(cros_ec_debugfs_driver);
-- 
2.40.1


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

* [PATCH 03/27] platform/chrome: cros_ec_lightbar: Convert to platform remove callback returning void
  2023-09-27  8:10 [PATCH 00/27] platform: Convert to platform remove callback returning void Uwe Kleine-König
  2023-09-27  8:10 ` [PATCH 01/27] platform/chrome: cros_ec_chardev: " Uwe Kleine-König
  2023-09-27  8:10 ` [PATCH 02/27] platform/chrome: cros_ec_debugfs: " Uwe Kleine-König
@ 2023-09-27  8:10 ` Uwe Kleine-König
  2023-09-27  8:10 ` [PATCH 04/27] platform/chrome: cros_ec_lpc: " Uwe Kleine-König
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2023-09-27  8:10 UTC (permalink / raw
  To: Benson Leung, Tzung-Bi Shih
  Cc: Guenter Roeck, chrome-platform, linux-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/platform/chrome/cros_ec_lightbar.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c
index 376425bbd8ff..6677cc6c4984 100644
--- a/drivers/platform/chrome/cros_ec_lightbar.c
+++ b/drivers/platform/chrome/cros_ec_lightbar.c
@@ -560,7 +560,7 @@ static int cros_ec_lightbar_probe(struct platform_device *pd)
 	return ret;
 }
 
-static int cros_ec_lightbar_remove(struct platform_device *pd)
+static void cros_ec_lightbar_remove(struct platform_device *pd)
 {
 	struct cros_ec_dev *ec_dev = dev_get_drvdata(pd->dev.parent);
 
@@ -569,8 +569,6 @@ static int cros_ec_lightbar_remove(struct platform_device *pd)
 
 	/* Let the EC take over the lightbar again. */
 	lb_manual_suspend_ctrl(ec_dev, 0);
-
-	return 0;
 }
 
 static int __maybe_unused cros_ec_lightbar_resume(struct device *dev)
@@ -603,7 +601,7 @@ static struct platform_driver cros_ec_lightbar_driver = {
 		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 	},
 	.probe = cros_ec_lightbar_probe,
-	.remove = cros_ec_lightbar_remove,
+	.remove_new = cros_ec_lightbar_remove,
 };
 
 module_platform_driver(cros_ec_lightbar_driver);
-- 
2.40.1


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

* [PATCH 04/27] platform/chrome: cros_ec_lpc: Convert to platform remove callback returning void
  2023-09-27  8:10 [PATCH 00/27] platform: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (2 preceding siblings ...)
  2023-09-27  8:10 ` [PATCH 03/27] platform/chrome: cros_ec_lightbar: " Uwe Kleine-König
@ 2023-09-27  8:10 ` Uwe Kleine-König
  2023-09-27  8:10 ` [PATCH 05/27] platform/chrome: cros_ec_sysfs: " Uwe Kleine-König
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2023-09-27  8:10 UTC (permalink / raw
  To: Benson Leung, Tzung-Bi Shih
  Cc: Guenter Roeck, chrome-platform, linux-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/platform/chrome/cros_ec_lpc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c
index 356572452898..897090f0f26e 100644
--- a/drivers/platform/chrome/cros_ec_lpc.c
+++ b/drivers/platform/chrome/cros_ec_lpc.c
@@ -460,7 +460,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int cros_ec_lpc_remove(struct platform_device *pdev)
+static void cros_ec_lpc_remove(struct platform_device *pdev)
 {
 	struct cros_ec_device *ec_dev = platform_get_drvdata(pdev);
 	struct acpi_device *adev;
@@ -471,8 +471,6 @@ static int cros_ec_lpc_remove(struct platform_device *pdev)
 					   cros_ec_lpc_acpi_notify);
 
 	cros_ec_unregister(ec_dev);
-
-	return 0;
 }
 
 static const struct acpi_device_id cros_ec_lpc_acpi_device_ids[] = {
@@ -580,7 +578,7 @@ static struct platform_driver cros_ec_lpc_driver = {
 		.probe_type = PROBE_FORCE_SYNCHRONOUS,
 	},
 	.probe = cros_ec_lpc_probe,
-	.remove = cros_ec_lpc_remove,
+	.remove_new = cros_ec_lpc_remove,
 };
 
 static struct platform_device cros_ec_lpc_device = {
-- 
2.40.1


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

* [PATCH 05/27] platform/chrome: cros_ec_sysfs: Convert to platform remove callback returning void
  2023-09-27  8:10 [PATCH 00/27] platform: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (3 preceding siblings ...)
  2023-09-27  8:10 ` [PATCH 04/27] platform/chrome: cros_ec_lpc: " Uwe Kleine-König
@ 2023-09-27  8:10 ` Uwe Kleine-König
  2023-09-27  8:10 ` [PATCH 06/27] platform/chrome: cros_ec_vbc: " Uwe Kleine-König
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2023-09-27  8:10 UTC (permalink / raw
  To: Benson Leung, Tzung-Bi Shih
  Cc: Guenter Roeck, chrome-platform, linux-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/platform/chrome/cros_ec_sysfs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_sysfs.c b/drivers/platform/chrome/cros_ec_sysfs.c
index 09e3bf5e8ec6..93e67ab4af06 100644
--- a/drivers/platform/chrome/cros_ec_sysfs.c
+++ b/drivers/platform/chrome/cros_ec_sysfs.c
@@ -340,13 +340,11 @@ static int cros_ec_sysfs_probe(struct platform_device *pd)
 	return ret;
 }
 
-static int cros_ec_sysfs_remove(struct platform_device *pd)
+static void cros_ec_sysfs_remove(struct platform_device *pd)
 {
 	struct cros_ec_dev *ec_dev = dev_get_drvdata(pd->dev.parent);
 
 	sysfs_remove_group(&ec_dev->class_dev.kobj, &cros_ec_attr_group);
-
-	return 0;
 }
 
 static struct platform_driver cros_ec_sysfs_driver = {
@@ -354,7 +352,7 @@ static struct platform_driver cros_ec_sysfs_driver = {
 		.name = DRV_NAME,
 	},
 	.probe = cros_ec_sysfs_probe,
-	.remove = cros_ec_sysfs_remove,
+	.remove_new = cros_ec_sysfs_remove,
 };
 
 module_platform_driver(cros_ec_sysfs_driver);
-- 
2.40.1


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

* [PATCH 06/27] platform/chrome: cros_ec_vbc: Convert to platform remove callback returning void
  2023-09-27  8:10 [PATCH 00/27] platform: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (4 preceding siblings ...)
  2023-09-27  8:10 ` [PATCH 05/27] platform/chrome: cros_ec_sysfs: " Uwe Kleine-König
@ 2023-09-27  8:10 ` Uwe Kleine-König
  2023-09-27  8:10 ` [PATCH 07/27] platform/chrome: cros_typec_switch: " Uwe Kleine-König
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2023-09-27  8:10 UTC (permalink / raw
  To: Benson Leung, Tzung-Bi Shih
  Cc: Guenter Roeck, chrome-platform, linux-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/platform/chrome/cros_ec_vbc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_vbc.c b/drivers/platform/chrome/cros_ec_vbc.c
index c859c862d7ac..2e4af10c7679 100644
--- a/drivers/platform/chrome/cros_ec_vbc.c
+++ b/drivers/platform/chrome/cros_ec_vbc.c
@@ -121,14 +121,12 @@ static int cros_ec_vbc_probe(struct platform_device *pd)
 	return ret;
 }
 
-static int cros_ec_vbc_remove(struct platform_device *pd)
+static void cros_ec_vbc_remove(struct platform_device *pd)
 {
 	struct cros_ec_dev *ec_dev = dev_get_drvdata(pd->dev.parent);
 
 	sysfs_remove_group(&ec_dev->class_dev.kobj,
 			   &cros_ec_vbc_attr_group);
-
-	return 0;
 }
 
 static struct platform_driver cros_ec_vbc_driver = {
@@ -136,7 +134,7 @@ static struct platform_driver cros_ec_vbc_driver = {
 		.name = DRV_NAME,
 	},
 	.probe = cros_ec_vbc_probe,
-	.remove = cros_ec_vbc_remove,
+	.remove_new = cros_ec_vbc_remove,
 };
 
 module_platform_driver(cros_ec_vbc_driver);
-- 
2.40.1


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

* [PATCH 07/27] platform/chrome: cros_typec_switch: Convert to platform remove callback returning void
  2023-09-27  8:10 [PATCH 00/27] platform: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (5 preceding siblings ...)
  2023-09-27  8:10 ` [PATCH 06/27] platform/chrome: cros_ec_vbc: " Uwe Kleine-König
@ 2023-09-27  8:10 ` Uwe Kleine-König
  2023-09-28 17:10   ` Prashant Malani
  2023-09-27  8:10 ` [PATCH 08/27] platform/chrome: cros_usbpd_logger: " Uwe Kleine-König
                   ` (8 subsequent siblings)
  15 siblings, 1 reply; 19+ messages in thread
From: Uwe Kleine-König @ 2023-09-27  8:10 UTC (permalink / raw
  To: Prashant Malani, Benson Leung, Tzung-Bi Shih
  Cc: chrome-platform, linux-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/platform/chrome/cros_typec_switch.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c
index 0eefdcf14d63..07a19386dc4e 100644
--- a/drivers/platform/chrome/cros_typec_switch.c
+++ b/drivers/platform/chrome/cros_typec_switch.c
@@ -297,12 +297,11 @@ static int cros_typec_switch_probe(struct platform_device *pdev)
 	return cros_typec_register_switches(sdata);
 }
 
-static int cros_typec_switch_remove(struct platform_device *pdev)
+static void cros_typec_switch_remove(struct platform_device *pdev)
 {
 	struct cros_typec_switch_data *sdata = platform_get_drvdata(pdev);
 
 	cros_typec_unregister_switches(sdata);
-	return 0;
 }
 
 #ifdef CONFIG_ACPI
@@ -319,7 +318,7 @@ static struct platform_driver cros_typec_switch_driver = {
 		.acpi_match_table = ACPI_PTR(cros_typec_switch_acpi_id),
 	},
 	.probe = cros_typec_switch_probe,
-	.remove = cros_typec_switch_remove,
+	.remove_new = cros_typec_switch_remove,
 };
 
 module_platform_driver(cros_typec_switch_driver);
-- 
2.40.1


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

* [PATCH 08/27] platform/chrome: cros_usbpd_logger: Convert to platform remove callback returning void
  2023-09-27  8:10 [PATCH 00/27] platform: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (6 preceding siblings ...)
  2023-09-27  8:10 ` [PATCH 07/27] platform/chrome: cros_typec_switch: " Uwe Kleine-König
@ 2023-09-27  8:10 ` Uwe Kleine-König
  2023-09-27  8:10 ` [PATCH 09/27] platform/chrome: cros_usbpd_notify: " Uwe Kleine-König
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2023-09-27  8:10 UTC (permalink / raw
  To: Benson Leung, Tzung-Bi Shih; +Cc: chrome-platform, linux-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/platform/chrome/cros_usbpd_logger.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/chrome/cros_usbpd_logger.c b/drivers/platform/chrome/cros_usbpd_logger.c
index d16931203d82..f618757f8b32 100644
--- a/drivers/platform/chrome/cros_usbpd_logger.c
+++ b/drivers/platform/chrome/cros_usbpd_logger.c
@@ -219,14 +219,12 @@ static int cros_usbpd_logger_probe(struct platform_device *pd)
 	return 0;
 }
 
-static int cros_usbpd_logger_remove(struct platform_device *pd)
+static void cros_usbpd_logger_remove(struct platform_device *pd)
 {
 	struct logger_data *logger = platform_get_drvdata(pd);
 
 	cancel_delayed_work_sync(&logger->log_work);
 	destroy_workqueue(logger->log_workqueue);
-
-	return 0;
 }
 
 static int __maybe_unused cros_usbpd_logger_resume(struct device *dev)
@@ -257,7 +255,7 @@ static struct platform_driver cros_usbpd_logger_driver = {
 		.pm = &cros_usbpd_logger_pm_ops,
 	},
 	.probe = cros_usbpd_logger_probe,
-	.remove = cros_usbpd_logger_remove,
+	.remove_new = cros_usbpd_logger_remove,
 };
 
 module_platform_driver(cros_usbpd_logger_driver);
-- 
2.40.1


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

* [PATCH 09/27] platform/chrome: cros_usbpd_notify: Convert to platform remove callback returning void
  2023-09-27  8:10 [PATCH 00/27] platform: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (7 preceding siblings ...)
  2023-09-27  8:10 ` [PATCH 08/27] platform/chrome: cros_usbpd_logger: " Uwe Kleine-König
@ 2023-09-27  8:10 ` Uwe Kleine-König
  2023-09-28 17:11   ` Prashant Malani
  2023-09-27  8:10 ` [PATCH 10/27] platform/chrome/wilco_ec: core: " Uwe Kleine-König
                   ` (6 subsequent siblings)
  15 siblings, 1 reply; 19+ messages in thread
From: Uwe Kleine-König @ 2023-09-27  8:10 UTC (permalink / raw
  To: Prashant Malani, Benson Leung, Tzung-Bi Shih
  Cc: chrome-platform, linux-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/platform/chrome/cros_usbpd_notify.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/platform/chrome/cros_usbpd_notify.c b/drivers/platform/chrome/cros_usbpd_notify.c
index 10670b6588e3..aacad022f21d 100644
--- a/drivers/platform/chrome/cros_usbpd_notify.c
+++ b/drivers/platform/chrome/cros_usbpd_notify.c
@@ -134,15 +134,13 @@ static int cros_usbpd_notify_probe_acpi(struct platform_device *pdev)
 	return 0;
 }
 
-static int cros_usbpd_notify_remove_acpi(struct platform_device *pdev)
+static void cros_usbpd_notify_remove_acpi(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct acpi_device *adev = ACPI_COMPANION(dev);
 
 	acpi_remove_notify_handler(adev->handle, ACPI_ALL_NOTIFY,
 				   cros_usbpd_notify_acpi);
-
-	return 0;
 }
 
 static const struct acpi_device_id cros_usbpd_notify_acpi_device_ids[] = {
@@ -157,7 +155,7 @@ static struct platform_driver cros_usbpd_notify_acpi_driver = {
 		.acpi_match_table = cros_usbpd_notify_acpi_device_ids,
 	},
 	.probe = cros_usbpd_notify_probe_acpi,
-	.remove = cros_usbpd_notify_remove_acpi,
+	.remove_new = cros_usbpd_notify_remove_acpi,
 };
 
 #endif /* CONFIG_ACPI */
@@ -209,7 +207,7 @@ static int cros_usbpd_notify_probe_plat(struct platform_device *pdev)
 	return 0;
 }
 
-static int cros_usbpd_notify_remove_plat(struct platform_device *pdev)
+static void cros_usbpd_notify_remove_plat(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct cros_ec_dev *ecdev = dev_get_drvdata(dev->parent);
@@ -218,8 +216,6 @@ static int cros_usbpd_notify_remove_plat(struct platform_device *pdev)
 
 	blocking_notifier_chain_unregister(&ecdev->ec_dev->event_notifier,
 					   &pdnotify->nb);
-
-	return 0;
 }
 
 static struct platform_driver cros_usbpd_notify_plat_driver = {
@@ -227,7 +223,7 @@ static struct platform_driver cros_usbpd_notify_plat_driver = {
 		.name = DRV_NAME,
 	},
 	.probe = cros_usbpd_notify_probe_plat,
-	.remove = cros_usbpd_notify_remove_plat,
+	.remove_new = cros_usbpd_notify_remove_plat,
 };
 
 static int __init cros_usbpd_notify_init(void)
-- 
2.40.1


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

* [PATCH 10/27] platform/chrome/wilco_ec: core: Convert to platform remove callback returning void
  2023-09-27  8:10 [PATCH 00/27] platform: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (8 preceding siblings ...)
  2023-09-27  8:10 ` [PATCH 09/27] platform/chrome: cros_usbpd_notify: " Uwe Kleine-König
@ 2023-09-27  8:10 ` Uwe Kleine-König
  2023-09-27  8:10 ` [PATCH 11/27] platform/chrome/wilco_ec: debugfs: " Uwe Kleine-König
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2023-09-27  8:10 UTC (permalink / raw
  To: Benson Leung, Tzung-Bi Shih, Guenter Roeck, Brian Norris
  Cc: chrome-platform, linux-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/platform/chrome/wilco_ec/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/chrome/wilco_ec/core.c b/drivers/platform/chrome/wilco_ec/core.c
index d6a994bdc182..9b59a1bed286 100644
--- a/drivers/platform/chrome/wilco_ec/core.c
+++ b/drivers/platform/chrome/wilco_ec/core.c
@@ -132,7 +132,7 @@ static int wilco_ec_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int wilco_ec_remove(struct platform_device *pdev)
+static void wilco_ec_remove(struct platform_device *pdev)
 {
 	struct wilco_ec_device *ec = platform_get_drvdata(pdev);
 
@@ -142,7 +142,6 @@ static int wilco_ec_remove(struct platform_device *pdev)
 	platform_device_unregister(ec->rtc_pdev);
 	if (ec->debugfs_pdev)
 		platform_device_unregister(ec->debugfs_pdev);
-	return 0;
 }
 
 static const struct acpi_device_id wilco_ec_acpi_device_ids[] = {
@@ -157,7 +156,7 @@ static struct platform_driver wilco_ec_driver = {
 		.acpi_match_table = wilco_ec_acpi_device_ids,
 	},
 	.probe = wilco_ec_probe,
-	.remove = wilco_ec_remove,
+	.remove_new = wilco_ec_remove,
 };
 
 module_platform_driver(wilco_ec_driver);
-- 
2.40.1


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

* [PATCH 11/27] platform/chrome/wilco_ec: debugfs: Convert to platform remove callback returning void
  2023-09-27  8:10 [PATCH 00/27] platform: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (9 preceding siblings ...)
  2023-09-27  8:10 ` [PATCH 10/27] platform/chrome/wilco_ec: core: " Uwe Kleine-König
@ 2023-09-27  8:10 ` Uwe Kleine-König
  2023-09-27  8:10 ` [PATCH 12/27] platform/chrome/wilco_ec: telemetry: " Uwe Kleine-König
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2023-09-27  8:10 UTC (permalink / raw
  To: Benson Leung, Tzung-Bi Shih, Zhengkang Huang, Dongliang Mu
  Cc: chrome-platform, linux-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/platform/chrome/wilco_ec/debugfs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/chrome/wilco_ec/debugfs.c b/drivers/platform/chrome/wilco_ec/debugfs.c
index 7a13f13b16cd..93c11f81ca45 100644
--- a/drivers/platform/chrome/wilco_ec/debugfs.c
+++ b/drivers/platform/chrome/wilco_ec/debugfs.c
@@ -260,11 +260,9 @@ static int wilco_ec_debugfs_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int wilco_ec_debugfs_remove(struct platform_device *pdev)
+static void wilco_ec_debugfs_remove(struct platform_device *pdev)
 {
 	debugfs_remove_recursive(debug_info->dir);
-
-	return 0;
 }
 
 static struct platform_driver wilco_ec_debugfs_driver = {
@@ -272,7 +270,7 @@ static struct platform_driver wilco_ec_debugfs_driver = {
 		.name = DRV_NAME,
 	},
 	.probe = wilco_ec_debugfs_probe,
-	.remove = wilco_ec_debugfs_remove,
+	.remove_new = wilco_ec_debugfs_remove,
 };
 
 module_platform_driver(wilco_ec_debugfs_driver);
-- 
2.40.1


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

* [PATCH 12/27] platform/chrome/wilco_ec: telemetry: Convert to platform remove callback returning void
  2023-09-27  8:10 [PATCH 00/27] platform: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (10 preceding siblings ...)
  2023-09-27  8:10 ` [PATCH 11/27] platform/chrome/wilco_ec: debugfs: " Uwe Kleine-König
@ 2023-09-27  8:10 ` Uwe Kleine-König
  2023-09-28  5:30 ` [PATCH 00/27] platform: " patchwork-bot+chrome-platform
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Uwe Kleine-König @ 2023-09-27  8:10 UTC (permalink / raw
  To: Benson Leung, Tzung-Bi Shih, Greg Kroah-Hartman
  Cc: chrome-platform, linux-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/platform/chrome/wilco_ec/telemetry.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/chrome/wilco_ec/telemetry.c b/drivers/platform/chrome/wilco_ec/telemetry.c
index 54708aa6c700..253098bace63 100644
--- a/drivers/platform/chrome/wilco_ec/telemetry.c
+++ b/drivers/platform/chrome/wilco_ec/telemetry.c
@@ -400,20 +400,18 @@ static int telem_device_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int telem_device_remove(struct platform_device *pdev)
+static void telem_device_remove(struct platform_device *pdev)
 {
 	struct telem_device_data *dev_data = platform_get_drvdata(pdev);
 
 	cdev_device_del(&dev_data->cdev, &dev_data->dev);
 	ida_simple_remove(&telem_ida, MINOR(dev_data->dev.devt));
 	put_device(&dev_data->dev);
-
-	return 0;
 }
 
 static struct platform_driver telem_driver = {
 	.probe = telem_device_probe,
-	.remove = telem_device_remove,
+	.remove_new = telem_device_remove,
 	.driver = {
 		.name = DRV_NAME,
 	},
-- 
2.40.1


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

* Re: [PATCH 00/27] platform: Convert to platform remove callback returning void
  2023-09-27  8:10 [PATCH 00/27] platform: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (11 preceding siblings ...)
  2023-09-27  8:10 ` [PATCH 12/27] platform/chrome/wilco_ec: telemetry: " Uwe Kleine-König
@ 2023-09-28  5:30 ` patchwork-bot+chrome-platform
  2023-09-28 10:36 ` Ilpo Järvinen
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-09-28  5:30 UTC (permalink / raw
  To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E?=
  Cc: bleung, tzungbi, pmalani, groeck, briannorris, zkhuang, dzm91,
	gregkh, hdegoede, ilpo.jarvinen, markgross, vadimp,
	gerd.haeussler.ext, xingtong.wu, tobias.schaffner,
	chrome-platform, linux-kernel, platform-driver-x86, kernel

Hello:

This series was applied to chrome-platform/linux.git (for-kernelci)
by Tzung-Bi Shih <tzungbi@kernel.org>:

On Wed, 27 Sep 2023 10:10:13 +0200 you wrote:
> Hello,
> 
> this series converts all platform drivers below drivers/platform to use
> .remove_new(). The motivation is to get rid of an integer return code
> that is (mostly) ignored by the platform driver core and error prone on
> the driver side.
> 
> [...]

Here is the summary with links:
  - [01/27] platform/chrome: cros_ec_chardev: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/f04410e7be65
  - [02/27] platform/chrome: cros_ec_debugfs: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/f366fa0064ef
  - [03/27] platform/chrome: cros_ec_lightbar: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/fa45583c3133
  - [04/27] platform/chrome: cros_ec_lpc: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/e02944e85169
  - [05/27] platform/chrome: cros_ec_sysfs: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/6478e302409a
  - [06/27] platform/chrome: cros_ec_vbc: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/58b15196b0ef
  - [07/27] platform/chrome: cros_typec_switch: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/ea4bad2badb7
  - [08/27] platform/chrome: cros_usbpd_logger: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/b6c1fea83550
  - [09/27] platform/chrome: cros_usbpd_notify: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/b98362be7c92
  - [10/27] platform/chrome/wilco_ec: core: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/48648504e488
  - [11/27] platform/chrome/wilco_ec: debugfs: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/1fca58f347d8
  - [12/27] platform/chrome/wilco_ec: telemetry: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/7396a5b980fd

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH 00/27] platform: Convert to platform remove callback returning void
  2023-09-27  8:10 [PATCH 00/27] platform: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (12 preceding siblings ...)
  2023-09-28  5:30 ` [PATCH 00/27] platform: " patchwork-bot+chrome-platform
@ 2023-09-28 10:36 ` Ilpo Järvinen
  2023-09-28 11:03 ` Ilpo Järvinen
  2023-10-02  3:00 ` patchwork-bot+chrome-platform
  15 siblings, 0 replies; 19+ messages in thread
From: Ilpo Järvinen @ 2023-09-28 10:36 UTC (permalink / raw
  To: Benson Leung, Tzung-Bi Shih, Prashant Malani, Guenter Roeck,
	Brian Norris, Zhengkang Huang, Dongliang Mu, Greg Kroah-Hartman,
	Hans de Goede, Mark Gross, Vadim Pasternak, Gerd Haeussler,
	Xing Tong Wu, Tobias Schaffner, Uwe Kleine-König
  Cc: chrome-platform, linux-kernel, platform-driver-x86, kernel

On Wed, 27 Sep 2023 10:10:13 +0200, Uwe Kleine-König wrote:

> this series converts all platform drivers below drivers/platform to use
> .remove_new(). The motivation is to get rid of an integer return code
> that is (mostly) ignored by the platform driver core and error prone on
> the driver side.
> 
> See commit 5c5a7680e67b ("platform: Provide a remove callback that
> returns no value") for an extended explanation and the eventual goal.
> 
> [...]


Thank you for your contribution, it has been applied to my local
review-ilpo branch. Note it will show up in the public
platform-drivers-x86/review-ilpo branch only once I've pushed my
local branch there, which might take a while.

Once I've run some tests on the review-ilpo branch the patches
there will be added to the platform-drivers-x86/for-next branch
and eventually will be included in the pdx86 pull-request to
Linus for the next merge-window.

The list of commits applied:
[14/27] platform/mellanox: mlxbf-bootctl: Convert to platform remove callback returning void
        commit: a6cff4212984010c119263593c0a249e15ad5caf
[15/27] platform/mellanox: mlxbf-tmfifo: Convert to platform remove callback returning void
        commit: db971cf26014948d642522dae9a01968d009751c
[16/27] platform/mellanox: mlxreg-hotplug: Convert to platform remove callback returning void
        commit: a62507eb57124f4889b97de9917a164bf3109aa6
[17/27] platform/mellanox: mlxreg-io: Convert to platform remove callback returning void
        commit: e0489bb002ff581f9439de2d22b49e140e73e6b4
[18/27] platform/mellanox: mlxreg-lc: Convert to platform remove callback returning void
        commit: cfae9860ca990c5a642da85e01e0eb2e7dd9db35
[19/27] platform/mellanox: nvsw-sn2201: Convert to platform remove callback returning void
        commit: 61e2e9ee39d921756050dafeb91537284139f611
[20/27] platform/x86/intel: bytcrc_pwrsrc: Convert to platform remove callback returning void
        commit: 3e29812e6e172ba772761e6995753b729e8a6f77
[21/27] platform/x86: mlx-platform: Convert to platform remove callback returning void
        commit: 1348317db770681cde4c6ac04afd75a1b0a99098
[22/27] platform/x86: sel3350-platform: Convert to platform remove callback returning void
        commit: 9e6b44d43e31160bfba568244c785f439ac33d0e
[23/27] platform/x86/siemens: simatic-ipc-batt: Simplify simatic_ipc_batt_remove()
        commit: 0580422560e2b93fe2e343d8438823824729a574
[24/27] platform/x86/siemens: simatic-ipc-batt: Convert to platform remove callback returning void
        commit: 2f46e417384e0412c5e239fe6a84ace7d955b33e
[25/27] platform/x86/siemens: simatic-ipc-batt-apollolake: Convert to platform remove callback returning void
        commit: e139d97f049a8d924f91700a9a5f28c8bfe676d3
[26/27] platform/x86/siemens: simatic-ipc-batt-elkhartlake: Convert to platform remove callback returning void
        commit: 0d643dcd78423afad7204a280dc25dc67bcd85c0
[27/27] platform/x86/siemens: simatic-ipc-batt-f7188x: Convert to platform remove callback returning void
        commit: 49d371ab9d2c850867332b469fa6b3a2d5cf338c

--
 i.

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

* Re: [PATCH 00/27] platform: Convert to platform remove callback returning void
  2023-09-27  8:10 [PATCH 00/27] platform: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (13 preceding siblings ...)
  2023-09-28 10:36 ` Ilpo Järvinen
@ 2023-09-28 11:03 ` Ilpo Järvinen
  2023-10-02  3:00 ` patchwork-bot+chrome-platform
  15 siblings, 0 replies; 19+ messages in thread
From: Ilpo Järvinen @ 2023-09-28 11:03 UTC (permalink / raw
  To: Uwe Kleine-König
  Cc: Benson Leung, Tzung-Bi Shih, Prashant Malani, Guenter Roeck,
	Brian Norris, Zhengkang Huang, Dongliang Mu, Greg Kroah-Hartman,
	Hans de Goede, Mark Gross, Vadim Pasternak, Gerd Haeussler,
	Xing Tong Wu, Tobias Schaffner, chrome-platform, LKML,
	platform-driver-x86, kernel

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

On Wed, 27 Sep 2023, Uwe Kleine-König wrote:

> Hello,
> 
> this series converts all platform drivers below drivers/platform to use
> .remove_new(). The motivation is to get rid of an integer return code
> that is (mostly) ignored by the platform driver core and error prone on
> the driver side.
> 
> See commit 5c5a7680e67b ("platform: Provide a remove callback that
> returns no value") for an extended explanation and the eventual goal.
> 
> As there is no single maintainer team for drivers/platform, I suggest
> the individual maintainers to pick up "their" patches. The only
> inter-dependency in this series is that the patches #24 - #27 depend on
> #23. Otherwise there are no inter-dependencies, so that should work
> fine. As there are still quite a few drivers to convert in other areas
> than drivers/platform, I'm happy about every patch that makes it in and
> there is no need for further coordination. So even if there is a merge
> conflict with one patch until you apply or a subject prefix is
> suboptimal, please don't let you stop by negative feedback for other
> patches (unless it applies to "your" patches, too, of course).
> 
> Best regards and thanks for considering,
> Uwe
> 
> Uwe Kleine-König (27):
>   platform/chrome: cros_ec_chardev: Convert to platform remove callback
>     returning void
>   platform/chrome: cros_ec_debugfs: Convert to platform remove callback
>     returning void
>   platform/chrome: cros_ec_lightbar: Convert to platform remove callback
>     returning void
>   platform/chrome: cros_ec_lpc: Convert to platform remove callback
>     returning void
>   platform/chrome: cros_ec_sysfs: Convert to platform remove callback
>     returning void
>   platform/chrome: cros_ec_vbc: Convert to platform remove callback
>     returning void
>   platform/chrome: cros_typec_switch: Convert to platform remove
>     callback returning void
>   platform/chrome: cros_usbpd_logger: Convert to platform remove
>     callback returning void
>   platform/chrome: cros_usbpd_notify: Convert to platform remove
>     callback returning void
>   platform/chrome/wilco_ec: core: Convert to platform remove callback
>     returning void
>   platform/chrome/wilco_ec: debugfs: Convert to platform remove callback
>     returning void
>   platform/chrome/wilco_ec: telemetry: Convert to platform remove
>     callback returning void
>   platform/goldfish: goldfish_pipe: Convert to platform remove callback
>     returning void
>   platform/mellanox: mlxbf-bootctl: Convert to platform remove callback
>     returning void
>   platform/mellanox: mlxbf-tmfifo: Convert to platform remove callback
>     returning void
>   platform/mellanox: mlxreg-hotplug: Convert to platform remove callback
>     returning void
>   platform/mellanox: mlxreg-io: Convert to platform remove callback
>     returning void
>   platform/mellanox: mlxreg-lc: Convert to platform remove callback
>     returning void
>   platform/mellanox: nvsw-sn2201: Convert to platform remove callback
>     returning void
>   platform/x86/intel: bytcrc_pwrsrc: Convert to platform remove callback
>     returning void
>   platform/x86: mlx-platform: Convert to platform remove callback
>     returning void
>   platform/x86: sel3350-platform: Convert to platform remove callback
>     returning void
>   platform/x86/siemens: simatic-ipc-batt: Simplify
>     simatic_ipc_batt_remove()
>   platform/x86/siemens: simatic-ipc-batt: Convert to platform remove
>     callback returning void
>   platform/x86/siemens: simatic-ipc-batt-apollolake: Convert to platform
>     remove callback returning void
>   platform/x86/siemens: simatic-ipc-batt-elkhartlake: Convert to
>     platform remove callback returning void
>   platform/x86/siemens: simatic-ipc-batt-f7188x: Convert to platform
>     remove callback returning void

Thanks for the patches.

I don't know if you got the auto generated thank you email as it seemed to 
hit a character encoding problem while sending the email out.

But in any case, I've applied patches 14-27 to my local review-ilpo branch 
(they will eventually appear on the public repo too and propagate to 
for-next).


-- 
 i.

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

* Re: [PATCH 07/27] platform/chrome: cros_typec_switch: Convert to platform remove callback returning void
  2023-09-27  8:10 ` [PATCH 07/27] platform/chrome: cros_typec_switch: " Uwe Kleine-König
@ 2023-09-28 17:10   ` Prashant Malani
  0 siblings, 0 replies; 19+ messages in thread
From: Prashant Malani @ 2023-09-28 17:10 UTC (permalink / raw
  To: Uwe Kleine-König
  Cc: Benson Leung, Tzung-Bi Shih, chrome-platform, linux-kernel,
	kernel

Hi Uwe,

On Wed, Sep 27, 2023 at 1:10 AM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
>
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
>
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Prashant Malani <pmalani@chromium.org>


BR,

-Prashant

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

* Re: [PATCH 09/27] platform/chrome: cros_usbpd_notify: Convert to platform remove callback returning void
  2023-09-27  8:10 ` [PATCH 09/27] platform/chrome: cros_usbpd_notify: " Uwe Kleine-König
@ 2023-09-28 17:11   ` Prashant Malani
  0 siblings, 0 replies; 19+ messages in thread
From: Prashant Malani @ 2023-09-28 17:11 UTC (permalink / raw
  To: Uwe Kleine-König
  Cc: Benson Leung, Tzung-Bi Shih, chrome-platform, linux-kernel,
	kernel

Hi Uwe,

On Wed, Sep 27, 2023 at 1:10 AM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
>
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
>
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Prashant Malani <pmalani@chromium.org>

BR,

-Prashant

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

* Re: [PATCH 00/27] platform: Convert to platform remove callback returning void
  2023-09-27  8:10 [PATCH 00/27] platform: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (14 preceding siblings ...)
  2023-09-28 11:03 ` Ilpo Järvinen
@ 2023-10-02  3:00 ` patchwork-bot+chrome-platform
  15 siblings, 0 replies; 19+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-10-02  3:00 UTC (permalink / raw
  To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E?=
  Cc: bleung, tzungbi, pmalani, groeck, briannorris, zkhuang, dzm91,
	gregkh, hdegoede, ilpo.jarvinen, markgross, vadimp,
	gerd.haeussler.ext, xingtong.wu, tobias.schaffner,
	chrome-platform, linux-kernel, platform-driver-x86, kernel

Hello:

This series was applied to chrome-platform/linux.git (for-next)
by Tzung-Bi Shih <tzungbi@kernel.org>:

On Wed, 27 Sep 2023 10:10:13 +0200 you wrote:
> Hello,
> 
> this series converts all platform drivers below drivers/platform to use
> .remove_new(). The motivation is to get rid of an integer return code
> that is (mostly) ignored by the platform driver core and error prone on
> the driver side.
> 
> [...]

Here is the summary with links:
  - [01/27] platform/chrome: cros_ec_chardev: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/f04410e7be65
  - [02/27] platform/chrome: cros_ec_debugfs: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/f366fa0064ef
  - [03/27] platform/chrome: cros_ec_lightbar: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/fa45583c3133
  - [04/27] platform/chrome: cros_ec_lpc: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/e02944e85169
  - [05/27] platform/chrome: cros_ec_sysfs: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/6478e302409a
  - [06/27] platform/chrome: cros_ec_vbc: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/58b15196b0ef
  - [07/27] platform/chrome: cros_typec_switch: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/ea4bad2badb7
  - [08/27] platform/chrome: cros_usbpd_logger: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/b6c1fea83550
  - [09/27] platform/chrome: cros_usbpd_notify: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/b98362be7c92
  - [10/27] platform/chrome/wilco_ec: core: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/48648504e488
  - [11/27] platform/chrome/wilco_ec: debugfs: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/1fca58f347d8
  - [12/27] platform/chrome/wilco_ec: telemetry: Convert to platform remove callback returning void
    https://git.kernel.org/chrome-platform/c/7396a5b980fd

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-10-02  3:00 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-27  8:10 [PATCH 00/27] platform: Convert to platform remove callback returning void Uwe Kleine-König
2023-09-27  8:10 ` [PATCH 01/27] platform/chrome: cros_ec_chardev: " Uwe Kleine-König
2023-09-27  8:10 ` [PATCH 02/27] platform/chrome: cros_ec_debugfs: " Uwe Kleine-König
2023-09-27  8:10 ` [PATCH 03/27] platform/chrome: cros_ec_lightbar: " Uwe Kleine-König
2023-09-27  8:10 ` [PATCH 04/27] platform/chrome: cros_ec_lpc: " Uwe Kleine-König
2023-09-27  8:10 ` [PATCH 05/27] platform/chrome: cros_ec_sysfs: " Uwe Kleine-König
2023-09-27  8:10 ` [PATCH 06/27] platform/chrome: cros_ec_vbc: " Uwe Kleine-König
2023-09-27  8:10 ` [PATCH 07/27] platform/chrome: cros_typec_switch: " Uwe Kleine-König
2023-09-28 17:10   ` Prashant Malani
2023-09-27  8:10 ` [PATCH 08/27] platform/chrome: cros_usbpd_logger: " Uwe Kleine-König
2023-09-27  8:10 ` [PATCH 09/27] platform/chrome: cros_usbpd_notify: " Uwe Kleine-König
2023-09-28 17:11   ` Prashant Malani
2023-09-27  8:10 ` [PATCH 10/27] platform/chrome/wilco_ec: core: " Uwe Kleine-König
2023-09-27  8:10 ` [PATCH 11/27] platform/chrome/wilco_ec: debugfs: " Uwe Kleine-König
2023-09-27  8:10 ` [PATCH 12/27] platform/chrome/wilco_ec: telemetry: " Uwe Kleine-König
2023-09-28  5:30 ` [PATCH 00/27] platform: " patchwork-bot+chrome-platform
2023-09-28 10:36 ` Ilpo Järvinen
2023-09-28 11:03 ` Ilpo Järvinen
2023-10-02  3:00 ` patchwork-bot+chrome-platform

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 read-only IMAP folder(s) and NNTP newsgroup(s).