mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maarten Lankhorst <m.b.lankhorst@gmail.com>
To: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@kernel.org, Maarten Lankhorst <m.b.lankhorst@gmail.com>
Subject: [PATCH 2/2] xhci: Do not issue device reset when device is not setup
Date: Wed,  1 Jun 2011 23:27:50 +0200	[thread overview]
Message-ID: <1306963670-6344-2-git-send-email-m.b.lankhorst@gmail.com> (raw)
In-Reply-To: <1306963670-6344-1-git-send-email-m.b.lankhorst@gmail.com>

Xhci controllers respond to this by returning an error. Instead of
issuing a command that will fail, just return.

This fixes the xhci driver not working on asrock P67 Pro/Extreme boards.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
---
 drivers/usb/host/xhci.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index d9660eb..a1f32186 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -2467,6 +2467,7 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
 	struct xhci_command *reset_device_cmd;
 	int timeleft;
 	int last_freed_endpoint;
+	struct xhci_slot_ctx *slot_ctx;
 
 	ret = xhci_check_args(hcd, udev, NULL, 0, false, __func__);
 	if (ret <= 0)
@@ -2499,6 +2500,12 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
 			return -EINVAL;
 	}
 
+	/* If device is not setup, there is no point in resetting it */
+	slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->out_ctx);
+	if (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state)) ==
+						SLOT_STATE_DISABLED)
+		return 0;
+
 	xhci_dbg(xhci, "Resetting device with slot ID %u\n", slot_id);
 	/* Allocate the command structure that holds the struct completion.
 	 * Assume we're in process context, since the normal device reset
-- 
1.7.4.1


  reply	other threads:[~2011-06-01 21:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-01 21:27 [PATCH 1/2] xhci: Add defines for hardcoded slot states Maarten Lankhorst
2011-06-01 21:27 ` Maarten Lankhorst [this message]
2011-06-01 22:17   ` [stable] [PATCH 2/2] xhci: Do not issue device reset when device is not setup Greg KH
2011-06-01 22:42     ` Sarah Sharp
2011-06-01 23:02       ` Maarten Lankhorst
2011-06-01 23:32         ` Sarah Sharp
2011-06-02 11:35           ` Maarten Lankhorst
2011-06-01 22:17 ` [stable] [PATCH 1/2] xhci: Add defines for hardcoded slot states Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1306963670-6344-2-git-send-email-m.b.lankhorst@gmail.com \
    --to=m.b.lankhorst@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sarah.a.sharp@linux.intel.com \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome