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

AceLan Kao acelan.kao at canonical.com
Mon Jun 27 14:20:37 UTC 2011


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

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

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

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





More information about the kernel-team mailing list