Skip to content

Commit

Permalink
[CR] Fix cpufreq_driver compatibility with kernel lower than 3.14
Browse files Browse the repository at this point in the history
  • Loading branch information
cyring committed Feb 4, 2024
1 parent 6221891 commit 6e2eb90
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions aarch64/corefreqk.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,12 @@ static struct {
/*MANDATORY*/ .init = CoreFreqK_Policy_Init,
/*MANDATORY*/ .verify = CoreFreqK_Policy_Verify,
/*MANDATORY*/ .setpolicy = CoreFreqK_SetPolicy,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
.bios_limit= CoreFreqK_Bios_Limit,
.set_boost = CoreFreqK_SetBoost
#else
.bios_limit= CoreFreqK_Bios_Limit
#endif
},
.FreqGovernor = {
.name = "corefreq-policy",
Expand Down Expand Up @@ -3351,6 +3355,7 @@ void Policy_Aggregate_Turbo(void)
}
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) \
|| ((RHEL_MAJOR == 8) && (RHEL_MINOR > 3))
static int CoreFreqK_SetBoost(struct cpufreq_policy *policy, int state)
Expand All @@ -3368,6 +3373,7 @@ static int CoreFreqK_SetBoost(int state)
BITSET(BUS_LOCK, PUBLIC(RW(Proc))->OS.Signal, NTFY); /* Notify Daemon*/
return 0;
}
#endif /* 3.13.0 */

static ssize_t CoreFreqK_Show_SetSpeed(struct cpufreq_policy *policy,char *buf)
{
Expand Down
6 changes: 6 additions & 0 deletions x86_64/corefreqk.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,12 @@ static struct {
/*MANDATORY*/ .init = CoreFreqK_Policy_Init,
/*MANDATORY*/ .verify = CoreFreqK_Policy_Verify,
/*MANDATORY*/ .setpolicy = CoreFreqK_SetPolicy,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
.bios_limit= CoreFreqK_Bios_Limit,
.set_boost = CoreFreqK_SetBoost
#else
.bios_limit= CoreFreqK_Bios_Limit
#endif
},
.FreqGovernor = {
.name = "corefreq-policy",
Expand Down Expand Up @@ -20929,6 +20933,7 @@ void Policy_Aggregate_Turbo(void)
}
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) \
|| ((RHEL_MAJOR == 8) && (RHEL_MINOR > 3))
static int CoreFreqK_SetBoost(struct cpufreq_policy *policy, int state)
Expand All @@ -20946,6 +20951,7 @@ static int CoreFreqK_SetBoost(int state)
BITSET(BUS_LOCK, PUBLIC(RW(Proc))->OS.Signal, NTFY); /* Notify Daemon*/
return 0;
}
#endif /* 3.13.0 */

static ssize_t CoreFreqK_Show_SetSpeed(struct cpufreq_policy *policy,char *buf)
{
Expand Down

0 comments on commit 6e2eb90

Please sign in to comment.