From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756021AbbEFHlK (ORCPT ); Wed, 6 May 2015 03:41:10 -0400 Received: from mga02.intel.com ([134.134.136.20]:43295 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755965AbbEFHk2 (ORCPT ); Wed, 6 May 2015 03:40:28 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,378,1427785200"; d="scan'208";a="705959406" From: Lu Baolu To: Greg Kroah-Hartman , Mathias Nyman , Alan Stern Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH v2 3/3] usb: xhci: remove stop device and ring doorbell in hub control and bus suspend Date: Wed, 6 May 2015 15:40:02 +0800 Message-Id: <1430898002-24748-4-git-send-email-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1430898002-24748-1-git-send-email-baolu.lu@linux.intel.com> References: <1430898002-24748-1-git-send-email-baolu.lu@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is no need to call xhci_stop_device() and xhci_ring_device() in hub control and bus suspend functions since all device suspend and resume have been notified through device_suspend/device_resume interfaces. Signed-off-by: Lu Baolu --- drivers/usb/host/xhci-hub.c | 47 --------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index a83e82e..f12e1b7 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -704,7 +704,6 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u32 temp, status; int retval = 0; __le32 __iomem **port_array; - int slot_id; struct xhci_bus_state *bus_state; u16 link_state = 0; u16 wake_mask = 0; @@ -818,17 +817,6 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, goto error; } - slot_id = xhci_find_slot_id_by_port(hcd, xhci, - wIndex + 1); - if (!slot_id) { - xhci_warn(xhci, "slot_id is zero\n"); - goto error; - } - /* unlock to execute stop endpoint commands */ - spin_unlock_irqrestore(&xhci->lock, flags); - xhci_stop_device(xhci, slot_id, 1); - spin_lock_irqsave(&xhci->lock, flags); - xhci_set_link_state(xhci, port_array, wIndex, XDEV_U3); spin_unlock_irqrestore(&xhci->lock, flags); @@ -876,19 +864,6 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, goto error; } - if (link_state == USB_SS_PORT_LS_U3) { - slot_id = xhci_find_slot_id_by_port(hcd, xhci, - wIndex + 1); - if (slot_id) { - /* unlock to execute stop endpoint - * commands */ - spin_unlock_irqrestore(&xhci->lock, - flags); - xhci_stop_device(xhci, slot_id, 1); - spin_lock_irqsave(&xhci->lock, flags); - } - } - xhci_set_link_state(xhci, port_array, wIndex, link_state); @@ -994,14 +969,6 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, XDEV_U0); } bus_state->port_c_suspend |= 1 << wIndex; - - slot_id = xhci_find_slot_id_by_port(hcd, xhci, - wIndex + 1); - if (!slot_id) { - xhci_dbg(xhci, "slot_id is zero\n"); - goto error; - } - xhci_ring_device(xhci, slot_id); break; case USB_PORT_FEAT_C_SUSPEND: bus_state->port_c_suspend &= ~(1 << wIndex); @@ -1133,20 +1100,12 @@ int xhci_bus_suspend(struct usb_hcd *hcd) while (port_index--) { /* suspend the port if the port is not suspended */ u32 t1, t2; - int slot_id; t1 = readl(port_array[port_index]); t2 = xhci_port_state_to_neutral(t1); if ((t1 & PORT_PE) && !(t1 & PORT_PLS_MASK)) { xhci_dbg(xhci, "port %d not suspended\n", port_index); - slot_id = xhci_find_slot_id_by_port(hcd, xhci, - port_index + 1); - if (slot_id) { - spin_unlock_irqrestore(&xhci->lock, flags); - xhci_stop_device(xhci, slot_id, 1); - spin_lock_irqsave(&xhci->lock, flags); - } t2 &= ~PORT_PLS_MASK; t2 |= PORT_LINK_STROBE | XDEV_U3; set_bit(port_index, &bus_state->bus_suspended); @@ -1207,7 +1166,6 @@ int xhci_bus_resume(struct usb_hcd *hcd) /* Check whether need resume ports. If needed resume port and disable remote wakeup */ u32 temp; - int slot_id; temp = readl(port_array[port_index]); if (DEV_SUPERSPEED(temp)) @@ -1240,11 +1198,6 @@ int xhci_bus_resume(struct usb_hcd *hcd) /* Clear PLC */ xhci_test_and_clear_bit(xhci, port_array, port_index, PORT_PLC); - - slot_id = xhci_find_slot_id_by_port(hcd, - xhci, port_index + 1); - if (slot_id) - xhci_ring_device(xhci, slot_id); } else writel(temp, port_array[port_index]); } -- 2.1.0