linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Li, Fei" <fei.li@intel.com>
To: "Lan, Tianyu" <tianyu.lan@intel.com>,
	"stern@rowland.harvard.edu" <stern@rowland.harvard.edu>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"sarah.a.sharp@linux.intel.com" <sarah.a.sharp@linux.intel.com>,
	"rjw@sisk.pl" <rjw@sisk.pl>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Liu, Chuansheng" <chuansheng.liu@intel.com>
Subject: RE: [PATCH 4/5] usb: call pm_runtime_put_sync in pm_runtime_get_sync failed case
Date: Thu, 28 Feb 2013 09:00:05 +0000	[thread overview]
Message-ID: <BEC9F67575FA1E429CA7CF5AE9BE3634407F48@SHSMSX102.ccr.corp.intel.com> (raw)
In-Reply-To: <512F1741.60202@intel.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2769 bytes --]

> -----Original Message-----
> From: Lan, Tianyu
> Sent: Thursday, February 28, 2013 4:37 PM
> To: Li, Fei; stern@rowland.harvard.edu
> Cc: gregkh@linuxfoundation.org; sarah.a.sharp@linux.intel.com; rjw@sisk.pl;
> linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org; Liu, Chuansheng
> Subject: Re: [PATCH 4/5] usb: call pm_runtime_put_sync in
> pm_runtime_get_sync failed case
> 
> On 2013年02月28日 15:57, Li Fei wrote:
> >
> > Even in failed case of pm_runtime_get_sync, the usage_count
> > is incremented. In order to keep the usage_count with correct
> > value and runtime power management to behave correctly, call
> > pm_runtime_put(_sync) in such case.
> 
> Hi Fei:
> 	It's not necessary. Because the did_runtime_put == true means the
> port's usage count has already been decreased during
> usb_port_suspend().So to keep usage count balance, we should increase
> the usage count in the usb_port_resume() whatever.

Thanks for your reminder.
Sorry, I forget to keep did_runtime_put as false in pm_runtime_get_sync
failed case. I'll submit patch V2 to update it.

> >
> > Signed-off-by Liu Chuansheng <chuansheng.liu@intel.com>
> > Signed-off-by: Li Fei <fei.li@intel.com>
> > ---
> >  drivers/usb/core/hub.c |    1 +
> >  1 files changed, 1 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> > index 5480352..b68493b 100644
> > --- a/drivers/usb/core/hub.c
> > +++ b/drivers/usb/core/hub.c
> > @@ -3152,6 +3152,7 @@ int usb_port_resume(struct usb_device *udev,
> pm_message_t msg)
> >  		if (status < 0) {
> >  			dev_dbg(&udev->dev, "can't resume usb port, status %d\n",
> >  					status);
> > +			pm_runtime_put_sync(&port_dev->dev);
> >  			return status;
> >  		}
> >  	}
> >
> Hi Alan:
> 	Further thinking, the device should be disconnected since the port
> can't be resumed and the device will not work normally. Something like
> following. Does this make sense?
> ---
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index d5d3de4..cf36b11 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -3170,6 +3170,7 @@ int usb_port_resume(struct usb_device *udev,
> pm_message_t msg)
>                 if (status < 0) {
>                         dev_dbg(&udev->dev, "can't resume usb port,
> status %d\n",
>                                         status);
> +                       hub_port_logical_disconnect(hub, port1);

IMHO, this can't keep the usage_count balance.

Best Regards,
Li Fei 

>                         return status;
>                 }
>         }
> 
> 
> --
> Best regards
> Tianyu Lan
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

  reply	other threads:[~2013-02-28  9:00 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-28  7:37 [PATCH 1/5] regmap: irq: call pm_runtime_put in pm_runtime_get_sync failed case Li Fei
2013-02-28  7:44 ` [PATCH 2/5] mmc: core: call pm_runtime_put_sync " Li Fei
2013-02-28  7:51   ` [PATCH 3/5] wl1251: " Li Fei
2013-02-28  7:57     ` [PATCH 4/5] usb: " Li Fei
2013-02-28  8:02       ` [PATCH 5/5] hwspinlock/core: call pm_runtime_put " Li Fei
2013-04-05  6:27         ` Ohad Ben-Cohen
2013-04-05 11:39           ` Rafael J. Wysocki
2013-04-05 11:42             ` Rafael J. Wysocki
2013-04-05 13:13               ` Li, Fei
2013-04-05 13:20         ` [PATCH 5/5 V2] " Li Fei
2013-04-05 14:46           ` Ohad Ben-Cohen
2013-02-28  8:37       ` [PATCH 4/5] usb: call pm_runtime_put_sync " Lan Tianyu
2013-02-28  9:00         ` Li, Fei [this message]
2013-02-28 15:14         ` Alan Stern
2013-02-28  9:06       ` [PATCH 4/5 V2] " Li Fei
2013-02-28 15:17         ` Alan Stern
2013-03-01  0:38           ` Liu, Chuansheng
2013-03-01  0:50             ` Rafael J. Wysocki
2013-03-01  0:59               ` Liu, Chuansheng
2013-03-01  2:18                 ` Rafael J. Wysocki
2013-03-01  2:07         ` Liu, Chuansheng
2013-03-01  2:22           ` Rafael J. Wysocki
2013-03-01  2:23             ` Liu, Chuansheng
2013-03-01  2:57         ` [PATCH 4/5 V3] usb: call pm_runtime_put_noidle " Li Fei
2013-03-01  2:59         ` Li Fei
2013-02-28  8:18     ` [PATCH 3/5] wl1251: call pm_runtime_put_sync " Luciano Coelho
2013-03-05  8:51     ` Luciano Coelho
2013-04-07 10:39   ` [PATCH 2/5] mmc: core: " Ohad Ben-Cohen
2013-04-08  1:36     ` Li, Fei
2013-04-08  1:36   ` [PATCH 2/5 V2] mmc: core: call pm_runtime_put_noidle " Li Fei
2013-04-08 12:48     ` Ohad Ben-Cohen
2013-04-12 18:15       ` Chris Ball
2013-03-01  6:55 ` [PATCH 1/5] regmap: irq: call pm_runtime_put " Mark Brown

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=BEC9F67575FA1E429CA7CF5AE9BE3634407F48@SHSMSX102.ccr.corp.intel.com \
    --to=fei.li@intel.com \
    --cc=chuansheng.liu@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=sarah.a.sharp@linux.intel.com \
    --cc=stern@rowland.harvard.edu \
    --cc=tianyu.lan@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).