Skip to contentSkip to conversation

mach-pxa: sharpsl_pm: simplify conditional

PATCH In review Nicolas Kaiser 2 participants 2 messages Oct 29, 2010 – Nov 2, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mach-pxa: sharpsl_pm: simplify conditional

Simplify: ((a && b) || !a) => (b || !a)

---
 arch/arm/mach-pxa/sharpsl_pm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/sharpsl_pm.c +1 -1
index 8fed027..d08763c 100644
@@ -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);
Signature · 1 line
1.7.2.2
#1 lore raw
Quoted 2 lines · Nicolas Kaiser

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.

Quoted 21 lines

---
?arch/arm/mach-pxa/sharpsl_pm.c | ? ?2 +-
?1 files changed, 1 insertions(+), 1 deletions(-)

arch/arm/mach-pxa/sharpsl_pm.c +0 -0
index 8fed027..d08763c 100644
@@ -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