Re: [RFC v2 2/2] usb: phy: Temporarily hold wakeupsource on charger connect and disconnect events

From: Felipe Balbi
Date: Tue Sep 02 2014 - 10:54:52 EST


Hi,

On Tue, Sep 02, 2014 at 05:19:18PM +0530, Kiran Kumar Raparthy wrote:
> From: Todd Poynor <toddpoynor@xxxxxxxxxx>
>
> usb: phy: Temporarily hold wakeupsource on charger connect and disconnect
> events
>
> Allow other parts of the system to react to the charger connect/disconnect
> event without allowing the system to suspend before the other parts can process
> the event. This wakeup_source times out after 2 seconds; if nobody else holds a
> wakeup_source by that time then the device can sleep.
>
> Cc: Felipe Balbi <balbi@xxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Cc: linux-usb@xxxxxxxxxxxxxxx
> Cc: Android Kernel Team <kernel-team@xxxxxxxxxxx>
> Cc: John Stultz <john.stultz@xxxxxxxxxx>
> Signed-off-by: Todd Poynor <toddpoynor@xxxxxxxxxx>
> [kiran: Added context to commit message
> wakeupsource handling implemented per PHY in phy core]
> Signed-off-by: Kiran Raparthy <kiran.kumar@xxxxxxxxxx>
> ---
> drivers/usb/phy/otg-wakeupsource.c | 2 +-
> drivers/usb/phy/phy.c | 10 ++++++++++
> include/linux/usb/phy.h | 3 +++
> 3 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/phy/otg-wakeupsource.c b/drivers/usb/phy/otg-wakeupsource.c
> index fca2010..70fa05e 100644
> --- a/drivers/usb/phy/otg-wakeupsource.c
> +++ b/drivers/usb/phy/otg-wakeupsource.c
> @@ -48,7 +48,7 @@ static void otgws_handle_event(struct usb_phy *otgws_xceiv, unsigned long event)
> case USB_EVENT_NONE:
> case USB_EVENT_ID:
> case USB_EVENT_CHARGER:
> - usb_drop_wsource(otgws_xceiv);
> + usb_temporary_hold_wsource(otgws_xceiv);

looks like this won't work. You're holding the lock even on
USB_EVEN_NONE. Why ?

--
balbi

Attachment: signature.asc
Description: Digital signature