Vitaly Wool <vitalywool@xxxxxxxxx> writes: > On Wed, Dec 8, 2010 at 11:40 PM, Kevin Hilman > <khilman@xxxxxxxxxxxxxxxxxxx> wrote: >> @@ -120,8 +133,9 @@ static void omap2_enter_full_retention(void) >>        Âgoto no_sleep; >> >>    Â/* Block console output in case it is on one of the OMAP UARTs */ >> -    if (try_acquire_console_sem()) >> -        goto no_sleep; >> +    if (!is_suspending()) >> +        if (try_acquire_console_sem()) >> +            goto no_sleep; > > Combine into one if? personal preference I guess. I prefer it nested. > > <snip> > >>    Âomap_uart_prepare_idle(0); >>    Âomap_uart_prepare_idle(1); >> @@ -136,7 +150,8 @@ static void omap2_enter_full_retention(void) >>    Âomap_uart_resume_idle(1); >>    Âomap_uart_resume_idle(0); >> >> -    release_console_sem(); >> +    if (!is_suspending()) >> +        release_console_sem(); >> >> Âno_sleep: >>    Âif (omap2_pm_debug) { >> @@ -284,6 +299,12 @@ out: >>    Âlocal_irq_enable(); >> Â} >> >> +static int omap2_pm_begin(suspend_state_t state) >> +{ >> +    suspend_state = state; >> +    return 0; >> +} > > Do you really need a return code here? yes, this function prototype is defined by the driver model, not by me. >> Âstatic int omap2_pm_prepare(void) >> Â{ >>    Â/* We cannot sleep in idle until we have resumed */ >> @@ -333,10 +354,18 @@ static void omap2_pm_finish(void) >>    Âenable_hlt(); >> Â} >> >> +static void omap2_pm_end(void) >> +{ >> +    suspend_state = PM_SUSPEND_ON; >> +    return; >> +} > > Redundant return. but harmless >> + >> Âstatic struct platform_suspend_ops omap_pm_ops = { >> +    .begin     Â= omap2_pm_begin, >>    Â.prepare    Â= omap2_pm_prepare, >>    Â.enter     Â= omap2_pm_enter, >>    Â.finish     = omap2_pm_finish, >> +    .end      Â= omap2_pm_end, >>    Â.valid     Â= suspend_valid_only_mem, >> Â}; >> >> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c >> index 0ec8a04..648b8c5 100644 >> --- a/arch/arm/mach-omap2/pm34xx.c >> +++ b/arch/arm/mach-omap2/pm34xx.c >> @@ -50,6 +50,19 @@ >> Â#include "sdrc.h" >> Â#include "control.h" >> >> +#ifdef CONFIG_SUSPEND >> +static suspend_state_t suspend_state = PM_SUSPEND_ON; >> +static inline bool is_suspending(void) >> +{ >> +    return (suspend_state != PM_SUSPEND_ON); >> +} >> +#else >> +static inline bool is_suspending(void) >> +{ >> +    return false; >> +} >> +#endif >> + >> Â/* Scratchpad offsets */ >> Â#define OMAP343X_TABLE_ADDRESS_OFFSET   0xc4 >> Â#define OMAP343X_TABLE_VALUE_OFFSET    0xc0 >> @@ -387,10 +400,11 @@ void omap_sram_idle(void) >>    Â} >> >>    Â/* Block console output in case it is on one of the OMAP UARTs */ >> -    if (per_next_state < PWRDM_POWER_ON || >> -      core_next_state < PWRDM_POWER_ON) >> -        if (try_acquire_console_sem()) >> -            goto console_still_active; >> +    if (!is_suspending()) >> +        if (per_next_state < PWRDM_POWER_ON || >> +          core_next_state < PWRDM_POWER_ON) >> +            if (try_acquire_console_sem()) >> +                goto console_still_active; > > Oh well, 3 nested ifs... again, personal preference. Kevin -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html