public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Bjørn Mork" <bjorn@mork.no>
To: Alex Courbot <acourbot@nvidia.com>
Cc: USB list <linux-usb@vger.kernel.org>,
	"linux-pm\@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Alexandre Courbot <gnurou@gmail.com>
Subject: Re: usb_wwan_write() called while device still being resumed
Date: Thu, 14 Feb 2013 18:41:27 +0100	[thread overview]
Message-ID: <87ehgivlmg.fsf@nemi.mork.no> (raw)
In-Reply-To: <511CBCE8.9070204@nvidia.com> (Alex Courbot's message of "Thu, 14 Feb 2013 19:31:04 +0900")

Alex Courbot <acourbot@nvidia.com> writes:

> The board features a USB GSM modem using the usb_wwan module. Once in
> a while, when the system resumes from LP0, a NET_RX softirq will be
> triggered while the modem is still being resumed, calling
> usb_wwan_write(). This will cause usb_autopm_get_interface_async()
> inside usb_wwan_write() to fail because the runtime PM disable_depth
> is still equal to 1 since device_resume() has not completed yet. As a
> result, the modem just stops working.

I believe the usb_autopm_get_interface_async() failing is OK in this
case, but that should not cause the modem to stop working.

Wonder if this patch solves the problem? :

From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>
Date: Thu, 14 Feb 2013 18:34:48 +0100
Subject: [PATCH] USB: usb_wwan: clear port busy state on error
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reported-by: Alex Courbot <acourbot@nvidia.com>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
 drivers/usb/serial/usb_wwan.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index 01c94aa..44e106d 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -230,8 +230,10 @@ int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
 			usb_pipeendpoint(this_urb->pipe), i);
 
 		err = usb_autopm_get_interface_async(port->serial->interface);
-		if (err < 0)
+		if (err < 0) {
+			clear_bit(i, &portdata->out_busy);
 			break;
+		}
 
 		/* send the data */
 		memcpy(this_urb->transfer_buffer, buf, todo);
-- 
1.7.10.4


  reply	other threads:[~2013-02-14 17:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-14 10:31 usb_wwan_write() called while device still being resumed Alex Courbot
2013-02-14 17:41 ` Bjørn Mork [this message]
2013-02-15  8:23   ` Alex Courbot
2013-02-15 11:05     ` Bjørn Mork
2013-02-17 11:31       ` Alex Courbot
2013-02-18  3:20       ` Alex Courbot

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=87ehgivlmg.fsf@nemi.mork.no \
    --to=bjorn@mork.no \
    --cc=acourbot@nvidia.com \
    --cc=gnurou@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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