[PATCH 1/4 v3] EHCI: split ehci_qh - header file changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David,

Polished and tested the following patches. Use some macro like HW, QH
for hw/sw/shadow conversion, hope you like this style ...

Alek

>From b01d4f48a57060b1c4b971a8a8b5f2da304237ad Mon Sep 17 00:00:00 2001
From: Alek Du <alek.du@xxxxxxxxx>
Date: Wed, 24 Jun 2009 18:52:09 +0800
Subject: [PATCH] EHCI: split ehci_qh - header file changes

Modified ehci.h, add ehci_qh_hw to hold hw part, also prepared some macros
for sw/hw/shadow conversion.

Signed-off-by: Alek Du <alek.du@xxxxxxxxx>
---
 drivers/usb/host/ehci.h |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 90ad339..437a9bd 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -280,7 +280,7 @@ struct ehci_qtd {
  * For entries in the async schedule, the type tag always says "qh".
  */
 union ehci_shadow {
-	struct ehci_qh		*qh;		/* Q_TYPE_QH */
+	struct ehci_qh_hw	*qh_hw;		/* Q_TYPE_QH */
 	struct ehci_itd		*itd;		/* Q_TYPE_ITD */
 	struct ehci_sitd	*sitd;		/* Q_TYPE_SITD */
 	struct ehci_fstn	*fstn;		/* Q_TYPE_FSTN */
@@ -298,8 +298,8 @@ union ehci_shadow {
  * These appear in both the async and (for interrupt) periodic schedules.
  */
 
-struct ehci_qh {
-	/* first part defined by EHCI spec */
+/* first part defined by EHCI spec */
+struct ehci_qh_hw {
 	__hc32			hw_next;	/* see EHCI 3.6.1 */
 	__hc32			hw_info1;       /* see EHCI 3.6.2 */
 #define	QH_HEAD		0x00008000
@@ -318,6 +318,12 @@ struct ehci_qh {
 	__hc32			hw_buf [5];
 	__hc32			hw_buf_hi [5];
 
+	/* we need a back ptr to software part for some case */
+	struct ehci_qh		*sw;
+} __attribute__ ((aligned(32)));
+
+struct ehci_qh {
+	struct ehci_qh_hw	*hw;
 	/* the rest is HCD-private */
 	dma_addr_t		qh_dma;		/* address of qh */
 	union ehci_shadow	qh_next;	/* ptr to qh; or periodic */
@@ -355,7 +361,16 @@ struct ehci_qh {
 	unsigned short		start;		/* where polling starts */
 #define NO_FRAME ((unsigned short)~0)			/* pick new start */
 	struct usb_device	*dev;		/* access to TT */
-} __attribute__ ((aligned (32)));
+};
+
+/* get ehci_qh_hw from shadow */
+#define SH_HW(x) ((x)->qh_hw)
+/* get ehci_qh from ehci_shadow */
+#define SH_QH(x) (SH_HW(x) ? SH_HW(x)->sw : NULL)
+/* get ehci_qh_hw from ehci_qh */
+#define HW(x) ((x)->hw)
+/* get ehci_qh from ehci_qh_hw */
+#define QH(x) ((x)->sw)
 
 /*-------------------------------------------------------------------------*/
 
-- 
1.6.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux