Skip to content

Commit 1e4230f

Browse files
committed
Merge branches 'pm-sleep', 'pm-cpuidle', 'pm-cpufreq', 'pm-devfreq' and 'pm-avs'
* pm-sleep: ACPI: PM: s2idle: Rework ACPI events synchronization ACPI: EC: Rework flushing of pending work * pm-cpuidle: cpuidle: minor Kconfig help text fixes cpuidle: Drop disabled field from struct cpuidle_state cpuidle: Fix Kconfig indentation * pm-cpufreq: cpufreq: Fix Kconfig indentation * pm-devfreq: PM / devfreq: Add missing locking while setting suspend_freq * pm-avs: power: avs: Fix Kconfig indentation
6 parents 36a8015 + 024aa87 + 4d30d4a + cde10f8 + e1e047a + 2a0efc7 commit 1e4230f

File tree

13 files changed

+82
-77
lines changed

13 files changed

+82
-77
lines changed

arch/sh/kernel/cpu/shmobile/cpuidle.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static struct cpuidle_driver cpuidle_driver = {
6767
.enter = cpuidle_sleep_enter,
6868
.name = "C2",
6969
.desc = "SuperH Sleep Mode [SF]",
70-
.disabled = true,
70+
.flags = CPUIDLE_FLAG_UNUSABLE,
7171
},
7272
{
7373
.exit_latency = 2300,
@@ -76,7 +76,7 @@ static struct cpuidle_driver cpuidle_driver = {
7676
.enter = cpuidle_sleep_enter,
7777
.name = "C3",
7878
.desc = "SuperH Mobile Standby Mode [SF]",
79-
.disabled = true,
79+
.flags = CPUIDLE_FLAG_UNUSABLE,
8080
},
8181
},
8282
.safe_state_index = 0,
@@ -86,10 +86,10 @@ static struct cpuidle_driver cpuidle_driver = {
8686
int __init sh_mobile_setup_cpuidle(void)
8787
{
8888
if (sh_mobile_sleep_supported & SUSP_SH_SF)
89-
cpuidle_driver.states[1].disabled = false;
89+
cpuidle_driver.states[1].flags = CPUIDLE_FLAG_NONE;
9090

9191
if (sh_mobile_sleep_supported & SUSP_SH_STANDBY)
92-
cpuidle_driver.states[2].disabled = false;
92+
cpuidle_driver.states[2].flags = CPUIDLE_FLAG_NONE;
9393

9494
return cpuidle_register(&cpuidle_driver, NULL);
9595
}

drivers/acpi/ec.c

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -533,26 +533,10 @@ static void acpi_ec_enable_event(struct acpi_ec *ec)
533533
}
534534

535535
#ifdef CONFIG_PM_SLEEP
536-
static bool acpi_ec_query_flushed(struct acpi_ec *ec)
536+
static void __acpi_ec_flush_work(void)
537537
{
538-
bool flushed;
539-
unsigned long flags;
540-
541-
spin_lock_irqsave(&ec->lock, flags);
542-
flushed = !ec->nr_pending_queries;
543-
spin_unlock_irqrestore(&ec->lock, flags);
544-
return flushed;
545-
}
546-
547-
static void __acpi_ec_flush_event(struct acpi_ec *ec)
548-
{
549-
/*
550-
* When ec_freeze_events is true, we need to flush events in
551-
* the proper position before entering the noirq stage.
552-
*/
553-
wait_event(ec->wait, acpi_ec_query_flushed(ec));
554-
if (ec_query_wq)
555-
flush_workqueue(ec_query_wq);
538+
flush_scheduled_work(); /* flush ec->work */
539+
flush_workqueue(ec_query_wq); /* flush queries */
556540
}
557541

558542
static void acpi_ec_disable_event(struct acpi_ec *ec)
@@ -562,15 +546,21 @@ static void acpi_ec_disable_event(struct acpi_ec *ec)
562546
spin_lock_irqsave(&ec->lock, flags);
563547
__acpi_ec_disable_event(ec);
564548
spin_unlock_irqrestore(&ec->lock, flags);
565-
__acpi_ec_flush_event(ec);
549+
550+
/*
551+
* When ec_freeze_events is true, we need to flush events in
552+
* the proper position before entering the noirq stage.
553+
*/
554+
__acpi_ec_flush_work();
566555
}
567556

568557
void acpi_ec_flush_work(void)
569558
{
570-
if (first_ec)
571-
__acpi_ec_flush_event(first_ec);
559+
/* Without ec_query_wq there is nothing to flush. */
560+
if (!ec_query_wq)
561+
return;
572562

573-
flush_scheduled_work();
563+
__acpi_ec_flush_work();
574564
}
575565
#endif /* CONFIG_PM_SLEEP */
576566

drivers/acpi/sleep.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,16 @@ static int acpi_s2idle_prepare_late(void)
977977
return 0;
978978
}
979979

980+
static void acpi_s2idle_sync(void)
981+
{
982+
/*
983+
* The EC driver uses the system workqueue and an additional special
984+
* one, so those need to be flushed too.
985+
*/
986+
acpi_ec_flush_work();
987+
acpi_os_wait_events_complete(); /* synchronize Notify handling */
988+
}
989+
980990
static void acpi_s2idle_wake(void)
981991
{
982992
/*
@@ -1001,13 +1011,8 @@ static void acpi_s2idle_wake(void)
10011011
* should be missed by canceling the wakeup here.
10021012
*/
10031013
pm_system_cancel_wakeup();
1004-
/*
1005-
* The EC driver uses the system workqueue and an additional
1006-
* special one, so those need to be flushed too.
1007-
*/
1008-
acpi_os_wait_events_complete(); /* synchronize EC GPE processing */
1009-
acpi_ec_flush_work();
1010-
acpi_os_wait_events_complete(); /* synchronize Notify handling */
1014+
1015+
acpi_s2idle_sync();
10111016

10121017
rearm_wake_irq(acpi_sci_irq);
10131018
}
@@ -1024,6 +1029,13 @@ static void acpi_s2idle_restore_early(void)
10241029

10251030
static void acpi_s2idle_restore(void)
10261031
{
1032+
/*
1033+
* Drain pending events before restoring the working-state configuration
1034+
* of GPEs.
1035+
*/
1036+
acpi_os_wait_events_complete(); /* synchronize GPE processing */
1037+
acpi_s2idle_sync();
1038+
10271039
s2idle_wakeup = false;
10281040

10291041
acpi_enable_all_runtime_gpes();

drivers/cpufreq/Kconfig.powerpc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ config PPC_PASEMI_CPUFREQ
4848
PWRficient processors.
4949

5050
config POWERNV_CPUFREQ
51-
tristate "CPU frequency scaling for IBM POWERNV platform"
52-
depends on PPC_POWERNV
53-
default y
54-
help
51+
tristate "CPU frequency scaling for IBM POWERNV platform"
52+
depends on PPC_POWERNV
53+
default y
54+
help
5555
This adds support for CPU frequency switching on IBM POWERNV
5656
platform

drivers/cpufreq/Kconfig.x86

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
#
55

66
config X86_INTEL_PSTATE
7-
bool "Intel P state control"
8-
depends on X86
9-
select ACPI_PROCESSOR if ACPI
10-
select ACPI_CPPC_LIB if X86_64 && ACPI && SCHED_MC_PRIO
11-
help
12-
This driver provides a P state for Intel core processors.
7+
bool "Intel P state control"
8+
depends on X86
9+
select ACPI_PROCESSOR if ACPI
10+
select ACPI_CPPC_LIB if X86_64 && ACPI && SCHED_MC_PRIO
11+
help
12+
This driver provides a P state for Intel core processors.
1313
The driver implements an internal governor and will become
14-
the scaling driver and governor for Sandy bridge processors.
14+
the scaling driver and governor for Sandy bridge processors.
1515

1616
When this driver is enabled it will become the preferred
17-
scaling driver for Sandy bridge processors.
17+
scaling driver for Sandy bridge processors.
1818

1919
If in doubt, say N.
2020

drivers/cpuidle/Kconfig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ config CPU_IDLE
1616
if CPU_IDLE
1717

1818
config CPU_IDLE_MULTIPLE_DRIVERS
19-
bool
19+
bool
2020

2121
config CPU_IDLE_GOV_LADDER
2222
bool "Ladder governor (for periodic timer tick)"
@@ -63,13 +63,13 @@ source "drivers/cpuidle/Kconfig.powerpc"
6363
endmenu
6464

6565
config HALTPOLL_CPUIDLE
66-
tristate "Halt poll cpuidle driver"
67-
depends on X86 && KVM_GUEST
68-
default y
69-
help
70-
This option enables halt poll cpuidle driver, which allows to poll
71-
before halting in the guest (more efficient than polling in the
72-
host via halt_poll_ns for some scenarios).
66+
tristate "Halt poll cpuidle driver"
67+
depends on X86 && KVM_GUEST
68+
default y
69+
help
70+
This option enables halt poll cpuidle driver, which allows to poll
71+
before halting in the guest (more efficient than polling in the
72+
host via halt_poll_ns for some scenarios).
7373

7474
endif
7575

drivers/cpuidle/Kconfig.arm

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
# ARM CPU Idle drivers
44
#
55
config ARM_CPUIDLE
6-
bool "Generic ARM/ARM64 CPU idle Driver"
7-
select DT_IDLE_STATES
6+
bool "Generic ARM/ARM64 CPU idle Driver"
7+
select DT_IDLE_STATES
88
select CPU_IDLE_MULTIPLE_DRIVERS
9-
help
10-
Select this to enable generic cpuidle driver for ARM.
11-
It provides a generic idle driver whose idle states are configured
12-
at run-time through DT nodes. The CPUidle suspend backend is
13-
initialized by calling the CPU operations init idle hook
14-
provided by architecture code.
9+
help
10+
Select this to enable generic cpuidle driver for ARM.
11+
It provides a generic idle driver whose idle states are configured
12+
at run-time through DT nodes. The CPUidle suspend backend is
13+
initialized by calling the CPU operations init idle hook
14+
provided by architecture code.
1515

1616
config ARM_PSCI_CPUIDLE
1717
bool "PSCI CPU idle Driver"
@@ -65,21 +65,21 @@ config ARM_U8500_CPUIDLE
6565
bool "Cpu Idle Driver for the ST-E u8500 processors"
6666
depends on ARCH_U8500 && !ARM64
6767
help
68-
Select this to enable cpuidle for ST-E u8500 processors
68+
Select this to enable cpuidle for ST-E u8500 processors.
6969

7070
config ARM_AT91_CPUIDLE
7171
bool "Cpu Idle Driver for the AT91 processors"
7272
default y
7373
depends on ARCH_AT91 && !ARM64
7474
help
75-
Select this to enable cpuidle for AT91 processors
75+
Select this to enable cpuidle for AT91 processors.
7676

7777
config ARM_EXYNOS_CPUIDLE
7878
bool "Cpu Idle Driver for the Exynos processors"
7979
depends on ARCH_EXYNOS && !ARM64
8080
select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP
8181
help
82-
Select this to enable cpuidle for Exynos processors
82+
Select this to enable cpuidle for Exynos processors.
8383

8484
config ARM_MVEBU_V7_CPUIDLE
8585
bool "CPU Idle Driver for mvebu v7 family processors"

drivers/cpuidle/cpuidle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ static int __cpuidle_register_device(struct cpuidle_device *dev)
572572
return -EINVAL;
573573

574574
for (i = 0; i < drv->state_count; i++)
575-
if (drv->states[i].disabled)
575+
if (drv->states[i].flags & CPUIDLE_FLAG_UNUSABLE)
576576
dev->states_usage[i].disable |= CPUIDLE_STATE_DISABLED_BY_DRIVER;
577577

578578
per_cpu(cpuidle_devices, dev->cpu) = dev;

drivers/cpuidle/poll_state.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ void cpuidle_poll_state_init(struct cpuidle_driver *drv)
5353
state->target_residency_ns = 0;
5454
state->power_usage = -1;
5555
state->enter = poll_idle;
56-
state->disabled = false;
5756
state->flags = CPUIDLE_FLAG_POLLING;
5857
}
5958
EXPORT_SYMBOL_GPL(cpuidle_poll_state_init);

drivers/devfreq/devfreq.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,9 @@ int devfreq_suspend_device(struct devfreq *devfreq)
921921
}
922922

923923
if (devfreq->suspend_freq) {
924+
mutex_lock(&devfreq->lock);
924925
ret = devfreq_set_target(devfreq, devfreq->suspend_freq, 0);
926+
mutex_unlock(&devfreq->lock);
925927
if (ret)
926928
return ret;
927929
}
@@ -949,7 +951,9 @@ int devfreq_resume_device(struct devfreq *devfreq)
949951
return 0;
950952

951953
if (devfreq->resume_freq) {
954+
mutex_lock(&devfreq->lock);
952955
ret = devfreq_set_target(devfreq, devfreq->resume_freq, 0);
956+
mutex_unlock(&devfreq->lock);
953957
if (ret)
954958
return ret;
955959
}

0 commit comments

Comments
 (0)