]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
perf: hisilicon: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fri, 15 Dec 2023 13:59:13 +0000 (14:59 +0100)
committerWill Deacon <will@kernel.org>
Fri, 9 Feb 2024 15:59:30 +0000 (15:59 +0000)
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 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>
Link: https://lore.kernel.org/r/33a8be0641b9447469fb7f6af0a10fb65efa97a3.1702648125.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Will Deacon <will@kernel.org>
drivers/perf/hisilicon/hisi_uncore_cpa_pmu.c
drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c
drivers/perf/hisilicon/hisi_uncore_hha_pmu.c
drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c
drivers/perf/hisilicon/hisi_uncore_pa_pmu.c
drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c

index 40f1bc9f9b9136df89f2af54ad76fcaafb57b99f..0e923f94fa5b02943e35c60540d94918c107b495 100644 (file)
@@ -341,7 +341,7 @@ static int hisi_cpa_pmu_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int hisi_cpa_pmu_remove(struct platform_device *pdev)
+static void hisi_cpa_pmu_remove(struct platform_device *pdev)
 {
        struct hisi_pmu *cpa_pmu = platform_get_drvdata(pdev);
 
@@ -349,7 +349,6 @@ static int hisi_cpa_pmu_remove(struct platform_device *pdev)
        cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_CPA_ONLINE,
                                            &cpa_pmu->node);
        hisi_cpa_pmu_enable_pm(cpa_pmu);
-       return 0;
 }
 
 static struct platform_driver hisi_cpa_pmu_driver = {
@@ -359,7 +358,7 @@ static struct platform_driver hisi_cpa_pmu_driver = {
                .suppress_bind_attrs = true,
        },
        .probe = hisi_cpa_pmu_probe,
-       .remove = hisi_cpa_pmu_remove,
+       .remove_new = hisi_cpa_pmu_remove,
 };
 
 static int __init hisi_cpa_pmu_module_init(void)
index ffb039d05d07b2a03e07c5a99c0bc8a0c7e9c0a8..b804e37381134c3f5013f2c3bcc0b82a7086a2b8 100644 (file)
@@ -531,14 +531,13 @@ static int hisi_ddrc_pmu_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int hisi_ddrc_pmu_remove(struct platform_device *pdev)
+static void hisi_ddrc_pmu_remove(struct platform_device *pdev)
 {
        struct hisi_pmu *ddrc_pmu = platform_get_drvdata(pdev);
 
        perf_pmu_unregister(&ddrc_pmu->pmu);
        cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_DDRC_ONLINE,
                                            &ddrc_pmu->node);
-       return 0;
 }
 
 static struct platform_driver hisi_ddrc_pmu_driver = {
@@ -548,7 +547,7 @@ static struct platform_driver hisi_ddrc_pmu_driver = {
                .suppress_bind_attrs = true,
        },
        .probe = hisi_ddrc_pmu_probe,
-       .remove = hisi_ddrc_pmu_remove,
+       .remove_new = hisi_ddrc_pmu_remove,
 };
 
 static int __init hisi_ddrc_pmu_module_init(void)
index 15caf99e1eefe22f2cd6399258eeb73702bee790..21e69b1cdd4d20ae627adb70a9060268fce05c7f 100644 (file)
@@ -534,14 +534,13 @@ static int hisi_hha_pmu_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int hisi_hha_pmu_remove(struct platform_device *pdev)
+static void hisi_hha_pmu_remove(struct platform_device *pdev)
 {
        struct hisi_pmu *hha_pmu = platform_get_drvdata(pdev);
 
        perf_pmu_unregister(&hha_pmu->pmu);
        cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_HHA_ONLINE,
                                            &hha_pmu->node);
-       return 0;
 }
 
 static struct platform_driver hisi_hha_pmu_driver = {
@@ -551,7 +550,7 @@ static struct platform_driver hisi_hha_pmu_driver = {
                .suppress_bind_attrs = true,
        },
        .probe = hisi_hha_pmu_probe,
-       .remove = hisi_hha_pmu_remove,
+       .remove_new = hisi_hha_pmu_remove,
 };
 
 static int __init hisi_hha_pmu_module_init(void)
index 794dbcd19b7a7146b97c0f7f1b55e6b0e5f92ffd..51ba76871097a8623ff46d03d4f87c714b77f6c7 100644 (file)
@@ -568,14 +568,13 @@ static int hisi_l3c_pmu_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int hisi_l3c_pmu_remove(struct platform_device *pdev)
+static void hisi_l3c_pmu_remove(struct platform_device *pdev)
 {
        struct hisi_pmu *l3c_pmu = platform_get_drvdata(pdev);
 
        perf_pmu_unregister(&l3c_pmu->pmu);
        cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_L3_ONLINE,
                                            &l3c_pmu->node);
-       return 0;
 }
 
 static struct platform_driver hisi_l3c_pmu_driver = {
@@ -585,7 +584,7 @@ static struct platform_driver hisi_l3c_pmu_driver = {
                .suppress_bind_attrs = true,
        },
        .probe = hisi_l3c_pmu_probe,
-       .remove = hisi_l3c_pmu_remove,
+       .remove_new = hisi_l3c_pmu_remove,
 };
 
 static int __init hisi_l3c_pmu_module_init(void)
index 797cf201996a9646490ee52aee421dfa969dbc61..3cdb35c741f95a09fd5d91c4916a95eaba2d19f9 100644 (file)
@@ -514,14 +514,13 @@ static int hisi_pa_pmu_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int hisi_pa_pmu_remove(struct platform_device *pdev)
+static void hisi_pa_pmu_remove(struct platform_device *pdev)
 {
        struct hisi_pmu *pa_pmu = platform_get_drvdata(pdev);
 
        perf_pmu_unregister(&pa_pmu->pmu);
        cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_PA_ONLINE,
                                            &pa_pmu->node);
-       return 0;
 }
 
 static const struct acpi_device_id hisi_pa_pmu_acpi_match[] = {
@@ -539,7 +538,7 @@ static struct platform_driver hisi_pa_pmu_driver = {
                .suppress_bind_attrs = true,
        },
        .probe = hisi_pa_pmu_probe,
-       .remove = hisi_pa_pmu_remove,
+       .remove_new = hisi_pa_pmu_remove,
 };
 
 static int __init hisi_pa_pmu_module_init(void)
index e706ca5676764b9186a18cd982b29aec907c8231..765bbd61db26ee35c1eb9ea94fa1c74e7eb1bb46 100644 (file)
@@ -460,14 +460,13 @@ static int hisi_sllc_pmu_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int hisi_sllc_pmu_remove(struct platform_device *pdev)
+static void hisi_sllc_pmu_remove(struct platform_device *pdev)
 {
        struct hisi_pmu *sllc_pmu = platform_get_drvdata(pdev);
 
        perf_pmu_unregister(&sllc_pmu->pmu);
        cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_SLLC_ONLINE,
                                            &sllc_pmu->node);
-       return 0;
 }
 
 static struct platform_driver hisi_sllc_pmu_driver = {
@@ -477,7 +476,7 @@ static struct platform_driver hisi_sllc_pmu_driver = {
                .suppress_bind_attrs = true,
        },
        .probe = hisi_sllc_pmu_probe,
-       .remove = hisi_sllc_pmu_remove,
+       .remove_new = hisi_sllc_pmu_remove,
 };
 
 static int __init hisi_sllc_pmu_module_init(void)