[G1 Android Development] farmatito:
@ezterry

Please apply the attached 2 patches to your 2.6.36 kernel

as at a first glance they seem to fix the "after wifi disconnect"

battery drain. More tests are needed.

kernel-2635/patches/028-smd_rpcrouter.patch

X-Git-Url: http://android.git.kernel.org/?p=kernel%2Fmsm.git;a=blobdiff_plain;f=arch%2Farm%2Fmach-msm%2Fsmd_rpcrouter.c;h=ed9745a9a93fbb82dacca2bae40b50810c6c89b7;hp=6e0cf27f2b57b37cee00fa5d00eba87d3f7c11df;hb=c59033d144ed5f0c552ccaa8e6ea50b4bc9e86ce;hpb=aae2d66b506a73a3fe9324bcad637bae2200e585

diff --git a/arch/arm/mach-msm/smd_rpcrouter.c b/arch/arm/mach-msm/smd_rpcrouter.c
index 6e0cf27..ed9745a 100644
--- a/arch/arm/mach-msm/smd_rpcrouter.c
+++ b/arch/arm/mach-msm/smd_rpcrouter.c
@@ -111,6 +111,7 @@ static void do_create_rpcrouter_pdev(struct work_struct *work);
static DECLARE_WORK(work_read_data, do_read_data);
static DECLARE_WORK(work_create_pdevs, do_create_pdevs);
static DECLARE_WORK(work_create_rpcrouter_pdev, do_create_rpcrouter_pdev);
+static atomic_t rpcrouter_pdev_created = ATOMIC_INIT(0);

#define RR_STATE_IDLE 0
#define RR_STATE_HEADER 1
@@ -517,7 +518,8 @@ static int process_control_msg(union rr_control_msg *msg, int len)

static void do_create_rpcrouter_pdev(struct work_struct *work)
{
- platform_device_register(&rpcrouter_pdev);
+ if (atomic_cmpxchg(&rpcrouter_pdev_created, 0, 1) == 0)
+ platform_device_register(&rpcrouter_pdev);
}

static void do_create_pdevs(struct work_struct *work)

kernel-2635/patches/031-irq_pm.patch

From e316f1df9040b762cb2a8a6c17234293689bc638 Mon Sep 17 00:00:00 2001
From: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Date: Sun, 19 Dec 2010 16:23:48 -0800
Subject: [PATCH] genirq: pm: Fix the enable ordering in resume

In suspend interrupts are disabled from 0 to NR_IRQ, in resume interrupts
should be enabled in reverse order.

Enabling parent or summary interrupts before enabling child interrupts
causes the handler of the child interrupt to run even before it is
enabled. Usually the genirq handler does the correct thing of masking
the interrupt and additionally marking the interrupt IRQ_PENDING if its
an edge triggered interrupt. However the nested handler
(handle_nested_irq()) simply ignores the interrupt causing a loss of it.

Not calling the action of an interrupt, especially if it marked wakeup,
causes the system to incorrectly go back to suspend immediately.

Change-Id: Ica30c10a975a4a7b41b97b4f21250dac80335b2b
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
---
kernel/irq/pm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c
index 1df62ef..bc56498 100644
--- a/kernel/irq/pm.c
+++ b/kernel/irq/pm.c
@@ -50,7 +50,7 @@ void resume_device_irqs(void)
struct irq_desc *desc;
int irq;

- for_each_irq_desc(irq, desc) {
+ for_each_irq_desc_reverse(irq, desc) {
unsigned long flags;

if (!(desc->status & IRQ_SUSPENDED))
--
1.7.4.1

PS: you have CONFIG_KSM=y in your configs is this really needed?

OTOH you have not set CONFIG_ARM_ERRATA_411920 and

CONFIG_ARM_UNWIND

For the brave testers attached also a compiled autokernel.

USE AT YOUR OWN RISK. NO WARRANTY.

Sources at https://github.com/ezterry/kernel-biff-testing

+ the above two patches.