From: Peter Senna Tschudin <peter.senna@gmail.com>
To: balbi@ti.com, stern@rowland.harvard.edu,
sergei.shtylyov@cogentembedded.com, standby24x7@gmail.com,
pmladek@suse.cz, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org
Cc: Peter Senna Tschudin <peter.senna@gmail.com>
Subject: [PATCH 09/14] RFC: usb/host/fotg210: Add function: output_buf_tds_dir()
Date: Mon, 21 Sep 2015 17:01:13 +0200 [thread overview]
Message-ID: <1442847678-7970-10-git-send-email-peter.senna@gmail.com> (raw)
In-Reply-To: <1442847678-7970-1-git-send-email-peter.senna@gmail.com>
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 inline 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>
---
drivers/usb/host/fotg210-hcd.c | 64 ++++++++++++++++++++++--------------------
1 file changed, 33 insertions(+), 31 deletions(-)
diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index 82cd5da..13cca41 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -497,6 +497,36 @@ static ssize_t fill_async_buffer(struct debug_buffer *buf)
return strlen(buf->output_buf);
}
+/* count tds, get ep direction */
+static inline unsigned output_buf_tds_dir(char *buf,
+ struct fotg210_hcd *fotg210,
+ struct fotg210_qh_hw *hw,
+ struct fotg210_qh *qh, unsigned size)
+{
+ u32 scratch = hc32_to_cpup(fotg210, &hw->hw_info1);
+ struct fotg210_qtd *qtd;
+ char *type = "";
+ unsigned temp = 0;
+
+ /* count tds, get ep direction */
+ list_for_each_entry(qtd, &qh->qtd_list, qtd_list) {
+ temp++;
+ switch (0x03 & (hc32_to_cpu(fotg210, qtd->hw_token) >> 8)) {
+ case 0:
+ type = "out";
+ continue;
+ case 1:
+ type = "in";
+ continue;
+ }
+ }
+
+ return scnprintf(buf, size, "(%c%d ep%d%s [%d/%d] q%d p%d)",
+ speed_char(scratch), scratch & 0x007f,
+ (scratch >> 8) & 0x000f, type, qh->usecs,
+ qh->c_usecs, temp, 0x7ff & (scratch >> 16));
+}
+
#define DBG_SCHED_LIMIT 64
static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
{
@@ -568,37 +598,9 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
}
/* show more info the first time around */
if (temp == seen_count) {
- u32 scratch = hc32_to_cpup(fotg210,
- &hw->hw_info1);
- struct fotg210_qtd *qtd;
- char *type = "";
-
- /* count tds, get ep direction */
- temp = 0;
- list_for_each_entry(qtd,
- &p.qh->qtd_list,
- qtd_list) {
- temp++;
- switch (0x03 & (hc32_to_cpu(
- fotg210,
- qtd->hw_token) >> 8)) {
- case 0:
- type = "out";
- continue;
- case 1:
- type = "in";
- continue;
- }
- }
-
- temp = scnprintf(next, size,
- "(%c%d ep%d%s [%d/%d] q%d p%d)",
- speed_char(scratch),
- scratch & 0x007f,
- (scratch >> 8) & 0x000f, type,
- p.qh->usecs, p.qh->c_usecs,
- temp,
- 0x7ff & (scratch >> 16));
+ temp = output_buf_tds_dir(next,
+ fotg210, hw,
+ p.qh, size);
if (seen_count < DBG_SCHED_LIMIT)
seen[seen_count++].qh = p.qh;
--
2.1.0
next prev parent reply other threads:[~2015-09-21 15:04 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-07 14:47 similar files: fusbh200-hcd.c and fotg210-hcd.c Peter Senna Tschudin
2015-09-08 15:52 ` Felipe Balbi
2015-09-12 13:14 ` Peter Senna Tschudin
2015-09-14 15:01 ` Felipe Balbi
2015-09-14 17:50 ` Peter Senna Tschudin
2015-09-15 14:33 ` Felipe Balbi
2015-09-15 16:41 ` Peter Senna Tschudin
2015-09-15 16:50 ` Felipe Balbi
2015-09-21 15:01 ` [PATCH 00/14] RFC: Consolidation: FUSB200 and FOTG210 Peter Senna Tschudin
2015-09-21 15:01 ` [PATCH 01/14] RFC: usb/host/fotg210: Fix coding style issues Peter Senna Tschudin
2015-10-02 17:29 ` Felipe Balbi
2015-09-21 15:01 ` [PATCH 02/14] RFC: usb/host/fotg210: remove KERN_WARNING from pr_info Peter Senna Tschudin
2015-09-21 18:54 ` Sergei Shtylyov
2015-10-02 17:30 ` Felipe Balbi
2015-09-21 15:01 ` [PATCH 03/14] RFC: usb/host/fotg210: Remove useless else statement Peter Senna Tschudin
2015-10-02 17:30 ` Felipe Balbi
2015-09-21 15:01 ` [PATCH 04/14] RFC: usb/host/fotg210: Remove NULL checks dma_pool_destroy Peter Senna Tschudin
2015-10-02 17:30 ` Felipe Balbi
2015-09-21 15:01 ` [PATCH 05/14] RFC: usb/host/fotg210: change kmalloc by kmalloc_array Peter Senna Tschudin
2015-09-21 18:56 ` Sergei Shtylyov
2015-10-02 17:30 ` Felipe Balbi
2015-09-21 15:01 ` [PATCH 06/14] RFC: usb/host/fotg210: replace msleep by usleep_range Peter Senna Tschudin
2015-10-02 17:31 ` Felipe Balbi
2015-10-02 17:52 ` Alan Stern
2015-10-04 9:58 ` Peter Senna Tschudin
2015-10-04 15:20 ` Alan Stern
2015-09-21 15:01 ` [PATCH 07/14] RFC: usb/host/fotg210: Remove a macro from snprintf Peter Senna Tschudin
2015-10-02 17:31 ` Felipe Balbi
2015-09-21 15:01 ` [PATCH 08/14] RFC: usb/host/fotg210: convert macro to inline function Peter Senna Tschudin
2015-10-02 17:32 ` Felipe Balbi
2015-09-21 15:01 ` Peter Senna Tschudin [this message]
2015-09-21 19:15 ` [PATCH 09/14] RFC: usb/host/fotg210: Add function: output_buf_tds_dir() Sergei Shtylyov
2015-10-02 17:32 ` Felipe Balbi
2015-09-21 15:01 ` [PATCH 10/14] RFC: usb/host/fotg210: Add function scan_frame_queue() Peter Senna Tschudin
2015-10-02 17:35 ` Felipe Balbi
2015-09-21 15:01 ` [PATCH 11/14] RFC: usb/host: Rename fotg210-hcd to faraday-hcd Peter Senna Tschudin
2015-10-02 17:35 ` Felipe Balbi
2015-09-21 15:01 ` [PATCH 12/14] RFC: usb/host/faraday-hcd: Replace fotg210 by fhcd2xx Peter Senna Tschudin
2015-10-02 17:36 ` Felipe Balbi
2015-09-21 15:01 ` [PATCH 13/14] RFC: usb/host/faraday-hcd: Move #defines outside struct Peter Senna Tschudin
2015-10-02 17:37 ` Felipe Balbi
2015-09-21 15:01 ` [PATCH 14/14] RFC: usb/host/faraday-hcd: Import FUSBH200 parameters Peter Senna Tschudin
2015-10-02 17:38 ` Felipe Balbi
2015-10-02 11:18 ` [PATCH] usb-host: Remove fusbh200 driver Peter Senna Tschudin
2015-10-02 17:39 ` Felipe Balbi
2015-10-03 9:56 ` Peter Senna Tschudin
2015-10-03 21:21 ` Felipe Balbi
2015-10-05 0:25 ` John Feng-Hsin Chiang(江峰興)
2015-10-12 21:22 ` [PATCH 0/9] usb/host/fotg210: code style and warning fixes Peter Senna Tschudin
2015-10-12 21:22 ` [PATCH 1/9] usb/host/fotg210: Fix coding style issues Peter Senna Tschudin
2015-10-12 21:22 ` [PATCH 2/9] usb/host/fotg210: remove KERN_WARNING from pr_warn Peter Senna Tschudin
2015-10-12 21:22 ` [PATCH 3/9] usb/host/fotg210: Remove useless else statement Peter Senna Tschudin
2015-10-12 22:06 ` Joe Perches
2015-10-17 19:28 ` [PATCH 3/9 V2] usb/host/fotg210: Remove return statement inside if Peter Senna Tschudin
2015-10-12 21:22 ` [PATCH 4/9] usb/host/fotg210: Remove NULL checks dma_pool_destroy Peter Senna Tschudin
2015-10-12 21:22 ` [PATCH 5/9] usb/host/fotg210: change kmalloc by kmalloc_array Peter Senna Tschudin
2015-10-12 21:22 ` [PATCH 6/9] usb/host/fotg210: replace msleep by usleep_range Peter Senna Tschudin
2015-10-12 21:22 ` [PATCH 7/9] usb/host/fotg210: convert macro to inline function Peter Senna Tschudin
2015-10-12 21:22 ` [PATCH 8/9] usb/host/fotg210: Add function: output_buf_tds_dir() Peter Senna Tschudin
2015-10-12 21:22 ` [PATCH 9/9] usb/host/fotg210: Add function scan_frame_queue() Peter Senna Tschudin
2015-09-25 13:04 ` similar files: fusbh200-hcd.c and fotg210-hcd.c Peter Senna Tschudin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1442847678-7970-10-git-send-email-peter.senna@gmail.com \
--to=peter.senna@gmail.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=pmladek@suse.cz \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=standby24x7@gmail.com \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).