Re: [PATCH 1/3] usb: musb: fix pm_runtime mismatches

From: Felipe Contreras
Date: Thu Dec 15 2011 - 20:00:00 EST


On Fri, Dec 16, 2011 at 1:22 AM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, 16 Dec 2011, Felipe Contreras wrote:
>
>> Properly call pm_runtime_put() afer pm_runttime_get() on errors.
>>
>> Untested.
>>
>> Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
>> ---
>> Âdrivers/usb/musb/musb_gadget.c | Â Â1 +
>> Âdrivers/usb/musb/omap2430.c  Â|  Â1 +
>> Â2 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
>> index 922148f..95bfd2d 100644
>> --- a/drivers/usb/musb/musb_gadget.c
>> +++ b/drivers/usb/musb/musb_gadget.c
>> @@ -1960,6 +1960,7 @@ static int musb_gadget_start(struct usb_gadget *g,
>> Âerr2:
>> Â Â Â if (!is_otg_enabled(musb))
>> Â Â Â Â Â Â Â musb_stop(musb);
>> + Â Â pm_runtime_put(musb->controller);
>> Âerr0:
>> Â Â Â return retval;
>> Â}
>> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
>> index ba85f27..4edfb91 100644
>> --- a/drivers/usb/musb/omap2430.c
>> +++ b/drivers/usb/musb/omap2430.c
>> @@ -385,6 +385,7 @@ static void omap2430_musb_disable(struct musb *musb)
>>
>> Âstatic int omap2430_musb_exit(struct musb *musb)
>> Â{
>> + Â Â pm_runtime_put(musb->controller);
>> Â Â Â del_timer_sync(&musb_idle_timer);
>>
>> Â Â Â omap2430_low_level_exit(musb);
>
> Should these calls be pm_runtime_put_sync() instead of
> pm_runtime_put()?

I don't see why... The thing failed, it's not going to be used any
more so better let PM deactivate the device. But now that you point
this out, pm_runtime_put() on omap2430_musb_exit() should probably go
at the end of the function, after all the actions have been done.

I'll send an updated patch tomorrow, if there are no further comments.

Cheers.

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