All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: Vitaly Wool <vitalywool@gmail.com>
Cc: linux-omap@vger.kernel.org, Paul Walmsley <paul@pwsan.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3] OMAP2+: PM/serial: fix console semaphore acquire during suspend
Date: Thu, 09 Dec 2010 07:56:40 -0800	[thread overview]
Message-ID: <87zksfc53b.fsf@deeprootsystems.com> (raw)
In-Reply-To: <AANLkTi=9TBbuwr4uiQb6f_f=cLxK2NvWJDJYXwr2tTxu@mail.gmail.com> (Vitaly Wool's message of "Thu, 9 Dec 2010 00:51:29 +0100")

Vitaly Wool <vitalywool@gmail.com> writes:

> On Wed, Dec 8, 2010 at 11:40 PM, Kevin Hilman
> <khilman@deeprootsystems.com> 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: khilman@deeprootsystems.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3] OMAP2+: PM/serial: fix console semaphore acquire during suspend
Date: Thu, 09 Dec 2010 07:56:40 -0800	[thread overview]
Message-ID: <87zksfc53b.fsf@deeprootsystems.com> (raw)
In-Reply-To: <AANLkTi=9TBbuwr4uiQb6f_f=cLxK2NvWJDJYXwr2tTxu@mail.gmail.com> (Vitaly Wool's message of "Thu, 9 Dec 2010 00:51:29 +0100")

Vitaly Wool <vitalywool@gmail.com> writes:

> On Wed, Dec 8, 2010 at 11:40 PM, Kevin Hilman
> <khilman@deeprootsystems.com> 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

  reply	other threads:[~2010-12-09 15:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-08 22:40 [PATCH v3] OMAP2+: PM/serial: fix console semaphore acquire during suspend Kevin Hilman
2010-12-08 22:40 ` Kevin Hilman
2010-12-08 23:51 ` Vitaly Wool
2010-12-08 23:51   ` Vitaly Wool
2010-12-09 15:56   ` Kevin Hilman [this message]
2010-12-09 15:56     ` Kevin Hilman
2010-12-10  0:57     ` Tony Lindgren
2010-12-10  0:57       ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zksfc53b.fsf@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=paul@pwsan.com \
    --cc=vitalywool@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.