Patchwork [2/2] xhci: Add defines for hardcoded slot states

login
register
mail settings
Submitter AceLan Kao
Date June 27, 2011, 2:20 p.m.
Message ID <1309184437-4329-3-git-send-email-acelan.kao@canonical.com>
Download mbox | patch
Permalink /patch/102184/
State New
Headers show

Comments

AceLan Kao - June 27, 2011, 2:20 p.m.
From: Maarten Lankhorst <m.b.lankhorst@gmail.com>

This needs to be added to the stable trees back to 2.6.34 to support an
upcoming bug fix.

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@kernel.org
(cherry picked from commit e2b0217715c6d10379d94bdfe5560af96eecbb7c)

BugLink: https://bugs.launchpad.net/bugs/802541

Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
---
 drivers/usb/host/xhci-dbg.c |   10 +++++-----
 drivers/usb/host/xhci.h     |    5 +++++
 2 files changed, 10 insertions(+), 5 deletions(-)

Patch

diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c
index 0231814..99ac7de 100644
--- a/drivers/usb/host/xhci-dbg.c
+++ b/drivers/usb/host/xhci-dbg.c
@@ -436,14 +436,14 @@  char *xhci_get_slot_state(struct xhci_hcd *xhci,
 {
 	struct xhci_slot_ctx *slot_ctx = xhci_get_slot_ctx(xhci, ctx);
 
-	switch (GET_SLOT_STATE(slot_ctx->dev_state)) {
-	case 0:
+	switch (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state))) {
+	case SLOT_STATE_ENABLED:
 		return "enabled/disabled";
-	case 1:
+	case SLOT_STATE_DEFAULT:
 		return "default";
-	case 2:
+	case SLOT_STATE_ADDRESSED:
 		return "addressed";
-	case 3:
+	case SLOT_STATE_CONFIGURED:
 		return "configured";
 	default:
 		return "reserved";
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 62bc1bc..1d9943e 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -556,6 +556,11 @@  struct xhci_slot_ctx {
 #define SLOT_STATE	(0x1f << 27)
 #define GET_SLOT_STATE(p)	(((p) & (0x1f << 27)) >> 27)
 
+#define SLOT_STATE_DISABLED	0
+#define SLOT_STATE_ENABLED	SLOT_STATE_DISABLED
+#define SLOT_STATE_DEFAULT	1
+#define SLOT_STATE_ADDRESSED	2
+#define SLOT_STATE_CONFIGURED	3
 
 /**
  * struct xhci_ep_ctx