Skip to content

Commit dd329e1

Browse files
Uwe Kleine-Königrafaeljw
authored andcommitted
cpufreq: Make cpufreq_unregister_driver() return void
All but a few drivers ignore the return value of cpufreq_unregister_driver(). Those few that don't only call it after cpufreq_register_driver() succeeded, in which case the call doesn't fail. Make the function return no value and add a WARN_ON for the case that the function is called in an invalid situation (i.e. without a previous successful call to cpufreq_register_driver()). Signed-off-by: Uwe Kleine-König <[email protected]> Acked-by: Florian Fainelli <[email protected]> # brcmstb-avs-cpufreq.c Acked-by: Viresh Kumar <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent ced3960 commit dd329e1

File tree

8 files changed

+19
-16
lines changed

8 files changed

+19
-16
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ static void amd_pstate_driver_cleanup(void)
831831

832832
static int amd_pstate_update_status(const char *buf, size_t size)
833833
{
834-
int ret;
834+
int ret = 0;
835835
int mode_idx;
836836

837837
if (size > 7 || size < 6)
@@ -844,7 +844,7 @@ static int amd_pstate_update_status(const char *buf, size_t size)
844844
return -EINVAL;
845845
if (cppc_state == AMD_PSTATE_ACTIVE)
846846
return -EBUSY;
847-
ret = cpufreq_unregister_driver(current_pstate_driver);
847+
cpufreq_unregister_driver(current_pstate_driver);
848848
amd_pstate_driver_cleanup();
849849
break;
850850
case AMD_PSTATE_PASSIVE:

drivers/cpufreq/brcmstb-avs-cpufreq.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -751,10 +751,7 @@ static int brcm_avs_cpufreq_probe(struct platform_device *pdev)
751751

752752
static int brcm_avs_cpufreq_remove(struct platform_device *pdev)
753753
{
754-
int ret;
755-
756-
ret = cpufreq_unregister_driver(&brcm_avs_driver);
757-
WARN_ON(ret);
754+
cpufreq_unregister_driver(&brcm_avs_driver);
758755

759756
brcm_avs_prepare_uninit(pdev);
760757

drivers/cpufreq/cpufreq.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2904,12 +2904,12 @@ EXPORT_SYMBOL_GPL(cpufreq_register_driver);
29042904
* Returns zero if successful, and -EINVAL if the cpufreq_driver is
29052905
* currently not initialised.
29062906
*/
2907-
int cpufreq_unregister_driver(struct cpufreq_driver *driver)
2907+
void cpufreq_unregister_driver(struct cpufreq_driver *driver)
29082908
{
29092909
unsigned long flags;
29102910

2911-
if (!cpufreq_driver || (driver != cpufreq_driver))
2912-
return -EINVAL;
2911+
if (WARN_ON(!cpufreq_driver || (driver != cpufreq_driver)))
2912+
return;
29132913

29142914
pr_debug("unregistering driver %s\n", driver->name);
29152915

@@ -2926,8 +2926,6 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)
29262926

29272927
write_unlock_irqrestore(&cpufreq_driver_lock, flags);
29282928
cpus_read_unlock();
2929-
2930-
return 0;
29312929
}
29322930
EXPORT_SYMBOL_GPL(cpufreq_unregister_driver);
29332931

drivers/cpufreq/davinci-cpufreq.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ static int __exit davinci_cpufreq_remove(struct platform_device *pdev)
138138
if (cpufreq.asyncclk)
139139
clk_put(cpufreq.asyncclk);
140140

141-
return cpufreq_unregister_driver(&davinci_driver);
141+
cpufreq_unregister_driver(&davinci_driver);
142+
143+
return 0;
142144
}
143145

144146
static struct platform_driver davinci_cpufreq_driver = {

drivers/cpufreq/mediatek-cpufreq-hw.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,9 @@ static int mtk_cpufreq_hw_driver_probe(struct platform_device *pdev)
317317

318318
static int mtk_cpufreq_hw_driver_remove(struct platform_device *pdev)
319319
{
320-
return cpufreq_unregister_driver(&cpufreq_mtk_hw_driver);
320+
cpufreq_unregister_driver(&cpufreq_mtk_hw_driver);
321+
322+
return 0;
321323
}
322324

323325
static const struct of_device_id mtk_cpufreq_hw_match[] = {

drivers/cpufreq/omap-cpufreq.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,9 @@ static int omap_cpufreq_probe(struct platform_device *pdev)
184184

185185
static int omap_cpufreq_remove(struct platform_device *pdev)
186186
{
187-
return cpufreq_unregister_driver(&omap_driver);
187+
cpufreq_unregister_driver(&omap_driver);
188+
189+
return 0;
188190
}
189191

190192
static struct platform_driver omap_cpufreq_platdrv = {

drivers/cpufreq/qcom-cpufreq-hw.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,9 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
768768

769769
static int qcom_cpufreq_hw_driver_remove(struct platform_device *pdev)
770770
{
771-
return cpufreq_unregister_driver(&cpufreq_qcom_hw_driver);
771+
cpufreq_unregister_driver(&cpufreq_qcom_hw_driver);
772+
773+
return 0;
772774
}
773775

774776
static struct platform_driver qcom_cpufreq_hw_driver = {

include/linux/cpufreq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ struct cpufreq_driver {
448448
#define CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING BIT(6)
449449

450450
int cpufreq_register_driver(struct cpufreq_driver *driver_data);
451-
int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
451+
void cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
452452

453453
bool cpufreq_driver_test_flags(u16 flags);
454454
const char *cpufreq_get_current_driver(void);

0 commit comments

Comments
 (0)