Messages in this thread | | | Date | Tue, 27 Aug 2013 18:43:29 -0700 | From | Anton Vorontsov <> | Subject | Re: [RFC PATCH] pm: prevent suspend until power supply events are processed |
| |
On Fri, Aug 02, 2013 at 01:38:02PM -0700, Zoran Markovic wrote: > This patch, originally authored by Arve Hjonnevag and Todd Poynor, > prevents the system from entering suspend mode until the power > supply plug, unplug, or any other change of state event is fully > processed. This guarantees that the screen lights up and displays > the battery charging state. The implementation uses the power > supply wakeup_source object. > > Cc: Anton Vorontsov <anton@enomsg.org> > Cc: David Woodhouse <dwmw2@infradead.org> > Cc: Arve Hjonnevag <arve@android.com> > Cc: Todd Poynor <toddpoynor@google.com> > Cc: John Stultz <john.stultz@linaro.org> > Signed-off-by: Zoran Markovic <zoran.markovic@linaro.org> > --- ... > + kobject_uevent(&psy->dev->kobj, KOBJ_CHANGE); > + spin_lock_irqsave(&psy->changed_lock, flags); > + } > + /* dependent power supplies (e.g. battery) may have changed
Multi-line comments style issue...
> + * state as a result of this event, so poll again and hold > + * the wakeup_source until all events are processed. > + */ > + if (!psy->changed) > + pm_relax(psy->dev); ... > diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h > index 804b906..253d412 100644 > --- a/include/linux/power_supply.h > +++ b/include/linux/power_supply.h > @@ -194,6 +194,8 @@ struct power_supply { > /* private */ > struct device *dev; > struct work_struct changed_work; > + spinlock_t changed_lock;
#include <linux/spinlock.h> is needed.
I fixed it up and applied the patch, thanks a lot!
Anton
| |