[PATCH] xhci: unify cycle state toggling operation with 'XOR'

2015-01-16 Thread Lin Wang
Some toggling operation in xHCI driver still use conditional toggling:
ring->cycle_state = (ring->cycle_state ? 0 : 1);

Use XOR to invert the cycle state instead of a conditional toggle to unify
cycle state toggling operation in xHCI driver.
---
 drivers/usb/host/xhci-ring.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 88da8d6..ceb4f1b 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -238,7 +238,7 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring 
*ring,
 
/* Toggle the cycle bit after the last ring segment. */
if (last_trb_on_last_seg(xhci, ring, ring->enq_seg, 
next)) {
-   ring->cycle_state = (ring->cycle_state ? 0 : 1);
+   ring->cycle_state ^= 1;
}
}
ring->enq_seg = ring->enq_seg->next;
@@ -2803,7 +2803,7 @@ static int prepare_ring(struct xhci_hcd *xhci, struct 
xhci_ring *ep_ring,
 
/* Toggle the cycle bit after the last ring segment. */
if (last_trb_on_last_seg(xhci, ring, ring->enq_seg, 
next)) {
-   ring->cycle_state = (ring->cycle_state ? 0 : 1);
+   ring->cycle_state ^= 1;
}
ring->enq_seg = ring->enq_seg->next;
ring->enqueue = ring->enq_seg->trbs;
-- 
1.7.9.5

--
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


[PATCH V2] xhci: clean up work to remove unused parameters for functions in xhci-mem.c

2015-01-09 Thread Lin Wang
Some parameters are not used by functions in xhci-mem.c, just
remove it.

Changes compared to v1:
- Rebase to the latest usb-next branch

Signed-off-by: Lin Wang 
---
 drivers/usb/host/xhci-dbg.c  |2 +-
 drivers/usb/host/xhci-mem.c  |   21 +
 drivers/usb/host/xhci-ring.c |6 +++---
 drivers/usb/host/xhci.c  |   34 +-
 drivers/usb/host/xhci.h  |7 +++
 5 files changed, 33 insertions(+), 37 deletions(-)

diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c
index bb89175..745717e 100644
--- a/drivers/usb/host/xhci-dbg.c
+++ b/drivers/usb/host/xhci-dbg.c
@@ -552,7 +552,7 @@ void xhci_dbg_ctx(struct xhci_hcd *xhci,
 
if (ctx->type == XHCI_CTX_TYPE_INPUT) {
struct xhci_input_control_ctx *ctrl_ctx =
-   xhci_get_input_control_ctx(xhci, ctx);
+   xhci_get_input_control_ctx(ctx);
if (!ctrl_ctx) {
xhci_warn(xhci, "Could not get input context, bad 
type.\n");
return;
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 5cb3d7a..2e6eaf4 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -535,7 +535,7 @@ static void xhci_free_container_ctx(struct xhci_hcd *xhci,
kfree(ctx);
 }
 
-struct xhci_input_control_ctx *xhci_get_input_control_ctx(struct xhci_hcd 
*xhci,
+struct xhci_input_control_ctx *xhci_get_input_control_ctx(
  struct xhci_container_ctx *ctx)
 {
if (ctx->type != XHCI_CTX_TYPE_INPUT)
@@ -784,8 +784,7 @@ void xhci_setup_streams_ep_input_ctx(struct xhci_hcd *xhci,
  * Reinstalls the "normal" endpoint ring (at its previous dequeue mark,
  * not at the beginning of the ring).
  */
-void xhci_setup_no_streams_ep_input_ctx(struct xhci_hcd *xhci,
-   struct xhci_ep_ctx *ep_ctx,
+void xhci_setup_no_streams_ep_input_ctx(struct xhci_ep_ctx *ep_ctx,
struct xhci_virt_ep *ep)
 {
dma_addr_t addr;
@@ -1342,8 +1341,7 @@ static u32 xhci_get_endpoint_mult(struct usb_device *udev,
return ep->ss_ep_comp.bmAttributes;
 }
 
-static u32 xhci_get_endpoint_type(struct usb_device *udev,
-   struct usb_host_endpoint *ep)
+static u32 xhci_get_endpoint_type(struct usb_host_endpoint *ep)
 {
int in;
u32 type;
@@ -1376,8 +1374,7 @@ static u32 xhci_get_endpoint_type(struct usb_device *udev,
  * Basically, this is the maxpacket size, multiplied by the burst size
  * and mult size.
  */
-static u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci,
-   struct usb_device *udev,
+static u32 xhci_get_max_esit_payload(struct usb_device *udev,
struct usb_host_endpoint *ep)
 {
int max_burst;
@@ -1418,7 +1415,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
ep_index = xhci_get_endpoint_index(&ep->desc);
ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index);
 
-   endpoint_type = xhci_get_endpoint_type(udev, ep);
+   endpoint_type = xhci_get_endpoint_type(ep);
if (!endpoint_type)
return -EINVAL;
ep_ctx->ep_info2 = cpu_to_le32(endpoint_type);
@@ -1484,7 +1481,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
}
ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet) |
MAX_BURST(max_burst));
-   max_esit_payload = xhci_get_max_esit_payload(xhci, udev, ep);
+   max_esit_payload = xhci_get_max_esit_payload(udev, ep);
ep_ctx->tx_info = 
cpu_to_le32(MAX_ESIT_PAYLOAD_FOR_EP(max_esit_payload));
 
/*
@@ -1773,7 +1770,7 @@ struct xhci_command *xhci_alloc_command(struct xhci_hcd 
*xhci,
return command;
 }
 
-void xhci_urb_free_priv(struct xhci_hcd *xhci, struct urb_priv *urb_priv)
+void xhci_urb_free_priv(struct urb_priv *urb_priv)
 {
if (urb_priv) {
kfree(urb_priv->td[0]);
@@ -1926,7 +1923,7 @@ static int xhci_test_trb_in_td(struct xhci_hcd *xhci,
 }
 
 /* TRB math checks for xhci_trb_in_td(), using the command and event rings. */
-static int xhci_check_trb_in_td_math(struct xhci_hcd *xhci, gfp_t mem_flags)
+static int xhci_check_trb_in_td_math(struct xhci_hcd *xhci)
 {
struct {
dma_addr_t  input_dma;
@@ -2452,7 +2449,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
flags);
if (!xhci->event_ring)
goto fail;
-   if (xhci_check_trb_in_td_math(xhci, flags) < 0)
+   if (xhci_check_trb_in_td_math(xhci) < 0)
goto fail;
 
xhci->erst.entries = dma_alloc_coherent(dev,
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index e692e76..5e1090a 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -609,7 +609,

[PATCH] xhci: remove unused parameter 'xhci' in function xhci_handshake().

2015-01-05 Thread Lin Wang
Parameter 'xhci' is no longer be used in function xhci_handshake(),
just remove it.

Signed-off-by: Lin Wang 
---
 drivers/usb/host/xhci-ring.c |2 +-
 drivers/usb/host/xhci.c  |   19 +--
 drivers/usb/host/xhci.h  |3 +--
 3 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index e692e76..c84a959 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -299,7 +299,7 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci)
 * seconds), then it should assume that the there are
 * larger problems with the xHC and assert HCRST.
 */
-   ret = xhci_handshake(xhci, &xhci->op_regs->cmd_ring,
+   ret = xhci_handshake(&xhci->op_regs->cmd_ring,
CMD_RING_RUNNING, 0, 5 * 1000 * 1000);
if (ret < 0) {
xhci_err(xhci, "Stopped the command ring failed, "
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 01fcbb5..2d1e73a 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -60,8 +60,7 @@ MODULE_PARM_DESC(quirks, "Bit flags for quirks to be enabled 
as default");
  * handshake done).  There are two failure modes:  "usec" have passed (major
  * hardware flakeout), or the register reads as all-ones (hardware removed).
  */
-int xhci_handshake(struct xhci_hcd *xhci, void __iomem *ptr,
- u32 mask, u32 done, int usec)
+int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec)
 {
u32 result;
 
@@ -111,7 +110,7 @@ int xhci_halt(struct xhci_hcd *xhci)
xhci_dbg_trace(xhci, trace_xhci_dbg_init, "// Halt the HC");
xhci_quiesce(xhci);
 
-   ret = xhci_handshake(xhci, &xhci->op_regs->status,
+   ret = xhci_handshake(&xhci->op_regs->status,
STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC);
if (!ret) {
xhci->xhc_state |= XHCI_STATE_HALTED;
@@ -140,7 +139,7 @@ static int xhci_start(struct xhci_hcd *xhci)
 * Wait for the HCHalted Status bit to be 0 to indicate the host is
 * running.
 */
-   ret = xhci_handshake(xhci, &xhci->op_regs->status,
+   ret = xhci_handshake(&xhci->op_regs->status,
STS_HALT, 0, XHCI_MAX_HALT_USEC);
if (ret == -ETIMEDOUT)
xhci_err(xhci, "Host took too long to start, "
@@ -175,7 +174,7 @@ int xhci_reset(struct xhci_hcd *xhci)
command |= CMD_RESET;
writel(command, &xhci->op_regs->command);
 
-   ret = xhci_handshake(xhci, &xhci->op_regs->command,
+   ret = xhci_handshake(&xhci->op_regs->command,
CMD_RESET, 0, 10 * 1000 * 1000);
if (ret)
return ret;
@@ -186,7 +185,7 @@ int xhci_reset(struct xhci_hcd *xhci)
 * xHCI cannot write to any doorbells or operational registers other
 * than status until the "Controller Not Ready" flag is cleared.
 */
-   ret = xhci_handshake(xhci, &xhci->op_regs->status,
+   ret = xhci_handshake(&xhci->op_regs->status,
STS_CNR, 0, 10 * 1000 * 1000);
 
for (i = 0; i < 2; ++i) {
@@ -929,7 +928,7 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup)
/* Some chips from Fresco Logic need an extraordinary delay */
delay *= (xhci->quirks & XHCI_SLOW_SUSPEND) ? 10 : 1;
 
-   if (xhci_handshake(xhci, &xhci->op_regs->status,
+   if (xhci_handshake(&xhci->op_regs->status,
  STS_HALT, STS_HALT, delay)) {
xhci_warn(xhci, "WARN: xHC CMD_RUN timeout\n");
spin_unlock_irq(&xhci->lock);
@@ -944,7 +943,7 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup)
command = readl(&xhci->op_regs->command);
command |= CMD_CSS;
writel(command, &xhci->op_regs->command);
-   if (xhci_handshake(xhci, &xhci->op_regs->status,
+   if (xhci_handshake(&xhci->op_regs->status,
STS_SAVE, 0, 10 * 1000)) {
xhci_warn(xhci, "WARN: xHC save state timeout\n");
spin_unlock_irq(&xhci->lock);
@@ -1011,7 +1010,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
command = readl(&xhci->op_regs->command);
command |= CMD_CRS;
writel(command, &xhci->op_regs->command);
-   if (xhci_handshake(xhci, &xhci->op_regs->status,
+   if (xhci_handshake(&xhci->op_regs->status,
  STS_RESTORE, 0, 10 * 1000)) {
xhci_warn(xhci, "WARN: xHC restore state timeout\n");
 

[PATCH] xhci: clean up work to remove unused parameters for functions in xhci-mem.c

2015-01-05 Thread Lin Wang
Some parameters are not used by functions in xhci-mem.c, just
remove it.

Signed-off-by: Lin Wang 
---
 drivers/usb/host/xhci-dbg.c  |2 +-
 drivers/usb/host/xhci-mem.c  |   21 +
 drivers/usb/host/xhci-ring.c |6 +++---
 drivers/usb/host/xhci.c  |   34 +-
 drivers/usb/host/xhci.h  |7 +++
 5 files changed, 33 insertions(+), 37 deletions(-)

diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c
index bb89175..745717e 100644
--- a/drivers/usb/host/xhci-dbg.c
+++ b/drivers/usb/host/xhci-dbg.c
@@ -552,7 +552,7 @@ void xhci_dbg_ctx(struct xhci_hcd *xhci,
 
if (ctx->type == XHCI_CTX_TYPE_INPUT) {
struct xhci_input_control_ctx *ctrl_ctx =
-   xhci_get_input_control_ctx(xhci, ctx);
+   xhci_get_input_control_ctx(ctx);
if (!ctrl_ctx) {
xhci_warn(xhci, "Could not get input context, bad 
type.\n");
return;
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 5cb3d7a..2e6eaf4 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -535,7 +535,7 @@ static void xhci_free_container_ctx(struct xhci_hcd *xhci,
kfree(ctx);
 }
 
-struct xhci_input_control_ctx *xhci_get_input_control_ctx(struct xhci_hcd 
*xhci,
+struct xhci_input_control_ctx *xhci_get_input_control_ctx(
  struct xhci_container_ctx *ctx)
 {
if (ctx->type != XHCI_CTX_TYPE_INPUT)
@@ -784,8 +784,7 @@ void xhci_setup_streams_ep_input_ctx(struct xhci_hcd *xhci,
  * Reinstalls the "normal" endpoint ring (at its previous dequeue mark,
  * not at the beginning of the ring).
  */
-void xhci_setup_no_streams_ep_input_ctx(struct xhci_hcd *xhci,
-   struct xhci_ep_ctx *ep_ctx,
+void xhci_setup_no_streams_ep_input_ctx(struct xhci_ep_ctx *ep_ctx,
struct xhci_virt_ep *ep)
 {
dma_addr_t addr;
@@ -1342,8 +1341,7 @@ static u32 xhci_get_endpoint_mult(struct usb_device *udev,
return ep->ss_ep_comp.bmAttributes;
 }
 
-static u32 xhci_get_endpoint_type(struct usb_device *udev,
-   struct usb_host_endpoint *ep)
+static u32 xhci_get_endpoint_type(struct usb_host_endpoint *ep)
 {
int in;
u32 type;
@@ -1376,8 +1374,7 @@ static u32 xhci_get_endpoint_type(struct usb_device *udev,
  * Basically, this is the maxpacket size, multiplied by the burst size
  * and mult size.
  */
-static u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci,
-   struct usb_device *udev,
+static u32 xhci_get_max_esit_payload(struct usb_device *udev,
struct usb_host_endpoint *ep)
 {
int max_burst;
@@ -1418,7 +1415,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
ep_index = xhci_get_endpoint_index(&ep->desc);
ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index);
 
-   endpoint_type = xhci_get_endpoint_type(udev, ep);
+   endpoint_type = xhci_get_endpoint_type(ep);
if (!endpoint_type)
return -EINVAL;
ep_ctx->ep_info2 = cpu_to_le32(endpoint_type);
@@ -1484,7 +1481,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
}
ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet) |
MAX_BURST(max_burst));
-   max_esit_payload = xhci_get_max_esit_payload(xhci, udev, ep);
+   max_esit_payload = xhci_get_max_esit_payload(udev, ep);
ep_ctx->tx_info = 
cpu_to_le32(MAX_ESIT_PAYLOAD_FOR_EP(max_esit_payload));
 
/*
@@ -1773,7 +1770,7 @@ struct xhci_command *xhci_alloc_command(struct xhci_hcd 
*xhci,
return command;
 }
 
-void xhci_urb_free_priv(struct xhci_hcd *xhci, struct urb_priv *urb_priv)
+void xhci_urb_free_priv(struct urb_priv *urb_priv)
 {
if (urb_priv) {
kfree(urb_priv->td[0]);
@@ -1926,7 +1923,7 @@ static int xhci_test_trb_in_td(struct xhci_hcd *xhci,
 }
 
 /* TRB math checks for xhci_trb_in_td(), using the command and event rings. */
-static int xhci_check_trb_in_td_math(struct xhci_hcd *xhci, gfp_t mem_flags)
+static int xhci_check_trb_in_td_math(struct xhci_hcd *xhci)
 {
struct {
dma_addr_t  input_dma;
@@ -2452,7 +2449,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
flags);
if (!xhci->event_ring)
goto fail;
-   if (xhci_check_trb_in_td_math(xhci, flags) < 0)
+   if (xhci_check_trb_in_td_math(xhci) < 0)
goto fail;
 
xhci->erst.entries = dma_alloc_coherent(dev,
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index e692e76..5e1090a 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -609,7 +609,7 @@ static void xhci_giveback_urb_in_irq(struct xhci_hcd *xhci,
 
spi

[PATCH] xhci: Clean up work to xhci_add_endpoint().

2015-01-05 Thread Lin Wang
This patch removes unused variable "out_ctx" and avoid multiple calls
to function xhci_get_endpoint_flag().

Signed-off-by: Lin Wang 
---
 drivers/usb/host/xhci.c |9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 01fcbb5..93200db 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1714,7 +1714,7 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct 
usb_device *udev,
struct usb_host_endpoint *ep)
 {
struct xhci_hcd *xhci;
-   struct xhci_container_ctx *in_ctx, *out_ctx;
+   struct xhci_container_ctx *in_ctx;
unsigned int ep_index;
struct xhci_input_control_ctx *ctrl_ctx;
u32 added_ctxs;
@@ -1745,7 +1745,6 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct 
usb_device *udev,
 
virt_dev = xhci->devs[udev->slot_id];
in_ctx = virt_dev->in_ctx;
-   out_ctx = virt_dev->out_ctx;
ctrl_ctx = xhci_get_input_control_ctx(xhci, in_ctx);
if (!ctrl_ctx) {
xhci_warn(xhci, "%s: Could not get input context, bad type.\n",
@@ -1758,8 +1757,7 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct 
usb_device *udev,
 * to add it again without dropping it, reject the addition.
 */
if (virt_dev->eps[ep_index].ring &&
-   !(le32_to_cpu(ctrl_ctx->drop_flags) &
-   xhci_get_endpoint_flag(&ep->desc))) {
+   !(le32_to_cpu(ctrl_ctx->drop_flags) & added_ctxs)) {
xhci_warn(xhci, "Trying to add endpoint 0x%x "
"without dropping it.\n",
(unsigned int) ep->desc.bEndpointAddress);
@@ -1769,8 +1767,7 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct 
usb_device *udev,
/* If the HCD has already noted the endpoint is enabled,
 * ignore this request.
 */
-   if (le32_to_cpu(ctrl_ctx->add_flags) &
-   xhci_get_endpoint_flag(&ep->desc)) {
+   if (le32_to_cpu(ctrl_ctx->add_flags) & added_ctxs) {
xhci_warn(xhci, "xHCI %s called with enabled ep %p\n",
__func__, ep);
return 0;
-- 
1.7.9.5

--
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


[PATCH] xhci: fix wrong port number reported when setting USB2.0 hardware LPM.

2014-03-09 Thread Lin Wang
This patch fix wrong port number reported when trying to enable/disable
USB2.0 hardware LPM.

Signed-off-by: Lin Wang 
---
 drivers/usb/host/xhci.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 6fe577d..972f00d 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4064,7 +4064,7 @@ int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
field = le32_to_cpu(udev->bos->ext_cap->bmAttributes);
 
xhci_dbg(xhci, "%s port %d USB2 hardware LPM\n",
-   enable ? "enable" : "disable", port_num);
+   enable ? "enable" : "disable", port_num + 1);
 
if (enable) {
/* Host supports BESL timeout instead of HIRD */
-- 
1.7.9.5

--
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


[PATCH] xhci: fix wrong port number reported when setting USB2.0 hardware LPM.

2014-03-09 Thread Lin Wang
This patch fix wrong port number reported when trying to enable/disable
USB2.0 hardware LPM.

Signed-off-by: Lin Wang 
---
 drivers/usb/host/xhci.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 6fe577d..972f00d 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4064,7 +4064,7 @@ int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
field = le32_to_cpu(udev->bos->ext_cap->bmAttributes);
 
xhci_dbg(xhci, "%s port %d USB2 hardware LPM\n",
-   enable ? "enable" : "disable", port_num);
+   enable ? "enable" : "disable", port_num + 1);
 
if (enable) {
/* Host supports BESL timeout instead of HIRD */
-- 
1.7.9.5

--
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


[PATCH] xhci: fix wrong port number reported when setting USB2.0 hardware LPM.

2014-03-09 Thread Lin Wang
This patch fix wrong port number reported when trying to enable/disable
USB2.0 hardware LPM.

Signed-off-by: Lin Wang 
---
 drivers/usb/host/xhci.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 6fe577d..972f00d 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4064,7 +4064,7 @@ int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
field = le32_to_cpu(udev->bos->ext_cap->bmAttributes);
 
xhci_dbg(xhci, "%s port %d USB2 hardware LPM\n",
-   enable ? "enable" : "disable", port_num);
+   enable ? "enable" : "disable", port_num + 1);
 
if (enable) {
/* Host supports BESL timeout instead of HIRD */
-- 
1.7.9.5

--
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


[PATCH] xhci: fix wrong port number reported when setting USB2.0 hardware LPM.

2014-03-09 Thread Lin Wang
This patch fix wrong port number reported when trying to enable/disable
USB2.0 hardware LPM.

Signed-off-by: Lin Wang 
---
 drivers/usb/host/xhci.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 6fe577d..972f00d 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4064,7 +4064,7 @@ int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
field = le32_to_cpu(udev->bos->ext_cap->bmAttributes);
 
xhci_dbg(xhci, "%s port %d USB2 hardware LPM\n",
-   enable ? "enable" : "disable", port_num);
+   enable ? "enable" : "disable", port_num + 1);
 
if (enable) {
/* Host supports BESL timeout instead of HIRD */
-- 
1.7.9.5

--
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


[PATCH v2] xhci: Remove unused variable 'addr' in inc_deq() and inc_enq().

2013-12-17 Thread Lin Wang
This patch remove unused variable 'addr' in inc_deq() and inc_enq().

Signed-off-by: Lin Wang 
---
 drivers/usb/host/xhci-ring.c |6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 53c2e29..630f6e4 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -156,8 +156,6 @@ static void next_trb(struct xhci_hcd *xhci,
  */
 static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring)
 {
-   unsigned long long addr;
-
ring->deq_updates++;
 
/*
@@ -186,8 +184,6 @@ static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring 
*ring)
ring->dequeue++;
}
} while (last_trb(xhci, ring, ring->deq_seg, ring->dequeue));
-
-   addr = (unsigned long long) xhci_trb_virt_to_dma(ring->deq_seg, 
ring->dequeue);
 }
 
 /*
@@ -212,7 +208,6 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring 
*ring,
 {
u32 chain;
union xhci_trb *next;
-   unsigned long long addr;
 
chain = le32_to_cpu(ring->enqueue->generic.field[3]) & TRB_CHAIN;
/* If this is not event ring, there is one less usable TRB */
@@ -264,7 +259,6 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring 
*ring,
ring->enqueue = ring->enq_seg->trbs;
next = ring->enqueue;
}
-   addr = (unsigned long long) xhci_trb_virt_to_dma(ring->enq_seg, 
ring->enqueue);
 }
 
 /*
-- 
1.7.9.5

--
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