From patchwork Wed Mar 13 20:06:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Henriques X-Patchwork-Id: 227346 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 38C0F2C00A1 for ; Thu, 14 Mar 2013 07:06:39 +1100 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1UFrwR-00054Y-Si; Wed, 13 Mar 2013 20:06:27 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1UFrwO-000544-MD for kernel-team@lists.ubuntu.com; Wed, 13 Mar 2013 20:06:24 +0000 Received: from bl15-242-192.dsl.telepac.pt ([188.80.242.192] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1UFrwO-000767-Dl; Wed, 13 Mar 2013 20:06:24 +0000 From: Luis Henriques To: Sarah Sharp Subject: [ 3.5.y.z extended stable ] Patch "USB: Prepare for refactoring by adding extra udev checks." has been added to staging queue Date: Wed, 13 Mar 2013 20:06:23 +0000 Message-Id: <1363205183-9006-1-git-send-email-luis.henriques@canonical.com> X-Mailer: git-send-email 1.8.1.2 X-Extended-Stable: 3.5 Cc: kernel-team@lists.ubuntu.com, Alan Stern X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com This is a note to let you know that I have just added a patch titled USB: Prepare for refactoring by adding extra udev checks. to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree which can be found at: http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue If you, or anyone else, feels it should not be added to this tree, please reply to this email. For more information about the 3.5.y.z tree, see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable Thanks. -Luis ------ From 4f31727adcc17b9fffaf28dd702deba9df314f7d Mon Sep 17 00:00:00 2001 From: Sarah Sharp Date: Thu, 7 Mar 2013 16:24:22 -0800 Subject: [PATCH] USB: Prepare for refactoring by adding extra udev checks. commit 2d4fa940f99663c82ba55b2244638833b388e4e2 upstream. [This is upstream commit 2d4fa940f99663c82ba55b2244638833b388e4e2. It needs to be backported to kernels as old as 3.2, because it fixes the buggy commit 9dbcaec830cd97f44a0b91b315844e0d7144746b "USB: Handle warm reset failure on empty port."] The next patch will refactor the hub port code to rip out the recursive call to hub_port_reset on a failed hot reset. In preparation for that, make sure all code paths can deal with being called with a NULL udev. The usb_device will not be valid if warm reset was issued because a port transitioned to the Inactive or Compliance Mode on a device connect. This patch should have no effect on current behavior. Signed-off-by: Sarah Sharp Acked-by: Alan Stern Signed-off-by: Luis Henriques --- drivers/usb/core/hub.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) -- 1.8.1.2 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 1a2cd0e..15b6be0 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -2475,6 +2475,9 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, return -ENOTCONN; if ((portstatus & USB_PORT_STAT_ENABLE)) { + if (!udev) + return 0; + if (hub_is_wusb(hub)) udev->speed = USB_SPEED_WIRELESS; else if (hub_is_superspeed(hub->hdev)) @@ -2518,13 +2521,15 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1, struct usb_hcd *hcd; /* TRSTRCY = 10 ms; plus some extra */ msleep(10 + 40); - update_devnum(udev, 0); - hcd = bus_to_hcd(udev->bus); - /* The xHC may think the device is already reset, - * so ignore the status. - */ - if (hcd->driver->reset_device) - hcd->driver->reset_device(hcd, udev); + if (udev) { + update_devnum(udev, 0); + hcd = bus_to_hcd(udev->bus); + /* The xHC may think the device is already + * reset, so ignore the status. + */ + if (hcd->driver->reset_device) + hcd->driver->reset_device(hcd, udev); + } } /* FALL THROUGH */ case -ENOTCONN: @@ -2538,7 +2543,7 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1, clear_port_feature(hub->hdev, port1, USB_PORT_FEAT_C_PORT_LINK_STATE); } - if (!warm) + if (!warm && udev) usb_set_device_state(udev, *status ? USB_STATE_NOTATTACHED : USB_STATE_DEFAULT);