Commit e07486a8 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Will Deacon

perf: hisilicon: Convert to platform remove callback returning void

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: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/33a8be0641b9447469fb7f6af0a10fb65efa97a3.1702648125.git.u.kleine-koenig@pengutronix.deSigned-off-by: default avatarWill Deacon <will@kernel.org>
parent 78da2a93
...@@ -341,7 +341,7 @@ static int hisi_cpa_pmu_probe(struct platform_device *pdev) ...@@ -341,7 +341,7 @@ static int hisi_cpa_pmu_probe(struct platform_device *pdev)
return ret; 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); struct hisi_pmu *cpa_pmu = platform_get_drvdata(pdev);
...@@ -349,7 +349,6 @@ static int hisi_cpa_pmu_remove(struct platform_device *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, cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_CPA_ONLINE,
&cpa_pmu->node); &cpa_pmu->node);
hisi_cpa_pmu_enable_pm(cpa_pmu); hisi_cpa_pmu_enable_pm(cpa_pmu);
return 0;
} }
static struct platform_driver hisi_cpa_pmu_driver = { static struct platform_driver hisi_cpa_pmu_driver = {
...@@ -359,7 +358,7 @@ static struct platform_driver hisi_cpa_pmu_driver = { ...@@ -359,7 +358,7 @@ static struct platform_driver hisi_cpa_pmu_driver = {
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
}, },
.probe = hisi_cpa_pmu_probe, .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) static int __init hisi_cpa_pmu_module_init(void)
......
...@@ -531,14 +531,13 @@ static int hisi_ddrc_pmu_probe(struct platform_device *pdev) ...@@ -531,14 +531,13 @@ static int hisi_ddrc_pmu_probe(struct platform_device *pdev)
return ret; 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); struct hisi_pmu *ddrc_pmu = platform_get_drvdata(pdev);
perf_pmu_unregister(&ddrc_pmu->pmu); perf_pmu_unregister(&ddrc_pmu->pmu);
cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_DDRC_ONLINE, cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_DDRC_ONLINE,
&ddrc_pmu->node); &ddrc_pmu->node);
return 0;
} }
static struct platform_driver hisi_ddrc_pmu_driver = { static struct platform_driver hisi_ddrc_pmu_driver = {
...@@ -548,7 +547,7 @@ static struct platform_driver hisi_ddrc_pmu_driver = { ...@@ -548,7 +547,7 @@ static struct platform_driver hisi_ddrc_pmu_driver = {
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
}, },
.probe = hisi_ddrc_pmu_probe, .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) static int __init hisi_ddrc_pmu_module_init(void)
......
...@@ -534,14 +534,13 @@ static int hisi_hha_pmu_probe(struct platform_device *pdev) ...@@ -534,14 +534,13 @@ static int hisi_hha_pmu_probe(struct platform_device *pdev)
return ret; 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); struct hisi_pmu *hha_pmu = platform_get_drvdata(pdev);
perf_pmu_unregister(&hha_pmu->pmu); perf_pmu_unregister(&hha_pmu->pmu);
cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_HHA_ONLINE, cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_HHA_ONLINE,
&hha_pmu->node); &hha_pmu->node);
return 0;
} }
static struct platform_driver hisi_hha_pmu_driver = { static struct platform_driver hisi_hha_pmu_driver = {
...@@ -551,7 +550,7 @@ static struct platform_driver hisi_hha_pmu_driver = { ...@@ -551,7 +550,7 @@ static struct platform_driver hisi_hha_pmu_driver = {
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
}, },
.probe = hisi_hha_pmu_probe, .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) static int __init hisi_hha_pmu_module_init(void)
......
...@@ -568,14 +568,13 @@ static int hisi_l3c_pmu_probe(struct platform_device *pdev) ...@@ -568,14 +568,13 @@ static int hisi_l3c_pmu_probe(struct platform_device *pdev)
return ret; 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); struct hisi_pmu *l3c_pmu = platform_get_drvdata(pdev);
perf_pmu_unregister(&l3c_pmu->pmu); perf_pmu_unregister(&l3c_pmu->pmu);
cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_L3_ONLINE, cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_L3_ONLINE,
&l3c_pmu->node); &l3c_pmu->node);
return 0;
} }
static struct platform_driver hisi_l3c_pmu_driver = { static struct platform_driver hisi_l3c_pmu_driver = {
...@@ -585,7 +584,7 @@ static struct platform_driver hisi_l3c_pmu_driver = { ...@@ -585,7 +584,7 @@ static struct platform_driver hisi_l3c_pmu_driver = {
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
}, },
.probe = hisi_l3c_pmu_probe, .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) static int __init hisi_l3c_pmu_module_init(void)
......
...@@ -514,14 +514,13 @@ static int hisi_pa_pmu_probe(struct platform_device *pdev) ...@@ -514,14 +514,13 @@ static int hisi_pa_pmu_probe(struct platform_device *pdev)
return ret; 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); struct hisi_pmu *pa_pmu = platform_get_drvdata(pdev);
perf_pmu_unregister(&pa_pmu->pmu); perf_pmu_unregister(&pa_pmu->pmu);
cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_PA_ONLINE, cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_PA_ONLINE,
&pa_pmu->node); &pa_pmu->node);
return 0;
} }
static const struct acpi_device_id hisi_pa_pmu_acpi_match[] = { static const struct acpi_device_id hisi_pa_pmu_acpi_match[] = {
...@@ -539,7 +538,7 @@ static struct platform_driver hisi_pa_pmu_driver = { ...@@ -539,7 +538,7 @@ static struct platform_driver hisi_pa_pmu_driver = {
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
}, },
.probe = hisi_pa_pmu_probe, .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) static int __init hisi_pa_pmu_module_init(void)
......
...@@ -460,14 +460,13 @@ static int hisi_sllc_pmu_probe(struct platform_device *pdev) ...@@ -460,14 +460,13 @@ static int hisi_sllc_pmu_probe(struct platform_device *pdev)
return ret; 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); struct hisi_pmu *sllc_pmu = platform_get_drvdata(pdev);
perf_pmu_unregister(&sllc_pmu->pmu); perf_pmu_unregister(&sllc_pmu->pmu);
cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_SLLC_ONLINE, cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_SLLC_ONLINE,
&sllc_pmu->node); &sllc_pmu->node);
return 0;
} }
static struct platform_driver hisi_sllc_pmu_driver = { static struct platform_driver hisi_sllc_pmu_driver = {
...@@ -477,7 +476,7 @@ static struct platform_driver hisi_sllc_pmu_driver = { ...@@ -477,7 +476,7 @@ static struct platform_driver hisi_sllc_pmu_driver = {
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
}, },
.probe = hisi_sllc_pmu_probe, .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) static int __init hisi_sllc_pmu_module_init(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment