History

Merge tag 'pm-6.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fix from Rafael Wysocki: "Make the amd-pstate cpufreq driver take all of the possible combinations of the 'old' and 'new' status values correctly while changing the operation mode via sysfs (Wyes Karny)" * tag 'pm-6.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: amd-pstate: Fix amd_pstate mode switch

Linus Torvalds committed 3 years ago

Commit 4b992ea2 parents d0b85e7 4654e9f1 file · +8 −10Browse files

Unified · Split

drivers/cpufreq/amd-pstate.c+8−10
@@ -840,22 +840,20 @@ static int amd_pstate_update_status(const char *buf, size_t size) · 839 unmodified lines
840 840
841 switch(mode_idx) {841 switch(mode_idx) {
842 case AMD_PSTATE_DISABLE:842 case AMD_PSTATE_DISABLE:
843 if (!current_pstate_driver)843 if (current_pstate_driver) {
844 return -EINVAL;844 cpufreq_unregister_driver(current_pstate_driver);
845 if (cppc_state == AMD_PSTATE_ACTIVE)845 amd_pstate_driver_cleanup();
846 return -EBUSY;846 }
847 cpufreq_unregister_driver(current_pstate_driver);
848 amd_pstate_driver_cleanup();
849 break;847 break;
850 case AMD_PSTATE_PASSIVE:848 case AMD_PSTATE_PASSIVE:
851 if (current_pstate_driver) {849 if (current_pstate_driver) {
852 if (current_pstate_driver == &amd_pstate_driver)850 if (current_pstate_driver == &amd_pstate_driver)
853 return 0;851 return 0;
854 cpufreq_unregister_driver(current_pstate_driver);852 cpufreq_unregister_driver(current_pstate_driver);
855 cppc_state = AMD_PSTATE_PASSIVE;
856 current_pstate_driver = &amd_pstate_driver;
857 }853 }
858 854
855 current_pstate_driver = &amd_pstate_driver;
856 cppc_state = AMD_PSTATE_PASSIVE;
859 ret = cpufreq_register_driver(current_pstate_driver);857 ret = cpufreq_register_driver(current_pstate_driver);
860 break;858 break;
861 case AMD_PSTATE_ACTIVE:859 case AMD_PSTATE_ACTIVE:
@@ -863,10 +861,10 @@ static int amd_pstate_update_status(const char *buf, size_t size) · 1 unmodified line
863 if (current_pstate_driver == &amd_pstate_epp_driver)861 if (current_pstate_driver == &amd_pstate_epp_driver)
864 return 0;862 return 0;
865 cpufreq_unregister_driver(current_pstate_driver);863 cpufreq_unregister_driver(current_pstate_driver);
866 current_pstate_driver = &amd_pstate_epp_driver;
867 cppc_state = AMD_PSTATE_ACTIVE;
868 }864 }
869 865
866 current_pstate_driver = &amd_pstate_epp_driver;
867 cppc_state = AMD_PSTATE_ACTIVE;
870 ret = cpufreq_register_driver(current_pstate_driver);868 ret = cpufreq_register_driver(current_pstate_driver);
871 break;869 break;
872 default:870 default: