Re: [PATCH v4 3/3] usb: xhci: remove stop device and ring doorbell in hub control and bus suspend

2015-05-08 Thread Lu, Baolu



On 05/08/2015 07:01 PM, Greg Kroah-Hartman wrote:

On Fri, May 08, 2015 at 06:26:28PM +0800, Lu Baolu wrote:

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.

Does this mean that after patch 2, things are broken and require this
patch to prevent problems?


No. things work well without patch 3. "stop device" and "ring doorbell"
operations in hub control and bus suspend is harmless, but duplicated
and unnecessary, so I remove them.



I don't want to have any patch to make the system unstable.

thanks,

greg k-h


Thank you,
Baolu


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




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 3/3] usb: xhci: remove stop device and ring doorbell in hub control and bus suspend

2015-05-08 Thread Greg Kroah-Hartman
On Fri, May 08, 2015 at 06:26:28PM +0800, Lu Baolu wrote:
> 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.

Does this mean that after patch 2, things are broken and require this
patch to prevent problems?

I don't want to have any patch to make the system unstable.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 3/3] usb: xhci: remove stop device and ring doorbell in hub control and bus suspend

2015-05-08 Thread Lu Baolu
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(>lock, flags);
-   xhci_stop_device(xhci, slot_id, 1);
-   spin_lock_irqsave(>lock, flags);
-
xhci_set_link_state(xhci, port_array, wIndex, XDEV_U3);
 
spin_unlock_irqrestore(>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(>lock,
-   flags);
-   xhci_stop_device(xhci, slot_id, 1);
-   spin_lock_irqsave(>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(>lock, flags);
-   xhci_stop_device(xhci, slot_id, 1);
-   spin_lock_irqsave(>lock, flags);
-   }
t2 &= ~PORT_PLS_MASK;
t2 |= PORT_LINK_STROBE | XDEV_U3;
set_bit(port_index, _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, 

[PATCH v4 3/3] usb: xhci: remove stop device and ring doorbell in hub control and bus suspend

2015-05-08 Thread Lu Baolu
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 baolu...@linux.intel.com
---
 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 */
   

Re: [PATCH v4 3/3] usb: xhci: remove stop device and ring doorbell in hub control and bus suspend

2015-05-08 Thread Greg Kroah-Hartman
On Fri, May 08, 2015 at 06:26:28PM +0800, Lu Baolu wrote:
 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.

Does this mean that after patch 2, things are broken and require this
patch to prevent problems?

I don't want to have any patch to make the system unstable.

thanks,

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 3/3] usb: xhci: remove stop device and ring doorbell in hub control and bus suspend

2015-05-08 Thread Lu, Baolu



On 05/08/2015 07:01 PM, Greg Kroah-Hartman wrote:

On Fri, May 08, 2015 at 06:26:28PM +0800, Lu Baolu wrote:

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.

Does this mean that after patch 2, things are broken and require this
patch to prevent problems?


No. things work well without patch 3. stop device and ring doorbell
operations in hub control and bus suspend is harmless, but duplicated
and unnecessary, so I remove them.



I don't want to have any patch to make the system unstable.

thanks,

greg k-h


Thank you,
Baolu


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




--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/