diff mbox series

[1/3] cpufreq: Allow passing NULL as the argument for unregistering a driver

Message ID 20220325054228.5247-2-mario.limonciello@amd.com
State New
Headers show
Series Improve usability for amd-pstate | expand

Commit Message

Mario Limonciello March 25, 2022, 5:42 a.m. UTC
Currently the arguments passed to `cpufreq_unregister_driver` are matched
against the currently registered driver.

This means that the only way for a driver to be unregistered is if it's
module is unloaded.  Loosen that restriction to allow other kernel modules
to unregister a registered driver.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/cpufreq/cpufreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 80f535cc8a75..4711c17a89bb 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2885,10 +2885,10 @@  int cpufreq_unregister_driver(struct cpufreq_driver *driver)
 {
 	unsigned long flags;
 
-	if (!cpufreq_driver || (driver != cpufreq_driver))
+	if (!cpufreq_driver)
 		return -EINVAL;
 
-	pr_debug("unregistering driver %s\n", driver->name);
+	pr_debug("unregistering driver %s\n", cpufreq_driver->name);
 
 	/* Protect against concurrent cpu hotplug */
 	cpus_read_lock();