public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <mike@compulab.co.il>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: cbou@mail.ru, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] da9030_battery: fix race between event handler and monitor
Date: Thu, 14 May 2009 08:39:39 +0300	[thread overview]
Message-ID: <4A0BAE9B.1090401@compulab.co.il> (raw)
In-Reply-To: <20090513114046.6557fc0e.akpm@linux-foundation.org>



Andrew Morton wrote:
> On Tue, 12 May 2009 10:20:09 +0300
> Mike Rapoport <mike@compulab.co.il> wrote:
> 
>> Signed-off-by: Mike Rapoport <mike@compulab.co.il>
> 
> We seem to be missing a changelog.

My bad...

>> diff --git a/drivers/power/da9030_battery.c b/drivers/power/da9030_battery.c
>> index 1662bb0..3364198 100644
>> --- a/drivers/power/da9030_battery.c
>> +++ b/drivers/power/da9030_battery.c
>> @@ -22,8 +22,6 @@
>>  #include <linux/debugfs.h>
>>  #include <linux/seq_file.h>

[ snip ]

> What is this race? What are the user-visible effects when it occurs? 

There are cases when charging monitor and the event handler try to change the
charger state simultaneously. For instance, a charger is connected to the
system, there's the detection event and the event handler tries to enable
charging. It is possible that the periodic charging monitor runs at the same
time and it still thinks there's no external charger. So it tries to disable the
charging. As the result, even if the conditions necessary to charge the battery
hold, there will be no actual charging.

> How does the patch fix the race?

The patch changes the event handler so that instead of enabling/disabling the
charger immediately it would rather make the monitor run. The monitor code then
decides what should be the charger state.

> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

-- 
Sincerely yours,
Mike.


      reply	other threads:[~2009-05-14  5:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-12  7:20 [PATCH] da9030_battery: fix race between event handler and monitor Mike Rapoport
2009-05-13 18:40 ` Andrew Morton
2009-05-14  5:39   ` Mike Rapoport [this message]

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=4A0BAE9B.1090401@compulab.co.il \
    --to=mike@compulab.co.il \
    --cc=akpm@linux-foundation.org \
    --cc=cbou@mail.ru \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox