* [PATCH] mach-pxa: sharpsl_pm: simplify conditional
@ 2010-10-29 21:31 ` Nicolas Kaiser
0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Kaiser @ 2010-10-29 21:31 UTC (permalink / raw)
To: Eric Miao; +Cc: Russell King, linux-arm-kernel, linux-kernel
Simplify: ((a && b) || !a) => (b || !a)
Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
arch/arm/mach-pxa/sharpsl_pm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index 8fed027..d08763c 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -619,7 +619,7 @@ static void corgi_goto_sleep(unsigned long alarm_time, unsigned int alarm_enable
PEDR = 0xffffffff; /* clear it */
sharpsl_pm.flags &= ~SHARPSL_ALARM_ACTIVE;
- if ((sharpsl_pm.charge_mode == CHRG_ON) && ((alarm_enable && ((alarm_time - RCNR) > (SHARPSL_BATCHK_TIME_SUSPEND + 30))) || !alarm_enable)) {
+ if ((sharpsl_pm.charge_mode == CHRG_ON) && (((alarm_time - RCNR) > (SHARPSL_BATCHK_TIME_SUSPEND + 30)) || !alarm_enable)) {
RTSR &= RTSR_ALE;
RTAR = RCNR + SHARPSL_BATCHK_TIME_SUSPEND;
dev_dbg(sharpsl_pm.dev, "Charging alarm at: %08x\n", RTAR);
--
1.7.2.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] mach-pxa: sharpsl_pm: simplify conditional
@ 2010-10-29 21:31 ` Nicolas Kaiser
0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Kaiser @ 2010-10-29 21:31 UTC (permalink / raw)
To: linux-arm-kernel
Simplify: ((a && b) || !a) => (b || !a)
Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
arch/arm/mach-pxa/sharpsl_pm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index 8fed027..d08763c 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -619,7 +619,7 @@ static void corgi_goto_sleep(unsigned long alarm_time, unsigned int alarm_enable
PEDR = 0xffffffff; /* clear it */
sharpsl_pm.flags &= ~SHARPSL_ALARM_ACTIVE;
- if ((sharpsl_pm.charge_mode == CHRG_ON) && ((alarm_enable && ((alarm_time - RCNR) > (SHARPSL_BATCHK_TIME_SUSPEND + 30))) || !alarm_enable)) {
+ if ((sharpsl_pm.charge_mode == CHRG_ON) && (((alarm_time - RCNR) > (SHARPSL_BATCHK_TIME_SUSPEND + 30)) || !alarm_enable)) {
RTSR &= RTSR_ALE;
RTAR = RCNR + SHARPSL_BATCHK_TIME_SUSPEND;
dev_dbg(sharpsl_pm.dev, "Charging alarm at: %08x\n", RTAR);
--
1.7.2.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mach-pxa: sharpsl_pm: simplify conditional
2010-10-29 21:31 ` Nicolas Kaiser
@ 2010-11-02 13:15 ` Eric Miao
-1 siblings, 0 replies; 4+ messages in thread
From: Eric Miao @ 2010-11-02 13:15 UTC (permalink / raw)
To: Nicolas Kaiser; +Cc: Russell King, linux-arm-kernel, linux-kernel
On Sat, Oct 30, 2010 at 5:31 AM, Nicolas Kaiser <nikai@nikai.net> wrote:
> Simplify: ((a && b) || !a) => (b || !a)
>
This is a good catch, I believe this could be generally applied elsewhere
in the kernel. The problem with sharpsl_pm is that it's currently a mess
and needs a fully rewrite, I'd really like this issue being addressed in that
rewritten version.
> Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
> ---
> arch/arm/mach-pxa/sharpsl_pm.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
> index 8fed027..d08763c 100644
> --- a/arch/arm/mach-pxa/sharpsl_pm.c
> +++ b/arch/arm/mach-pxa/sharpsl_pm.c
> @@ -619,7 +619,7 @@ static void corgi_goto_sleep(unsigned long alarm_time, unsigned int alarm_enable
> PEDR = 0xffffffff; /* clear it */
>
> sharpsl_pm.flags &= ~SHARPSL_ALARM_ACTIVE;
> - if ((sharpsl_pm.charge_mode == CHRG_ON) && ((alarm_enable && ((alarm_time - RCNR) > (SHARPSL_BATCHK_TIME_SUSPEND + 30))) || !alarm_enable)) {
> + if ((sharpsl_pm.charge_mode == CHRG_ON) && (((alarm_time - RCNR) > (SHARPSL_BATCHK_TIME_SUSPEND + 30)) || !alarm_enable)) {
> RTSR &= RTSR_ALE;
> RTAR = RCNR + SHARPSL_BATCHK_TIME_SUSPEND;
> dev_dbg(sharpsl_pm.dev, "Charging alarm at: %08x\n", RTAR);
> --
> 1.7.2.2
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] mach-pxa: sharpsl_pm: simplify conditional
@ 2010-11-02 13:15 ` Eric Miao
0 siblings, 0 replies; 4+ messages in thread
From: Eric Miao @ 2010-11-02 13:15 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Oct 30, 2010 at 5:31 AM, Nicolas Kaiser <nikai@nikai.net> wrote:
> Simplify: ((a && b) || !a) => (b || !a)
>
This is a good catch, I believe this could be generally applied elsewhere
in the kernel. The problem with sharpsl_pm is that it's currently a mess
and needs a fully rewrite, I'd really like this issue being addressed in that
rewritten version.
> Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
> ---
> ?arch/arm/mach-pxa/sharpsl_pm.c | ? ?2 +-
> ?1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
> index 8fed027..d08763c 100644
> --- a/arch/arm/mach-pxa/sharpsl_pm.c
> +++ b/arch/arm/mach-pxa/sharpsl_pm.c
> @@ -619,7 +619,7 @@ static void corgi_goto_sleep(unsigned long alarm_time, unsigned int alarm_enable
> ? ? ? ?PEDR = 0xffffffff; /* clear it */
>
> ? ? ? ?sharpsl_pm.flags &= ~SHARPSL_ALARM_ACTIVE;
> - ? ? ? if ((sharpsl_pm.charge_mode == CHRG_ON) && ((alarm_enable && ((alarm_time - RCNR) > (SHARPSL_BATCHK_TIME_SUSPEND + 30))) || !alarm_enable)) {
> + ? ? ? if ((sharpsl_pm.charge_mode == CHRG_ON) && (((alarm_time - RCNR) > (SHARPSL_BATCHK_TIME_SUSPEND + 30)) || !alarm_enable)) {
> ? ? ? ? ? ? ? ?RTSR &= RTSR_ALE;
> ? ? ? ? ? ? ? ?RTAR = RCNR + SHARPSL_BATCHK_TIME_SUSPEND;
> ? ? ? ? ? ? ? ?dev_dbg(sharpsl_pm.dev, "Charging alarm at: %08x\n", RTAR);
> --
> 1.7.2.2
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-11-02 13:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-29 21:31 [PATCH] mach-pxa: sharpsl_pm: simplify conditional Nicolas Kaiser
2010-10-29 21:31 ` Nicolas Kaiser
2010-11-02 13:15 ` Eric Miao
2010-11-02 13:15 ` Eric Miao
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.