Re: [PATCH 4/5] usb_wwan: error case of resume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

Oliver Neukum wrote:

From 38bb76b810ac1a45e6c8e71365d5959588d65dce Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oliver@xxxxxxxxxx>
Date: Thu, 10 Feb 2011 14:37:01 +0100
Subject: [PATCH 4/5] usb_wwan: error case of resume

If an error happens during resumption.
The remaining data has to be cleanly discarded and the pm
counters have to be adjusted.

Signed-off-by: Oliver Neukum <oneukum@xxxxxxx>
---
 drivers/usb/serial/usb_wwan.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index 84fe1b6..fe5e48e 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -664,6 +664,18 @@ int usb_wwan_suspend(struct usb_serial *serial, pm_message_t message)
 }
 EXPORT_SYMBOL(usb_wwan_suspend);
+static void unbusy_queued_urb(struct urb *urb, struct usb_wwan_port_private *portdata)
+{
+	int i;
+
+	for (i = 0; i < N_OUT_URB; i++) {
+		if (urb == portdata->out_urbs[i]) {
+			clear_bit(i, &portdata->out_busy);
+			break;
+		}
+	}
+}
+
 static void play_delayed(struct usb_serial_port *port)
 {
 	struct usb_wwan_intf_private *data;
@@ -675,8 +687,17 @@ static void play_delayed(struct usb_serial_port *port)
 	data = port->serial->private;
 	while ((urb = usb_get_from_anchor(&portdata->delayed))) {
 		err = usb_submit_urb(urb, GFP_ATOMIC);
-		if (!err)
+		if (!err) {
 			data->in_flight++;
+		} else {
+			/* we have to throw away the rest */
+			do {
+				unbusy_queued_urb(urb, portdata);
+				//extremely dirty

   Well, // comments are not allowed.

+				atomic_dec(&port->serial->interface->dev.power.usage_count);
+			} while ((urb = usb_get_from_anchor(&portdata->delayed)));

I don't think assignment inside *while* is good as well. Though checkpatch.pl doesn't complain in this case, usually it bitches about assignments inside *if*

+			break;
+		}
 	}
 }

   Well, I did ran the patch thru checkpatch.pl, here's the result:

[headless@wasted linux-2.6]$ scripts/checkpatch.pl patches/usb_wwan-error-case-of-resume.patch
WARNING: line over 80 characters
#23: FILE: drivers/usb/serial/usb_wwan.c:667:
+static void unbusy_queued_urb(struct urb *urb, struct usb_wwan_port_private *portdata)

ERROR: do not use C99 // comments
#49: FILE: drivers/usb/serial/usb_wwan.c:696:
+				//extremely dirty

WARNING: line over 80 characters
#50: FILE: drivers/usb/serial/usb_wwan.c:697:
+				atomic_dec(&port->serial->interface->dev.power.usage_count);

WARNING: line over 80 characters
#51: FILE: drivers/usb/serial/usb_wwan.c:698:
+			} while ((urb = usb_get_from_anchor(&portdata->delayed)));

total: 1 errors, 3 warnings, 36 lines checked

patches/usb_wwan-error-case-of-resume.patch has style problems, please review.
If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux