2 * Copyright (c) 2001-2002 by David Brownell
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 /* this file is part of ehci-hcd.c */
21 #define ehci_dbg(ehci, fmt, args...) \
22 dev_dbg (ehci_to_hcd(ehci)->self.controller , fmt , ## args )
23 #define ehci_err(ehci, fmt, args...) \
24 dev_err (ehci_to_hcd(ehci)->self.controller , fmt , ## args )
25 #define ehci_info(ehci, fmt, args...) \
26 dev_info (ehci_to_hcd(ehci)->self.controller , fmt , ## args )
27 #define ehci_warn(ehci, fmt, args...) \
28 dev_warn (ehci_to_hcd(ehci)->self.controller , fmt , ## args )
30 #ifdef EHCI_VERBOSE_DEBUG
32 # define ehci_vdbg ehci_dbg
34 # define vdbg(fmt,args...) do { } while (0)
35 # define ehci_vdbg(ehci, fmt, args...) do { } while (0)
40 /* check the values in the HCSPARAMS register
41 * (host controller _Structural_ parameters)
42 * see EHCI spec, Table 2-4 for each value
44 static void dbg_hcs_params (struct ehci_hcd *ehci, char *label)
46 u32 params = ehci_readl(ehci, &ehci->caps->hcs_params);
49 "%s hcs_params 0x%x dbg=%d%s cc=%d pcc=%d%s%s ports=%d\n",
51 HCS_DEBUG_PORT (params),
52 HCS_INDICATOR (params) ? " ind" : "",
55 HCS_PORTROUTED (params) ? "" : " ordered",
56 HCS_PPC (params) ? "" : " !ppc",
59 /* Port routing, per EHCI 0.95 Spec, Section 2.2.5 */
60 if (HCS_PORTROUTED (params)) {
62 char buf [46], tmp [7], byte;
65 for (i = 0; i < HCS_N_PORTS (params); i++) {
66 // FIXME MIPS won't readb() ...
67 byte = readb (&ehci->caps->portroute[(i>>1)]);
69 ((i & 0x1) ? ((byte)&0xf) : ((byte>>4)&0xf)));
72 ehci_dbg (ehci, "%s portroute %s\n",
78 static inline void dbg_hcs_params (struct ehci_hcd *ehci, char *label) {}
84 /* check the values in the HCCPARAMS register
85 * (host controller _Capability_ parameters)
86 * see EHCI Spec, Table 2-5 for each value
88 static void dbg_hcc_params (struct ehci_hcd *ehci, char *label)
90 u32 params = ehci_readl(ehci, &ehci->caps->hcc_params);
92 if (HCC_ISOC_CACHE (params)) {
94 "%s hcc_params %04x caching frame %s%s%s\n",
96 HCC_PGM_FRAMELISTLEN(params) ? "256/512/1024" : "1024",
97 HCC_CANPARK(params) ? " park" : "",
98 HCC_64BIT_ADDR(params) ? " 64 bit addr" : "");
101 "%s hcc_params %04x thresh %d uframes %s%s%s\n",
104 HCC_ISOC_THRES(params),
105 HCC_PGM_FRAMELISTLEN(params) ? "256/512/1024" : "1024",
106 HCC_CANPARK(params) ? " park" : "",
107 HCC_64BIT_ADDR(params) ? " 64 bit addr" : "");
112 static inline void dbg_hcc_params (struct ehci_hcd *ehci, char *label) {}
118 static void __maybe_unused
119 dbg_qtd (const char *label, struct ehci_hcd *ehci, struct ehci_qtd *qtd)
121 ehci_dbg(ehci, "%s td %p n%08x %08x t%08x p0=%08x\n", label, qtd,
122 hc32_to_cpup(ehci, &qtd->hw_next),
123 hc32_to_cpup(ehci, &qtd->hw_alt_next),
124 hc32_to_cpup(ehci, &qtd->hw_token),
125 hc32_to_cpup(ehci, &qtd->hw_buf [0]));
127 ehci_dbg(ehci, " p1=%08x p2=%08x p3=%08x p4=%08x\n",
128 hc32_to_cpup(ehci, &qtd->hw_buf[1]),
129 hc32_to_cpup(ehci, &qtd->hw_buf[2]),
130 hc32_to_cpup(ehci, &qtd->hw_buf[3]),
131 hc32_to_cpup(ehci, &qtd->hw_buf[4]));
134 static void __maybe_unused
135 dbg_qh (const char *label, struct ehci_hcd *ehci, struct ehci_qh *qh)
137 ehci_dbg (ehci, "%s qh %p n%08x info %x %x qtd %x\n", label,
138 qh, qh->hw_next, qh->hw_info1, qh->hw_info2,
140 dbg_qtd ("overlay", ehci, (struct ehci_qtd *) &qh->hw_qtd_next);
143 static void __maybe_unused
144 dbg_itd (const char *label, struct ehci_hcd *ehci, struct ehci_itd *itd)
146 ehci_dbg (ehci, "%s [%d] itd %p, next %08x, urb %p\n",
147 label, itd->frame, itd, hc32_to_cpu(ehci, itd->hw_next),
150 " trans: %08x %08x %08x %08x %08x %08x %08x %08x\n",
151 hc32_to_cpu(ehci, itd->hw_transaction[0]),
152 hc32_to_cpu(ehci, itd->hw_transaction[1]),
153 hc32_to_cpu(ehci, itd->hw_transaction[2]),
154 hc32_to_cpu(ehci, itd->hw_transaction[3]),
155 hc32_to_cpu(ehci, itd->hw_transaction[4]),
156 hc32_to_cpu(ehci, itd->hw_transaction[5]),
157 hc32_to_cpu(ehci, itd->hw_transaction[6]),
158 hc32_to_cpu(ehci, itd->hw_transaction[7]));
160 " buf: %08x %08x %08x %08x %08x %08x %08x\n",
161 hc32_to_cpu(ehci, itd->hw_bufp[0]),
162 hc32_to_cpu(ehci, itd->hw_bufp[1]),
163 hc32_to_cpu(ehci, itd->hw_bufp[2]),
164 hc32_to_cpu(ehci, itd->hw_bufp[3]),
165 hc32_to_cpu(ehci, itd->hw_bufp[4]),
166 hc32_to_cpu(ehci, itd->hw_bufp[5]),
167 hc32_to_cpu(ehci, itd->hw_bufp[6]));
168 ehci_dbg (ehci, " index: %d %d %d %d %d %d %d %d\n",
169 itd->index[0], itd->index[1], itd->index[2],
170 itd->index[3], itd->index[4], itd->index[5],
171 itd->index[6], itd->index[7]);
174 static void __maybe_unused
175 dbg_sitd (const char *label, struct ehci_hcd *ehci, struct ehci_sitd *sitd)
177 ehci_dbg (ehci, "%s [%d] sitd %p, next %08x, urb %p\n",
178 label, sitd->frame, sitd, hc32_to_cpu(ehci, sitd->hw_next),
181 " addr %08x sched %04x result %08x buf %08x %08x\n",
182 hc32_to_cpu(ehci, sitd->hw_fullspeed_ep),
183 hc32_to_cpu(ehci, sitd->hw_uframe),
184 hc32_to_cpu(ehci, sitd->hw_results),
185 hc32_to_cpu(ehci, sitd->hw_buf[0]),
186 hc32_to_cpu(ehci, sitd->hw_buf[1]));
189 static int __maybe_unused
190 dbg_status_buf (char *buf, unsigned len, const char *label, u32 status)
192 return scnprintf (buf, len,
193 "%s%sstatus %04x%s%s%s%s%s%s%s%s%s%s",
194 label, label [0] ? " " : "", status,
195 (status & STS_ASS) ? " Async" : "",
196 (status & STS_PSS) ? " Periodic" : "",
197 (status & STS_RECL) ? " Recl" : "",
198 (status & STS_HALT) ? " Halt" : "",
199 (status & STS_IAA) ? " IAA" : "",
200 (status & STS_FATAL) ? " FATAL" : "",
201 (status & STS_FLR) ? " FLR" : "",
202 (status & STS_PCD) ? " PCD" : "",
203 (status & STS_ERR) ? " ERR" : "",
204 (status & STS_INT) ? " INT" : ""
208 static int __maybe_unused
209 dbg_intr_buf (char *buf, unsigned len, const char *label, u32 enable)
211 return scnprintf (buf, len,
212 "%s%sintrenable %02x%s%s%s%s%s%s",
213 label, label [0] ? " " : "", enable,
214 (enable & STS_IAA) ? " IAA" : "",
215 (enable & STS_FATAL) ? " FATAL" : "",
216 (enable & STS_FLR) ? " FLR" : "",
217 (enable & STS_PCD) ? " PCD" : "",
218 (enable & STS_ERR) ? " ERR" : "",
219 (enable & STS_INT) ? " INT" : ""
223 static const char *const fls_strings [] =
224 { "1024", "512", "256", "??" };
227 dbg_command_buf (char *buf, unsigned len, const char *label, u32 command)
229 return scnprintf (buf, len,
230 "%s%scommand %06x %s=%d ithresh=%d%s%s%s%s period=%s%s %s",
231 label, label [0] ? " " : "", command,
232 (command & CMD_PARK) ? "park" : "(park)",
233 CMD_PARK_CNT (command),
234 (command >> 16) & 0x3f,
235 (command & CMD_LRESET) ? " LReset" : "",
236 (command & CMD_IAAD) ? " IAAD" : "",
237 (command & CMD_ASE) ? " Async" : "",
238 (command & CMD_PSE) ? " Periodic" : "",
239 fls_strings [(command >> 2) & 0x3],
240 (command & CMD_RESET) ? " Reset" : "",
241 (command & CMD_RUN) ? "RUN" : "HALT"
246 dbg_port_buf (char *buf, unsigned len, const char *label, int port, u32 status)
250 /* signaling state */
251 switch (status & (3 << 10)) {
252 case 0 << 10: sig = "se0"; break;
253 case 1 << 10: sig = "k"; break; /* low speed */
254 case 2 << 10: sig = "j"; break;
255 default: sig = "?"; break;
258 return scnprintf (buf, len,
259 "%s%sport %d status %06x%s%s sig=%s%s%s%s%s%s%s%s%s%s",
260 label, label [0] ? " " : "", port, status,
261 (status & PORT_POWER) ? " POWER" : "",
262 (status & PORT_OWNER) ? " OWNER" : "",
264 (status & PORT_RESET) ? " RESET" : "",
265 (status & PORT_SUSPEND) ? " SUSPEND" : "",
266 (status & PORT_RESUME) ? " RESUME" : "",
267 (status & PORT_OCC) ? " OCC" : "",
268 (status & PORT_OC) ? " OC" : "",
269 (status & PORT_PEC) ? " PEC" : "",
270 (status & PORT_PE) ? " PE" : "",
271 (status & PORT_CSC) ? " CSC" : "",
272 (status & PORT_CONNECT) ? " CONNECT" : "");
276 static inline void __maybe_unused
277 dbg_qh (char *label, struct ehci_hcd *ehci, struct ehci_qh *qh)
280 static inline int __maybe_unused
281 dbg_status_buf (char *buf, unsigned len, const char *label, u32 status)
284 static inline int __maybe_unused
285 dbg_command_buf (char *buf, unsigned len, const char *label, u32 command)
288 static inline int __maybe_unused
289 dbg_intr_buf (char *buf, unsigned len, const char *label, u32 enable)
292 static inline int __maybe_unused
293 dbg_port_buf (char *buf, unsigned len, const char *label, int port, u32 status)
298 /* functions have the "wrong" filename when they're output... */
299 #define dbg_status(ehci, label, status) { \
301 dbg_status_buf (_buf, sizeof _buf, label, status); \
302 ehci_dbg (ehci, "%s\n", _buf); \
305 #define dbg_cmd(ehci, label, command) { \
307 dbg_command_buf (_buf, sizeof _buf, label, command); \
308 ehci_dbg (ehci, "%s\n", _buf); \
311 #define dbg_port(ehci, label, port, status) { \
313 dbg_port_buf (_buf, sizeof _buf, label, port, status); \
314 ehci_dbg (ehci, "%s\n", _buf); \
317 /*-------------------------------------------------------------------------*/
319 #ifdef STUB_DEBUG_FILES
321 static inline void create_debug_files (struct ehci_hcd *bus) { }
322 static inline void remove_debug_files (struct ehci_hcd *bus) { }
326 /* troubleshooting help: expose state in sysfs */
328 #define speed_char(info1) ({ char tmp; \
329 switch (info1 & (3 << 12)) { \
330 case 0 << 12: tmp = 'f'; break; \
331 case 1 << 12: tmp = 'l'; break; \
332 case 2 << 12: tmp = 'h'; break; \
333 default: tmp = '?'; break; \
336 static inline char token_mark(struct ehci_hcd *ehci, __hc32 token)
338 __u32 v = hc32_to_cpu(ehci, token);
340 if (v & QTD_STS_ACTIVE)
342 if (v & QTD_STS_HALT)
344 if (!IS_SHORT_READ (v))
346 /* tries to advance through hw_alt_next */
350 static void qh_lines (
351 struct ehci_hcd *ehci,
359 struct list_head *entry;
362 unsigned size = *sizep;
365 u32 list_end = EHCI_LIST_END(ehci);
367 if (qh->hw_qtd_next == list_end) /* NEC does this */
370 mark = token_mark(ehci, qh->hw_token);
371 if (mark == '/') { /* qh_alt_next controls qh advance? */
372 if ((qh->hw_alt_next & QTD_MASK(ehci))
373 == ehci->async->hw_alt_next)
374 mark = '#'; /* blocked */
375 else if (qh->hw_alt_next == list_end)
376 mark = '.'; /* use hw_qtd_next */
377 /* else alt_next points to some other qtd */
379 scratch = hc32_to_cpup(ehci, &qh->hw_info1);
380 hw_curr = (mark == '*') ? hc32_to_cpup(ehci, &qh->hw_current) : 0;
381 temp = scnprintf (next, size,
382 "qh/%p dev%d %cs ep%d %08x %08x (%08x%c %s nak%d)",
383 qh, scratch & 0x007f,
384 speed_char (scratch),
385 (scratch >> 8) & 0x000f,
386 scratch, hc32_to_cpup(ehci, &qh->hw_info2),
387 hc32_to_cpup(ehci, &qh->hw_token), mark,
388 (cpu_to_hc32(ehci, QTD_TOGGLE) & qh->hw_token)
390 (hc32_to_cpup(ehci, &qh->hw_alt_next) >> 1) & 0x0f);
394 /* hc may be modifying the list as we read it ... */
395 list_for_each (entry, &qh->qtd_list) {
396 td = list_entry (entry, struct ehci_qtd, qtd_list);
397 scratch = hc32_to_cpup(ehci, &td->hw_token);
399 if (hw_curr == td->qtd_dma)
401 else if (qh->hw_qtd_next == cpu_to_hc32(ehci, td->qtd_dma))
403 else if (QTD_LENGTH (scratch)) {
404 if (td->hw_alt_next == ehci->async->hw_alt_next)
406 else if (td->hw_alt_next != list_end)
409 temp = snprintf (next, size,
410 "\n\t%p%c%s len=%d %08x urb %p",
411 td, mark, ({ char *tmp;
412 switch ((scratch>>8)&0x03) {
413 case 0: tmp = "out"; break;
414 case 1: tmp = "in"; break;
415 case 2: tmp = "setup"; break;
416 default: tmp = "?"; break;
418 (scratch >> 16) & 0x7fff,
423 else if (size < temp)
431 temp = snprintf (next, size, "\n");
434 else if (size < temp)
445 show_async (struct class_device *class_dev, char *buf)
449 struct ehci_hcd *ehci;
457 bus = class_get_devdata(class_dev);
458 hcd = bus_to_hcd(bus);
459 ehci = hcd_to_ehci (hcd);
463 /* dumps a snapshot of the async schedule.
464 * usually empty except for long-term bulk reads, or head.
465 * one QH per line, and TDs we know about
467 spin_lock_irqsave (&ehci->lock, flags);
468 for (qh = ehci->async->qh_next.qh; size > 0 && qh; qh = qh->qh_next.qh)
469 qh_lines (ehci, qh, &next, &size);
470 if (ehci->reclaim && size > 0) {
471 temp = scnprintf (next, size, "\nreclaim =\n");
475 for (qh = ehci->reclaim; size > 0 && qh; qh = qh->reclaim)
476 qh_lines (ehci, qh, &next, &size);
478 spin_unlock_irqrestore (&ehci->lock, flags);
482 static CLASS_DEVICE_ATTR (async, S_IRUGO, show_async, NULL);
484 #define DBG_SCHED_LIMIT 64
487 show_periodic (struct class_device *class_dev, char *buf)
491 struct ehci_hcd *ehci;
493 union ehci_shadow p, *seen;
494 unsigned temp, size, seen_count;
499 if (!(seen = kmalloc (DBG_SCHED_LIMIT * sizeof *seen, GFP_ATOMIC)))
503 bus = class_get_devdata(class_dev);
504 hcd = bus_to_hcd(bus);
505 ehci = hcd_to_ehci (hcd);
509 temp = scnprintf (next, size, "size = %d\n", ehci->periodic_size);
513 /* dump a snapshot of the periodic schedule.
514 * iso changes, interrupt usually doesn't.
516 spin_lock_irqsave (&ehci->lock, flags);
517 for (i = 0; i < ehci->periodic_size; i++) {
518 p = ehci->pshadow [i];
521 tag = Q_NEXT_TYPE(ehci, ehci->periodic [i]);
523 temp = scnprintf (next, size, "%4d: ", i);
528 switch (hc32_to_cpu(ehci, tag)) {
530 temp = scnprintf (next, size, " qh%d-%04x/%p",
535 & (QH_CMASK | QH_SMASK),
539 /* don't repeat what follows this qh */
540 for (temp = 0; temp < seen_count; temp++) {
541 if (seen [temp].ptr != p.ptr)
543 if (p.qh->qh_next.ptr)
544 temp = scnprintf (next, size,
549 /* show more info the first time around */
550 if (temp == seen_count && p.ptr) {
551 u32 scratch = hc32_to_cpup(ehci,
553 struct ehci_qtd *qtd;
556 /* count tds, get ep direction */
558 list_for_each_entry (qtd,
562 switch (0x03 & (hc32_to_cpu(
564 qtd->hw_token) >> 8)) {
565 case 0: type = "out"; continue;
566 case 1: type = "in"; continue;
570 temp = scnprintf (next, size,
573 speed_char (scratch),
575 (scratch >> 8) & 0x000f, type,
576 p.qh->usecs, p.qh->c_usecs,
578 0x7ff & (scratch >> 16));
580 if (seen_count < DBG_SCHED_LIMIT)
581 seen [seen_count++].qh = p.qh;
585 tag = Q_NEXT_TYPE(ehci, p.qh->hw_next);
590 temp = scnprintf (next, size,
591 " fstn-%8x/%p", p.fstn->hw_prev,
593 tag = Q_NEXT_TYPE(ehci, p.fstn->hw_next);
594 p = p.fstn->fstn_next;
597 temp = scnprintf (next, size,
599 tag = Q_NEXT_TYPE(ehci, p.itd->hw_next);
603 temp = scnprintf (next, size,
605 p.sitd->stream->interval,
606 hc32_to_cpup(ehci, &p.sitd->hw_uframe)
609 tag = Q_NEXT_TYPE(ehci, p.sitd->hw_next);
610 p = p.sitd->sitd_next;
617 temp = scnprintf (next, size, "\n");
621 spin_unlock_irqrestore (&ehci->lock, flags);
624 return PAGE_SIZE - size;
626 static CLASS_DEVICE_ATTR (periodic, S_IRUGO, show_periodic, NULL);
628 #undef DBG_SCHED_LIMIT
631 show_registers (struct class_device *class_dev, char *buf)
635 struct ehci_hcd *ehci;
637 unsigned temp, size, i;
638 char *next, scratch [80];
639 static char fmt [] = "%*s\n";
640 static char label [] = "";
642 bus = class_get_devdata(class_dev);
643 hcd = bus_to_hcd(bus);
644 ehci = hcd_to_ehci (hcd);
648 spin_lock_irqsave (&ehci->lock, flags);
650 if (bus->controller->power.power_state.event) {
651 size = scnprintf (next, size,
652 "bus %s, device %s (driver " DRIVER_VERSION ")\n"
654 "SUSPENDED (no register access)\n",
655 hcd->self.controller->bus->name,
656 hcd->self.controller->bus_id,
661 /* Capability Registers */
662 i = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase));
663 temp = scnprintf (next, size,
664 "bus %s, device %s (driver " DRIVER_VERSION ")\n"
666 "EHCI %x.%02x, hcd state %d\n",
667 hcd->self.controller->bus->name,
668 hcd->self.controller->bus_id,
670 i >> 8, i & 0x0ff, hcd->state);
675 /* EHCI 0.96 and later may have "extended capabilities" */
676 if (hcd->self.controller->bus == &pci_bus_type) {
677 struct pci_dev *pdev;
678 u32 offset, cap, cap2;
679 unsigned count = 256/4;
681 pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller);
682 offset = HCC_EXT_CAPS(ehci_readl(ehci,
683 &ehci->caps->hcc_params));
684 while (offset && count--) {
685 pci_read_config_dword (pdev, offset, &cap);
686 switch (cap & 0xff) {
688 temp = scnprintf (next, size,
689 "ownership %08x%s%s\n", cap,
690 (cap & (1 << 24)) ? " linux" : "",
691 (cap & (1 << 16)) ? " firmware" : "");
696 pci_read_config_dword (pdev, offset, &cap2);
697 temp = scnprintf (next, size,
698 "SMI sts/enable 0x%08x\n", cap2);
702 case 0: /* illegal reserved capability */
705 default: /* unknown */
708 temp = (cap >> 8) & 0xff;
713 // FIXME interpret both types of params
714 i = ehci_readl(ehci, &ehci->caps->hcs_params);
715 temp = scnprintf (next, size, "structural params 0x%08x\n", i);
719 i = ehci_readl(ehci, &ehci->caps->hcc_params);
720 temp = scnprintf (next, size, "capability params 0x%08x\n", i);
724 /* Operational Registers */
725 temp = dbg_status_buf (scratch, sizeof scratch, label,
726 ehci_readl(ehci, &ehci->regs->status));
727 temp = scnprintf (next, size, fmt, temp, scratch);
731 temp = dbg_command_buf (scratch, sizeof scratch, label,
732 ehci_readl(ehci, &ehci->regs->command));
733 temp = scnprintf (next, size, fmt, temp, scratch);
737 temp = dbg_intr_buf (scratch, sizeof scratch, label,
738 ehci_readl(ehci, &ehci->regs->intr_enable));
739 temp = scnprintf (next, size, fmt, temp, scratch);
743 temp = scnprintf (next, size, "uframe %04x\n",
744 ehci_readl(ehci, &ehci->regs->frame_index));
748 for (i = 1; i <= HCS_N_PORTS (ehci->hcs_params); i++) {
749 temp = dbg_port_buf (scratch, sizeof scratch, label, i,
751 &ehci->regs->port_status[i - 1]));
752 temp = scnprintf (next, size, fmt, temp, scratch);
755 if (i == HCS_DEBUG_PORT(ehci->hcs_params) && ehci->debug) {
756 temp = scnprintf (next, size,
757 " debug control %08x\n",
759 &ehci->debug->control));
766 temp = scnprintf (next, size, "reclaim qh %p%s\n",
768 ehci->reclaim_ready ? " ready" : "");
774 temp = scnprintf (next, size,
775 "irq normal %ld err %ld reclaim %ld (lost %ld)\n",
776 ehci->stats.normal, ehci->stats.error, ehci->stats.reclaim,
777 ehci->stats.lost_iaa);
781 temp = scnprintf (next, size, "complete %ld unlink %ld\n",
782 ehci->stats.complete, ehci->stats.unlink);
788 spin_unlock_irqrestore (&ehci->lock, flags);
790 return PAGE_SIZE - size;
792 static CLASS_DEVICE_ATTR (registers, S_IRUGO, show_registers, NULL);
794 static inline void create_debug_files (struct ehci_hcd *ehci)
796 struct class_device *cldev = ehci_to_hcd(ehci)->self.class_dev;
799 retval = class_device_create_file(cldev, &class_device_attr_async);
800 retval = class_device_create_file(cldev, &class_device_attr_periodic);
801 retval = class_device_create_file(cldev, &class_device_attr_registers);
804 static inline void remove_debug_files (struct ehci_hcd *ehci)
806 struct class_device *cldev = ehci_to_hcd(ehci)->self.class_dev;
808 class_device_remove_file(cldev, &class_device_attr_async);
809 class_device_remove_file(cldev, &class_device_attr_periodic);
810 class_device_remove_file(cldev, &class_device_attr_registers);
813 #endif /* STUB_DEBUG_FILES */