All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] ACPI: Convert to platform remove callback returning void
@ 2024-02-22 18:52 ` Uwe Kleine-König
  0 siblings, 0 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2024-02-22 18:52 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, linux-acpi, kernel, Lorenzo Pieralisi, Hanjun Guo,
	Sudeep Holla, linux-arm-kernel

Hello,

this series converts all drivers below drivers/acpi to struct
platform_driver::remove_new(). See commit 5c5a7680e67b ("platform:
Provide a remove callback that returns no value") for an extended
explanation and the eventual goal.

All conversations are trivial, because their .remove() callbacks
returned zero unconditionally.

There are no interdependencies between these patches, so they could be
picked up individually. But I'd hope that they get picked up all
together by Rafael.

There is another driver that needs adaption (as of today's next), but
this is discussed separately, see
https://lore.kernel.org/linux-acpi/CAJZ5v0jJX-6L9f_TLe-cv2MNnZVK7au=drbKCn-tEWEagY-9ZA@mail.gmail.com
.

Best regards
Uwe

Uwe Kleine-König (7):
  ACPI: TAD: Convert to platform remove callback returning void
  ACPI: AGDI: Convert to platform remove callback returning void
  ACPI: DPTF: Convert to platform remove callback returning void
  ACPI: GED: Convert to platform remove callback returning void
  ACPI: fan: Convert to platform remove callback returning void
  ACPI: pfr_telemetry: Convert to platform remove callback returning void
  ACPI: pfr_update: Convert to platform remove callback returning void

 drivers/acpi/acpi_tad.c           | 5 ++---
 drivers/acpi/arm64/agdi.c         | 8 +++-----
 drivers/acpi/dptf/dptf_pch_fivr.c | 6 ++----
 drivers/acpi/dptf/dptf_power.c    | 6 ++----
 drivers/acpi/evged.c              | 5 ++---
 drivers/acpi/fan_core.c           | 6 ++----
 drivers/acpi/pfr_telemetry.c      | 6 ++----
 drivers/acpi/pfr_update.c         | 6 ++----
 8 files changed, 17 insertions(+), 31 deletions(-)

base-commit: 4893c639cc3659cefaa675bf1e59f4e7571afb5c
-- 
2.43.0


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

* [PATCH 0/7] ACPI: Convert to platform remove callback returning void
@ 2024-02-22 18:52 ` Uwe Kleine-König
  0 siblings, 0 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2024-02-22 18:52 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, linux-acpi, kernel, Lorenzo Pieralisi, Hanjun Guo,
	Sudeep Holla, linux-arm-kernel

Hello,

this series converts all drivers below drivers/acpi to struct
platform_driver::remove_new(). See commit 5c5a7680e67b ("platform:
Provide a remove callback that returns no value") for an extended
explanation and the eventual goal.

All conversations are trivial, because their .remove() callbacks
returned zero unconditionally.

There are no interdependencies between these patches, so they could be
picked up individually. But I'd hope that they get picked up all
together by Rafael.

There is another driver that needs adaption (as of today's next), but
this is discussed separately, see
https://lore.kernel.org/linux-acpi/CAJZ5v0jJX-6L9f_TLe-cv2MNnZVK7au=drbKCn-tEWEagY-9ZA@mail.gmail.com
.

Best regards
Uwe

Uwe Kleine-König (7):
  ACPI: TAD: Convert to platform remove callback returning void
  ACPI: AGDI: Convert to platform remove callback returning void
  ACPI: DPTF: Convert to platform remove callback returning void
  ACPI: GED: Convert to platform remove callback returning void
  ACPI: fan: Convert to platform remove callback returning void
  ACPI: pfr_telemetry: Convert to platform remove callback returning void
  ACPI: pfr_update: Convert to platform remove callback returning void

 drivers/acpi/acpi_tad.c           | 5 ++---
 drivers/acpi/arm64/agdi.c         | 8 +++-----
 drivers/acpi/dptf/dptf_pch_fivr.c | 6 ++----
 drivers/acpi/dptf/dptf_power.c    | 6 ++----
 drivers/acpi/evged.c              | 5 ++---
 drivers/acpi/fan_core.c           | 6 ++----
 drivers/acpi/pfr_telemetry.c      | 6 ++----
 drivers/acpi/pfr_update.c         | 6 ++----
 8 files changed, 17 insertions(+), 31 deletions(-)

base-commit: 4893c639cc3659cefaa675bf1e59f4e7571afb5c
-- 
2.43.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 1/7] ACPI: TAD: Convert to platform remove callback returning void
  2024-02-22 18:52 ` Uwe Kleine-König
  (?)
@ 2024-02-22 18:52 ` Uwe Kleine-König
  -1 siblings, 0 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2024-02-22 18:52 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Len Brown, linux-acpi, 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/acpi/acpi_tad.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpi_tad.c b/drivers/acpi/acpi_tad.c
index 33c3b16af556..1d670dbe4d1d 100644
--- a/drivers/acpi/acpi_tad.c
+++ b/drivers/acpi/acpi_tad.c
@@ -554,7 +554,7 @@ static int acpi_tad_disable_timer(struct device *dev, u32 timer_id)
 	return acpi_tad_wake_set(dev, "_STV", timer_id, ACPI_TAD_WAKE_DISABLED);
 }
 
-static int acpi_tad_remove(struct platform_device *pdev)
+static void acpi_tad_remove(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	acpi_handle handle = ACPI_HANDLE(dev);
@@ -579,7 +579,6 @@ static int acpi_tad_remove(struct platform_device *pdev)
 	pm_runtime_put_sync(dev);
 	pm_runtime_disable(dev);
 	acpi_remove_cmos_rtc_space_handler(handle);
-	return 0;
 }
 
 static int acpi_tad_probe(struct platform_device *pdev)
@@ -684,7 +683,7 @@ static struct platform_driver acpi_tad_driver = {
 		.acpi_match_table = acpi_tad_ids,
 	},
 	.probe = acpi_tad_probe,
-	.remove = acpi_tad_remove,
+	.remove_new = acpi_tad_remove,
 };
 MODULE_DEVICE_TABLE(acpi, acpi_tad_ids);
 
-- 
2.43.0


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

* [PATCH 2/7] ACPI: AGDI: Convert to platform remove callback returning void
  2024-02-22 18:52 ` Uwe Kleine-König
@ 2024-02-22 18:52   ` Uwe Kleine-König
  -1 siblings, 0 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2024-02-22 18:52 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Lorenzo Pieralisi, Hanjun Guo, Sudeep Holla, Len Brown,
	linux-acpi, linux-arm-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/acpi/arm64/agdi.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/arm64/agdi.c b/drivers/acpi/arm64/agdi.c
index 8b3c7d42b41b..f5f21dd0d277 100644
--- a/drivers/acpi/arm64/agdi.c
+++ b/drivers/acpi/arm64/agdi.c
@@ -58,7 +58,7 @@ static int agdi_probe(struct platform_device *pdev)
 	return agdi_sdei_probe(pdev, adata);
 }
 
-static int agdi_remove(struct platform_device *pdev)
+static void agdi_remove(struct platform_device *pdev)
 {
 	struct agdi_data *adata = dev_get_platdata(&pdev->dev);
 	int err, i;
@@ -67,7 +67,7 @@ static int agdi_remove(struct platform_device *pdev)
 	if (err) {
 		dev_err(&pdev->dev, "Failed to disable sdei-event #%d (%pe)\n",
 			adata->sdei_event, ERR_PTR(err));
-		return 0;
+		return;
 	}
 
 	for (i = 0; i < 3; i++) {
@@ -81,8 +81,6 @@ static int agdi_remove(struct platform_device *pdev)
 	if (err)
 		dev_err(&pdev->dev, "Failed to unregister sdei-event #%d (%pe)\n",
 			adata->sdei_event, ERR_PTR(err));
-
-	return 0;
 }
 
 static struct platform_driver agdi_driver = {
@@ -90,7 +88,7 @@ static struct platform_driver agdi_driver = {
 		.name = "agdi",
 	},
 	.probe = agdi_probe,
-	.remove = agdi_remove,
+	.remove_new = agdi_remove,
 };
 
 void __init acpi_agdi_init(void)
-- 
2.43.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/7] ACPI: AGDI: Convert to platform remove callback returning void
@ 2024-02-22 18:52   ` Uwe Kleine-König
  0 siblings, 0 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2024-02-22 18:52 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Lorenzo Pieralisi, Hanjun Guo, Sudeep Holla, Len Brown,
	linux-acpi, linux-arm-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/acpi/arm64/agdi.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/arm64/agdi.c b/drivers/acpi/arm64/agdi.c
index 8b3c7d42b41b..f5f21dd0d277 100644
--- a/drivers/acpi/arm64/agdi.c
+++ b/drivers/acpi/arm64/agdi.c
@@ -58,7 +58,7 @@ static int agdi_probe(struct platform_device *pdev)
 	return agdi_sdei_probe(pdev, adata);
 }
 
-static int agdi_remove(struct platform_device *pdev)
+static void agdi_remove(struct platform_device *pdev)
 {
 	struct agdi_data *adata = dev_get_platdata(&pdev->dev);
 	int err, i;
@@ -67,7 +67,7 @@ static int agdi_remove(struct platform_device *pdev)
 	if (err) {
 		dev_err(&pdev->dev, "Failed to disable sdei-event #%d (%pe)\n",
 			adata->sdei_event, ERR_PTR(err));
-		return 0;
+		return;
 	}
 
 	for (i = 0; i < 3; i++) {
@@ -81,8 +81,6 @@ static int agdi_remove(struct platform_device *pdev)
 	if (err)
 		dev_err(&pdev->dev, "Failed to unregister sdei-event #%d (%pe)\n",
 			adata->sdei_event, ERR_PTR(err));
-
-	return 0;
 }
 
 static struct platform_driver agdi_driver = {
@@ -90,7 +88,7 @@ static struct platform_driver agdi_driver = {
 		.name = "agdi",
 	},
 	.probe = agdi_probe,
-	.remove = agdi_remove,
+	.remove_new = agdi_remove,
 };
 
 void __init acpi_agdi_init(void)
-- 
2.43.0


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

* [PATCH 3/7] ACPI: DPTF: Convert to platform remove callback returning void
  2024-02-22 18:52 ` Uwe Kleine-König
                   ` (2 preceding siblings ...)
  (?)
@ 2024-02-22 18:52 ` Uwe Kleine-König
  -1 siblings, 0 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2024-02-22 18:52 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Len Brown, linux-acpi, 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 these two drivers 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/acpi/dptf/dptf_pch_fivr.c | 6 ++----
 drivers/acpi/dptf/dptf_power.c    | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/acpi/dptf/dptf_pch_fivr.c b/drivers/acpi/dptf/dptf_pch_fivr.c
index 4919e7abe93f..654aaa53c67f 100644
--- a/drivers/acpi/dptf/dptf_pch_fivr.c
+++ b/drivers/acpi/dptf/dptf_pch_fivr.c
@@ -141,11 +141,9 @@ static int pch_fivr_add(struct platform_device *pdev)
 	return 0;
 }
 
-static int pch_fivr_remove(struct platform_device *pdev)
+static void pch_fivr_remove(struct platform_device *pdev)
 {
 	sysfs_remove_group(&pdev->dev.kobj, &pch_fivr_attribute_group);
-
-	return 0;
 }
 
 static const struct acpi_device_id pch_fivr_device_ids[] = {
@@ -159,7 +157,7 @@ MODULE_DEVICE_TABLE(acpi, pch_fivr_device_ids);
 
 static struct platform_driver pch_fivr_driver = {
 	.probe = pch_fivr_add,
-	.remove = pch_fivr_remove,
+	.remove_new = pch_fivr_remove,
 	.driver = {
 		.name = "dptf_pch_fivr",
 		.acpi_match_table = pch_fivr_device_ids,
diff --git a/drivers/acpi/dptf/dptf_power.c b/drivers/acpi/dptf/dptf_power.c
index 86561eda939f..b8187babbbbb 100644
--- a/drivers/acpi/dptf/dptf_power.c
+++ b/drivers/acpi/dptf/dptf_power.c
@@ -209,7 +209,7 @@ static int dptf_power_add(struct platform_device *pdev)
 	return 0;
 }
 
-static int dptf_power_remove(struct platform_device *pdev)
+static void dptf_power_remove(struct platform_device *pdev)
 {
 	struct acpi_device *acpi_dev = platform_get_drvdata(pdev);
 
@@ -221,8 +221,6 @@ static int dptf_power_remove(struct platform_device *pdev)
 		sysfs_remove_group(&pdev->dev.kobj, &dptf_battery_attribute_group);
 	else
 		sysfs_remove_group(&pdev->dev.kobj, &dptf_power_attribute_group);
-
-	return 0;
 }
 
 static const struct acpi_device_id int3407_device_ids[] = {
@@ -242,7 +240,7 @@ MODULE_DEVICE_TABLE(acpi, int3407_device_ids);
 
 static struct platform_driver dptf_power_driver = {
 	.probe = dptf_power_add,
-	.remove = dptf_power_remove,
+	.remove_new = dptf_power_remove,
 	.driver = {
 		.name = "dptf_power",
 		.acpi_match_table = int3407_device_ids,
-- 
2.43.0


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

* [PATCH 4/7] ACPI: GED: Convert to platform remove callback returning void
  2024-02-22 18:52 ` Uwe Kleine-König
                   ` (3 preceding siblings ...)
  (?)
@ 2024-02-22 18:52 ` Uwe Kleine-König
  -1 siblings, 0 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2024-02-22 18:52 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Len Brown, linux-acpi, 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/acpi/evged.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/evged.c b/drivers/acpi/evged.c
index fe6b6792c8bb..11778c93254b 100644
--- a/drivers/acpi/evged.c
+++ b/drivers/acpi/evged.c
@@ -173,10 +173,9 @@ static void ged_shutdown(struct platform_device *pdev)
 	}
 }
 
-static int ged_remove(struct platform_device *pdev)
+static void ged_remove(struct platform_device *pdev)
 {
 	ged_shutdown(pdev);
-	return 0;
 }
 
 static const struct acpi_device_id ged_acpi_ids[] = {
@@ -186,7 +185,7 @@ static const struct acpi_device_id ged_acpi_ids[] = {
 
 static struct platform_driver ged_driver = {
 	.probe = ged_probe,
-	.remove = ged_remove,
+	.remove_new = ged_remove,
 	.shutdown = ged_shutdown,
 	.driver = {
 		.name = MODULE_NAME,
-- 
2.43.0


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

* [PATCH 5/7] ACPI: fan: Convert to platform remove callback returning void
  2024-02-22 18:52 ` Uwe Kleine-König
                   ` (4 preceding siblings ...)
  (?)
@ 2024-02-22 18:52 ` Uwe Kleine-König
  -1 siblings, 0 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2024-02-22 18:52 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Len Brown, linux-acpi, 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/acpi/fan_core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/fan_core.c b/drivers/acpi/fan_core.c
index 9dccbae9e8ea..ff72e4ef8738 100644
--- a/drivers/acpi/fan_core.c
+++ b/drivers/acpi/fan_core.c
@@ -387,7 +387,7 @@ static int acpi_fan_probe(struct platform_device *pdev)
 	return result;
 }
 
-static int acpi_fan_remove(struct platform_device *pdev)
+static void acpi_fan_remove(struct platform_device *pdev)
 {
 	struct acpi_fan *fan = platform_get_drvdata(pdev);
 
@@ -399,8 +399,6 @@ static int acpi_fan_remove(struct platform_device *pdev)
 	sysfs_remove_link(&pdev->dev.kobj, "thermal_cooling");
 	sysfs_remove_link(&fan->cdev->device.kobj, "device");
 	thermal_cooling_device_unregister(fan->cdev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -446,7 +444,7 @@ static const struct dev_pm_ops acpi_fan_pm = {
 
 static struct platform_driver acpi_fan_driver = {
 	.probe = acpi_fan_probe,
-	.remove = acpi_fan_remove,
+	.remove_new = acpi_fan_remove,
 	.driver = {
 		.name = "acpi-fan",
 		.acpi_match_table = fan_device_ids,
-- 
2.43.0


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

* [PATCH 6/7] ACPI: pfr_telemetry: Convert to platform remove callback returning void
  2024-02-22 18:52 ` Uwe Kleine-König
                   ` (5 preceding siblings ...)
  (?)
@ 2024-02-22 18:52 ` Uwe Kleine-König
  -1 siblings, 0 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2024-02-22 18:52 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Len Brown, linux-acpi, 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/acpi/pfr_telemetry.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/pfr_telemetry.c b/drivers/acpi/pfr_telemetry.c
index 843f678ade0c..998264a7333d 100644
--- a/drivers/acpi/pfr_telemetry.c
+++ b/drivers/acpi/pfr_telemetry.c
@@ -347,13 +347,11 @@ static const struct file_operations acpi_pfrt_log_fops = {
 	.llseek		= noop_llseek,
 };
 
-static int acpi_pfrt_log_remove(struct platform_device *pdev)
+static void acpi_pfrt_log_remove(struct platform_device *pdev)
 {
 	struct pfrt_log_device *pfrt_log_dev = platform_get_drvdata(pdev);
 
 	misc_deregister(&pfrt_log_dev->miscdev);
-
-	return 0;
 }
 
 static void pfrt_log_put_idx(void *data)
@@ -427,7 +425,7 @@ static struct platform_driver acpi_pfrt_log_driver = {
 		.acpi_match_table = acpi_pfrt_log_ids,
 	},
 	.probe = acpi_pfrt_log_probe,
-	.remove = acpi_pfrt_log_remove,
+	.remove_new = acpi_pfrt_log_remove,
 };
 module_platform_driver(acpi_pfrt_log_driver);
 
-- 
2.43.0


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

* [PATCH 7/7] ACPI: pfr_update: Convert to platform remove callback returning void
  2024-02-22 18:52 ` Uwe Kleine-König
                   ` (6 preceding siblings ...)
  (?)
@ 2024-02-22 18:52 ` Uwe Kleine-König
  -1 siblings, 0 replies; 14+ messages in thread
From: Uwe Kleine-König @ 2024-02-22 18:52 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Len Brown, linux-acpi, 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/acpi/pfr_update.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/pfr_update.c b/drivers/acpi/pfr_update.c
index 98267f163e2b..8b2910995fc1 100644
--- a/drivers/acpi/pfr_update.c
+++ b/drivers/acpi/pfr_update.c
@@ -489,13 +489,11 @@ static const struct file_operations acpi_pfru_fops = {
 	.llseek		= noop_llseek,
 };
 
-static int acpi_pfru_remove(struct platform_device *pdev)
+static void acpi_pfru_remove(struct platform_device *pdev)
 {
 	struct pfru_device *pfru_dev = platform_get_drvdata(pdev);
 
 	misc_deregister(&pfru_dev->miscdev);
-
-	return 0;
 }
 
 static void pfru_put_idx(void *data)
@@ -567,7 +565,7 @@ static struct platform_driver acpi_pfru_driver = {
 		.acpi_match_table = acpi_pfru_ids,
 	},
 	.probe = acpi_pfru_probe,
-	.remove = acpi_pfru_remove,
+	.remove_new = acpi_pfru_remove,
 };
 module_platform_driver(acpi_pfru_driver);
 
-- 
2.43.0


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

* Re: [PATCH 2/7] ACPI: AGDI: Convert to platform remove callback returning void
  2024-02-22 18:52   ` Uwe Kleine-König
@ 2024-02-24 11:28     ` Hanjun Guo
  -1 siblings, 0 replies; 14+ messages in thread
From: Hanjun Guo @ 2024-02-24 11:28 UTC (permalink / raw)
  To: Uwe Kleine-König, Rafael J. Wysocki
  Cc: Lorenzo Pieralisi, Sudeep Holla, Len Brown, linux-acpi,
	linux-arm-kernel, kernel

On 2024/2/23 2:52, Uwe Kleine-König 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>
> ---
>   drivers/acpi/arm64/agdi.c | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)

Looks good to me,

Acked-by: Hanjun Guo <guohanjun@huawei.com>

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

* Re: [PATCH 2/7] ACPI: AGDI: Convert to platform remove callback returning void
@ 2024-02-24 11:28     ` Hanjun Guo
  0 siblings, 0 replies; 14+ messages in thread
From: Hanjun Guo @ 2024-02-24 11:28 UTC (permalink / raw)
  To: Uwe Kleine-König, Rafael J. Wysocki
  Cc: Lorenzo Pieralisi, Sudeep Holla, Len Brown, linux-acpi,
	linux-arm-kernel, kernel

On 2024/2/23 2:52, Uwe Kleine-König 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>
> ---
>   drivers/acpi/arm64/agdi.c | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)

Looks good to me,

Acked-by: Hanjun Guo <guohanjun@huawei.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 0/7] ACPI: Convert to platform remove callback returning void
  2024-02-22 18:52 ` Uwe Kleine-König
@ 2024-02-27 16:40   ` Rafael J. Wysocki
  -1 siblings, 0 replies; 14+ messages in thread
From: Rafael J. Wysocki @ 2024-02-27 16:40 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Rafael J. Wysocki, Len Brown, linux-acpi, kernel,
	Lorenzo Pieralisi, Hanjun Guo, Sudeep Holla, linux-arm-kernel

On Thu, Feb 22, 2024 at 7:52 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> Hello,
>
> this series converts all drivers below drivers/acpi to struct
> platform_driver::remove_new(). See commit 5c5a7680e67b ("platform:
> Provide a remove callback that returns no value") for an extended
> explanation and the eventual goal.
>
> All conversations are trivial, because their .remove() callbacks
> returned zero unconditionally.
>
> There are no interdependencies between these patches, so they could be
> picked up individually. But I'd hope that they get picked up all
> together by Rafael.
>
> There is another driver that needs adaption (as of today's next), but
> this is discussed separately, see
> https://lore.kernel.org/linux-acpi/CAJZ5v0jJX-6L9f_TLe-cv2MNnZVK7au=drbKCn-tEWEagY-9ZA@mail.gmail.com
> .
>
> Best regards
> Uwe
>
> Uwe Kleine-König (7):
>   ACPI: TAD: Convert to platform remove callback returning void
>   ACPI: AGDI: Convert to platform remove callback returning void
>   ACPI: DPTF: Convert to platform remove callback returning void
>   ACPI: GED: Convert to platform remove callback returning void
>   ACPI: fan: Convert to platform remove callback returning void
>   ACPI: pfr_telemetry: Convert to platform remove callback returning void
>   ACPI: pfr_update: Convert to platform remove callback returning void
>
>  drivers/acpi/acpi_tad.c           | 5 ++---
>  drivers/acpi/arm64/agdi.c         | 8 +++-----
>  drivers/acpi/dptf/dptf_pch_fivr.c | 6 ++----
>  drivers/acpi/dptf/dptf_power.c    | 6 ++----
>  drivers/acpi/evged.c              | 5 ++---
>  drivers/acpi/fan_core.c           | 6 ++----
>  drivers/acpi/pfr_telemetry.c      | 6 ++----
>  drivers/acpi/pfr_update.c         | 6 ++----
>  8 files changed, 17 insertions(+), 31 deletions(-)
>
> base-commit: 4893c639cc3659cefaa675bf1e59f4e7571afb5c
> --

The whole series has been applied as 6.9 material, thanks!

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

* Re: [PATCH 0/7] ACPI: Convert to platform remove callback returning void
@ 2024-02-27 16:40   ` Rafael J. Wysocki
  0 siblings, 0 replies; 14+ messages in thread
From: Rafael J. Wysocki @ 2024-02-27 16:40 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Rafael J. Wysocki, Len Brown, linux-acpi, kernel,
	Lorenzo Pieralisi, Hanjun Guo, Sudeep Holla, linux-arm-kernel

On Thu, Feb 22, 2024 at 7:52 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> Hello,
>
> this series converts all drivers below drivers/acpi to struct
> platform_driver::remove_new(). See commit 5c5a7680e67b ("platform:
> Provide a remove callback that returns no value") for an extended
> explanation and the eventual goal.
>
> All conversations are trivial, because their .remove() callbacks
> returned zero unconditionally.
>
> There are no interdependencies between these patches, so they could be
> picked up individually. But I'd hope that they get picked up all
> together by Rafael.
>
> There is another driver that needs adaption (as of today's next), but
> this is discussed separately, see
> https://lore.kernel.org/linux-acpi/CAJZ5v0jJX-6L9f_TLe-cv2MNnZVK7au=drbKCn-tEWEagY-9ZA@mail.gmail.com
> .
>
> Best regards
> Uwe
>
> Uwe Kleine-König (7):
>   ACPI: TAD: Convert to platform remove callback returning void
>   ACPI: AGDI: Convert to platform remove callback returning void
>   ACPI: DPTF: Convert to platform remove callback returning void
>   ACPI: GED: Convert to platform remove callback returning void
>   ACPI: fan: Convert to platform remove callback returning void
>   ACPI: pfr_telemetry: Convert to platform remove callback returning void
>   ACPI: pfr_update: Convert to platform remove callback returning void
>
>  drivers/acpi/acpi_tad.c           | 5 ++---
>  drivers/acpi/arm64/agdi.c         | 8 +++-----
>  drivers/acpi/dptf/dptf_pch_fivr.c | 6 ++----
>  drivers/acpi/dptf/dptf_power.c    | 6 ++----
>  drivers/acpi/evged.c              | 5 ++---
>  drivers/acpi/fan_core.c           | 6 ++----
>  drivers/acpi/pfr_telemetry.c      | 6 ++----
>  drivers/acpi/pfr_update.c         | 6 ++----
>  8 files changed, 17 insertions(+), 31 deletions(-)
>
> base-commit: 4893c639cc3659cefaa675bf1e59f4e7571afb5c
> --

The whole series has been applied as 6.9 material, thanks!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2024-02-27 16:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-22 18:52 [PATCH 0/7] ACPI: Convert to platform remove callback returning void Uwe Kleine-König
2024-02-22 18:52 ` Uwe Kleine-König
2024-02-22 18:52 ` [PATCH 1/7] ACPI: TAD: " Uwe Kleine-König
2024-02-22 18:52 ` [PATCH 2/7] ACPI: AGDI: " Uwe Kleine-König
2024-02-22 18:52   ` Uwe Kleine-König
2024-02-24 11:28   ` Hanjun Guo
2024-02-24 11:28     ` Hanjun Guo
2024-02-22 18:52 ` [PATCH 3/7] ACPI: DPTF: " Uwe Kleine-König
2024-02-22 18:52 ` [PATCH 4/7] ACPI: GED: " Uwe Kleine-König
2024-02-22 18:52 ` [PATCH 5/7] ACPI: fan: " Uwe Kleine-König
2024-02-22 18:52 ` [PATCH 6/7] ACPI: pfr_telemetry: " Uwe Kleine-König
2024-02-22 18:52 ` [PATCH 7/7] ACPI: pfr_update: " Uwe Kleine-König
2024-02-27 16:40 ` [PATCH 0/7] ACPI: " Rafael J. Wysocki
2024-02-27 16:40   ` Rafael J. Wysocki

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.