aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Senna Tschudin <peter.senna@gmail.com>2015-10-12 17:22:39 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-17 02:46:27 -0400
commit32fb1939e3921691c71f7cd274d80d487af72fae (patch)
tree056d77446b29b3583ae2235011d61bb2a60c803c
parentc4d66b5f8da338482005cf7f3dd2fcdaed09dd3f (diff)
usb/host/fotg210: Add function: output_buf_tds_dir()
checkpatch complains about too many leading tabs because the switch statement starts after 6 tabs. fill_periodic_buffer() -> for() -> do -> switch() -> if() -> list_for_each_entry() and finally the last switch(). This patch moves the list_for_each_entry() and the last switch() to a new function named output_buf_tds_dir(). This change makes the code easier to read and calm down checkpatch. This patch changes it to: fill_periodic_buffer() -> for() -> do -> switch() -> if() -> output_buf_tds_dir() Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/fotg210-hcd.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index 158423230a88..eb825c5ab327 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -493,6 +493,34 @@ static ssize_t fill_async_buffer(struct debug_buffer *buf)
493 return strlen(buf->output_buf); 493 return strlen(buf->output_buf);
494} 494}
495 495
496/* count tds, get ep direction */
497static unsigned output_buf_tds_dir(char *buf, struct fotg210_hcd *fotg210,
498 struct fotg210_qh_hw *hw, struct fotg210_qh *qh, unsigned size)
499{
500 u32 scratch = hc32_to_cpup(fotg210, &hw->hw_info1);
501 struct fotg210_qtd *qtd;
502 char *type = "";
503 unsigned temp = 0;
504
505 /* count tds, get ep direction */
506 list_for_each_entry(qtd, &qh->qtd_list, qtd_list) {
507 temp++;
508 switch ((hc32_to_cpu(fotg210, qtd->hw_token) >> 8) & 0x03) {
509 case 0:
510 type = "out";
511 continue;
512 case 1:
513 type = "in";
514 continue;
515 }
516 }
517
518 return scnprintf(buf, size, "(%c%d ep%d%s [%d/%d] q%d p%d)",
519 speed_char(scratch), scratch & 0x007f,
520 (scratch >> 8) & 0x000f, type, qh->usecs,
521 qh->c_usecs, temp, (scratch >> 16) & 0x7ff);
522}
523
496#define DBG_SCHED_LIMIT 64 524#define DBG_SCHED_LIMIT 64
497static ssize_t fill_periodic_buffer(struct debug_buffer *buf) 525static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
498{ 526{
@@ -564,37 +592,9 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
564 } 592 }
565 /* show more info the first time around */ 593 /* show more info the first time around */
566 if (temp == seen_count) { 594 if (temp == seen_count) {
567 u32 scratch = hc32_to_cpup(fotg210, 595 temp = output_buf_tds_dir(next,
568 &hw->hw_info1); 596 fotg210, hw,
569 struct fotg210_qtd *qtd; 597 p.qh, size);
570 char *type = "";
571
572 /* count tds, get ep direction */
573 temp = 0;
574 list_for_each_entry(qtd,
575 &p.qh->qtd_list,
576 qtd_list) {
577 temp++;
578 switch (0x03 & (hc32_to_cpu(
579 fotg210,
580 qtd->hw_token) >> 8)) {
581 case 0:
582 type = "out";
583 continue;
584 case 1:
585 type = "in";
586 continue;
587 }
588 }
589
590 temp = scnprintf(next, size,
591 "(%c%d ep%d%s [%d/%d] q%d p%d)",
592 speed_char(scratch),
593 scratch & 0x007f,
594 (scratch >> 8) & 0x000f, type,
595 p.qh->usecs, p.qh->c_usecs,
596 temp,
597 0x7ff & (scratch >> 16));
598 598
599 if (seen_count < DBG_SCHED_LIMIT) 599 if (seen_count < DBG_SCHED_LIMIT)
600 seen[seen_count++].qh = p.qh; 600 seen[seen_count++].qh = p.qh;