Skip to content

Commit

Permalink
cpufreq: remove redundant CPUFREQ_INCOMPATIBLE notifier event
Browse files Browse the repository at this point in the history
What's being done from CPUFREQ_INCOMPATIBLE, can also be done with
CPUFREQ_ADJUST. There is nothing special with CPUFREQ_INCOMPATIBLE
notifier.

Kill CPUFREQ_INCOMPATIBLE and fix its usage sites.

This also updates the numbering of notifier events to remove holes.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Viresh Kumar authored and Rafael J. Wysocki committed Sep 1, 2015
1 parent 1453863 commit 6bfb7c7
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 19 deletions.
7 changes: 2 additions & 5 deletions Documentation/cpu-freq/core.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,13 @@ transition notifiers.
----------------------------

These are notified when a new policy is intended to be set. Each
CPUFreq policy notifier is called three times for a policy transition:
CPUFreq policy notifier is called twice for a policy transition:

1.) During CPUFREQ_ADJUST all CPUFreq notifiers may change the limit if
they see a need for this - may it be thermal considerations or
hardware limitations.

2.) During CPUFREQ_INCOMPATIBLE only changes may be done in order to avoid
hardware failure.

3.) And during CPUFREQ_NOTIFY all notifiers are informed of the new policy
2.) And during CPUFREQ_NOTIFY all notifiers are informed of the new policy
- if two hardware drivers failed to agree on a new policy before this
stage, the incompatible hardware shall be shut down, and the user
informed of this.
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/processor_perflib.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb,
if (ignore_ppc)
return 0;

if (event != CPUFREQ_INCOMPATIBLE)
if (event != CPUFREQ_ADJUST)
return 0;

mutex_lock(&performance_mutex);
Expand Down
4 changes: 0 additions & 4 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -2206,10 +2206,6 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
CPUFREQ_ADJUST, new_policy);

/* adjust if necessary - hardware incompatibility*/
blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
CPUFREQ_INCOMPATIBLE, new_policy);

/*
* verify the cpu speed can be set within this limit, which might be
* different to the first one
Expand Down
4 changes: 2 additions & 2 deletions drivers/cpufreq/ppc_cbe_cpufreq_pmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ static int pmi_notifier(struct notifier_block *nb,
struct cpufreq_frequency_table *cbe_freqs;
u8 node;

/* Should this really be called for CPUFREQ_ADJUST, CPUFREQ_INCOMPATIBLE
* and CPUFREQ_NOTIFY policy events?)
/* Should this really be called for CPUFREQ_ADJUST and CPUFREQ_NOTIFY
* policy events?)
*/
if (event == CPUFREQ_START)
return 0;
Expand Down
1 change: 0 additions & 1 deletion drivers/video/fbdev/pxafb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,6 @@ pxafb_freq_policy(struct notifier_block *nb, unsigned long val, void *data)

switch (val) {
case CPUFREQ_ADJUST:
case CPUFREQ_INCOMPATIBLE:
pr_debug("min dma period: %d ps, "
"new clock %d kHz\n", pxafb_display_dma_period(var),
policy->max);
Expand Down
1 change: 0 additions & 1 deletion drivers/video/fbdev/sa1100fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,6 @@ sa1100fb_freq_policy(struct notifier_block *nb, unsigned long val,

switch (val) {
case CPUFREQ_ADJUST:
case CPUFREQ_INCOMPATIBLE:
dev_dbg(fbi->dev, "min dma period: %d ps, "
"new clock %d kHz\n", sa1100fb_min_dma_period(fbi),
policy->max);
Expand Down
9 changes: 4 additions & 5 deletions include/linux/cpufreq.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,10 @@ static inline void cpufreq_resume(void) {}

/* Policy Notifiers */
#define CPUFREQ_ADJUST (0)
#define CPUFREQ_INCOMPATIBLE (1)
#define CPUFREQ_NOTIFY (2)
#define CPUFREQ_START (3)
#define CPUFREQ_CREATE_POLICY (4)
#define CPUFREQ_REMOVE_POLICY (5)
#define CPUFREQ_NOTIFY (1)
#define CPUFREQ_START (2)
#define CPUFREQ_CREATE_POLICY (3)
#define CPUFREQ_REMOVE_POLICY (4)

#ifdef CONFIG_CPU_FREQ
int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
Expand Down

0 comments on commit 6bfb7c7

Please sign in to comment.