Skip to content

Commit 0142647

Browse files
committed
avr32: Use generic idle loop
Also replace the idle poll enforcement by the generic functionality. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Rusty Russell <[email protected]> Cc: Paul McKenney <[email protected]> Cc: Peter Zijlstra <[email protected]> Reviewed-by: Cc: Srivatsa S. Bhat <[email protected]> Cc: Magnus Damm <[email protected]> Cc: Hans-Christian Egtvedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
1 parent 0087298 commit 0142647

File tree

5 files changed

+10
-44
lines changed

5 files changed

+10
-44
lines changed

arch/avr32/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ config AVR32
1010
select VIRT_TO_BUS
1111
select GENERIC_IRQ_PROBE
1212
select GENERIC_ATOMIC64
13+
select GENERIC_IDLE_LOOP
1314
select HARDIRQS_SW_RESEND
1415
select GENERIC_IRQ_SHOW
1516
select ARCH_HAVE_CUSTOM_GPIO_H

arch/avr32/kernel/process.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,9 @@ EXPORT_SYMBOL(pm_power_off);
3030
* This file handles the architecture-dependent parts of process handling..
3131
*/
3232

33-
void cpu_idle(void)
33+
void arch_cpu_idle(void)
3434
{
35-
/* endless idle loop with no priority at all */
36-
while (1) {
37-
tick_nohz_idle_enter();
38-
rcu_idle_enter();
39-
while (!need_resched())
40-
cpu_idle_sleep();
41-
rcu_idle_exit();
42-
tick_nohz_idle_exit();
43-
schedule_preempt_disabled();
44-
}
35+
cpu_enter_idle();
4536
}
4637

4738
void machine_halt(void)

arch/avr32/kernel/time.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/irq.h>
1313
#include <linux/kernel.h>
1414
#include <linux/time.h>
15+
#include <linux/cpu.h>
1516

1617
#include <asm/sysreg.h>
1718

@@ -87,13 +88,17 @@ static void comparator_mode(enum clock_event_mode mode,
8788
pr_debug("%s: start\n", evdev->name);
8889
/* FALLTHROUGH */
8990
case CLOCK_EVT_MODE_RESUME:
90-
cpu_disable_idle_sleep();
91+
/*
92+
* If we're using the COUNT and COMPARE registers we
93+
* need to force idle poll.
94+
*/
95+
cpu_idle_poll_ctrl(true);
9196
break;
9297
case CLOCK_EVT_MODE_UNUSED:
9398
case CLOCK_EVT_MODE_SHUTDOWN:
9499
sysreg_write(COMPARE, 0);
95100
pr_debug("%s: stop\n", evdev->name);
96-
cpu_enable_idle_sleep();
101+
cpu_idle_poll_ctrl(false);
97102
break;
98103
default:
99104
BUG();

arch/avr32/mach-at32ap/include/mach/pm.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,6 @@
2121
extern void cpu_enter_idle(void);
2222
extern void cpu_enter_standby(unsigned long sdramc_base);
2323

24-
extern bool disable_idle_sleep;
25-
26-
static inline void cpu_disable_idle_sleep(void)
27-
{
28-
disable_idle_sleep = true;
29-
}
30-
31-
static inline void cpu_enable_idle_sleep(void)
32-
{
33-
disable_idle_sleep = false;
34-
}
35-
36-
static inline void cpu_idle_sleep(void)
37-
{
38-
/*
39-
* If we're using the COUNT and COMPARE registers for
40-
* timekeeping, we can't use the IDLE state.
41-
*/
42-
if (disable_idle_sleep)
43-
cpu_relax();
44-
else
45-
cpu_enter_idle();
46-
}
47-
4824
void intc_set_suspend_handler(unsigned long offset);
4925
#endif
5026

arch/avr32/mach-at32ap/pm-at32ap700x.S

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@
1818
/* Same as 0xfff00000 but fits in a 21 bit signed immediate */
1919
#define PM_BASE -0x100000
2020

21-
.section .bss, "wa", @nobits
22-
.global disable_idle_sleep
23-
.type disable_idle_sleep, @object
24-
disable_idle_sleep:
25-
.int 4
26-
.size disable_idle_sleep, . - disable_idle_sleep
27-
2821
/* Keep this close to the irq handlers */
2922
.section .irq.text, "ax", @progbits
3023

0 commit comments

Comments
 (0)