Messages in this thread | | | Date | Thu, 14 May 2009 08:39:39 +0300 | From | Mike Rapoport <> | Subject | Re: [PATCH] da9030_battery: fix race between event handler and monitor |
| |
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.
| |