Skip to contentSkip to conversation

ehci: cosmetic: Define the number of qt_buffers

PATCH New Benoît Thébaudeau 2 participants 2 messages Jul 19, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/5 ehci: cosmetic: Define the number of qt_buffers

Cc Marek Vasut <[email protected]>
Cc Ilya Yanok <[email protected]>
Cc Stefan Herbrechtsmeier <[email protected]>
---
 .../drivers/usb/host/ehci-hcd.c                    |    4 ++--
 .../drivers/usb/host/ehci.h                        |   11 ++++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)
drivers/usb/host/ehci-hcd.c +2 -2
index 2a82a29..5b3b906 100644
@@ -183,7 +183,7 @@ static int ehci_td_buffer(struct qTD *td, void *buf, size_t sz)
 	flush_dcache_range(addr, ALIGN(addr + sz, ARCH_DMA_MINALIGN));
 
 	idx = 0;
-	while (idx < 5) {
+	while (idx < QT_BUFFER_CNT) {
 		td->qt_buffer[idx] = cpu_to_hc32(addr);
 		td->qt_buffer_hi[idx] = 0;
 		next = (addr + 4096) & ~4095;
@@ -195,7 +195,7 @@ static int ehci_td_buffer(struct qTD *td, void *buf, size_t sz)
 		idx++;
 	}
 
-	if (idx == 5) {
+	if (idx == QT_BUFFER_CNT) {
 		printf("out of buffer pointers (%u bytes left)\n", sz);
 		return -1;
 	}
drivers/usb/host/ehci.h +6 -5
index cc00ce4..7992983 100644
@@ -171,12 +171,13 @@ struct usb_linux_config_descriptor {
 /* Queue Element Transfer Descriptor (qTD). */
 struct qTD {
 	/* this part defined by EHCI spec */
-	uint32_t qt_next;		/* see EHCI 3.5.1 */
+	uint32_t qt_next;			/* see EHCI 3.5.1 */
 #define	QT_NEXT_TERMINATE	1
-	uint32_t qt_altnext;		/* see EHCI 3.5.2 */
-	uint32_t qt_token;		/* see EHCI 3.5.3 */
-	uint32_t qt_buffer[5];		/* see EHCI 3.5.4 */
-	uint32_t qt_buffer_hi[5];	/* Appendix B */
+	uint32_t qt_altnext;			/* see EHCI 3.5.2 */
+	uint32_t qt_token;			/* see EHCI 3.5.3 */
+#define QT_BUFFER_CNT		5
+	uint32_t qt_buffer[QT_BUFFER_CNT];	/* see EHCI 3.5.4 */
+	uint32_t qt_buffer_hi[QT_BUFFER_CNT];	/* Appendix B */
 	/* pad struct for 32 byte alignment */
 	uint32_t unused[3];
 };
#1 lore raw

PATCH 1/5 ehci: cosmetic: Define the number of qt_buffers

Dear Beno?t Th?baudeau,

Quoted 4 lines
Cc Marek Vasut <[email protected]>
Cc Ilya Yanok <[email protected]>
Cc Stefan Herbrechtsmeier <[email protected]>

Now this is pretty crazy, therefore cool! ;-)

I'll dig into these later. But please, if I don't respond within 7 days, prod prod and prod. My memory is bad, so I usually tend to forget about stuff :-( This stuff is really nice, it'd be real shame to put the fruits of your labor to waste.

Thanks!

Best regards,
Marek Vasut