Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1229678

Re: [PATCH 09/14] RFC: usb/host/fotg210: Add function: output_buf_tds_dir()

From Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Newsgroups linux.kernel
Subject Re: [PATCH 09/14] RFC: usb/host/fotg210: Add function: output_buf_tds_dir()
Date 2015-09-21 21:20 +0200
Message-ID <qbeN4-7m5-27@gated-at.bofh.it> (permalink)
References <q91Kj-2gb-19@gated-at.bofh.it> <qbaT7-1N0-3@gated-at.bofh.it> <qbaT7-1N0-11@gated-at.bofh.it>
Organization Cogent Embedded

Show all headers | View raw


On 09/21/2015 06:01 PM, Peter Senna Tschudin wrote:

> 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,

    Please drop *inline*, let gcc figure it out.

> +					  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)) {

    I think the preference is to place immediate value after &.

> +		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));

    Likewise.

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

similar files: fusbh200-hcd.c and fotg210-hcd.c Peter Senna Tschudin <peter.senna@gmail.com> - 2015-09-07 16:50 +0200
  Re: similar files: fusbh200-hcd.c and fotg210-hcd.c Felipe Balbi <balbi@ti.com> - 2015-09-08 18:00 +0200
    Re: similar files: fusbh200-hcd.c and fotg210-hcd.c Peter Senna Tschudin <peter.senna@gmail.com> - 2015-09-12 15:20 +0200
      Re: similar files: fusbh200-hcd.c and fotg210-hcd.c Felipe Balbi <balbi@ti.com> - 2015-09-14 17:10 +0200
        Re: similar files: fusbh200-hcd.c and fotg210-hcd.c Peter Senna Tschudin <peter.senna@gmail.com> - 2015-09-14 20:00 +0200
          Re: similar files: fusbh200-hcd.c and fotg210-hcd.c Felipe Balbi <balbi@ti.com> - 2015-09-15 16:40 +0200
            Re: similar files: fusbh200-hcd.c and fotg210-hcd.c Peter Senna Tschudin <peter.senna@gmail.com> - 2015-09-15 18:50 +0200
              Re: similar files: fusbh200-hcd.c and fotg210-hcd.c Felipe Balbi <balbi@ti.com> - 2015-09-15 19:00 +0200
                [PATCH 08/14] RFC: usb/host/fotg210: convert macro to inline function Peter Senna Tschudin <peter.senna@gmail.com> - 2015-09-21 17:10 +0200
                Re: [PATCH 08/14] RFC: usb/host/fotg210: convert macro to inline  function Felipe Balbi <balbi@ti.com> - 2015-10-02 19:40 +0200
                [PATCH 09/14] RFC: usb/host/fotg210: Add function: output_buf_tds_dir() Peter Senna Tschudin <peter.senna@gmail.com> - 2015-09-21 17:10 +0200
                Re: [PATCH 09/14] RFC: usb/host/fotg210: Add function:  output_buf_tds_dir() Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-09-21 21:20 +0200
                Re: [PATCH 09/14] RFC: usb/host/fotg210: Add function:  output_buf_tds_dir() Felipe Balbi <balbi@ti.com> - 2015-10-02 19:40 +0200
                [PATCH 14/14] RFC: usb/host/faraday-hcd: Import FUSBH200 parameters Peter Senna Tschudin <peter.senna@gmail.com> - 2015-09-21 17:10 +0200
                Re: [PATCH 14/14] RFC: usb/host/faraday-hcd: Import FUSBH200  parameters Felipe Balbi <balbi@ti.com> - 2015-10-02 19:40 +0200
                [PATCH 00/14] RFC: Consolidation: FUSB200 and FOTG210 Peter Senna Tschudin <peter.senna@gmail.com> - 2015-09-21 17:10 +0200
                [PATCH 04/14] RFC: usb/host/fotg210: Remove NULL checks dma_pool_destroy Peter Senna Tschudin <peter.senna@gmail.com> - 2015-09-21 17:10 +0200
                Re: [PATCH 04/14] RFC: usb/host/fotg210: Remove NULL checks  dma_pool_destroy Felipe Balbi <balbi@ti.com> - 2015-10-02 19:40 +0200
                [PATCH 03/14] RFC: usb/host/fotg210: Remove useless else statement Peter Senna Tschudin <peter.senna@gmail.com> - 2015-09-21 17:10 +0200
                Re: [PATCH 03/14] RFC: usb/host/fotg210: Remove useless else  statement Felipe Balbi <balbi@ti.com> - 2015-10-02 19:40 +0200
                [PATCH 10/14] RFC: usb/host/fotg210: Add function scan_frame_queue() Peter Senna Tschudin <peter.senna@gmail.com> - 2015-09-21 17:10 +0200
                Re: [PATCH 10/14] RFC: usb/host/fotg210: Add function  scan_frame_queue() Felipe Balbi <balbi@ti.com> - 2015-10-02 19:40 +0200
                [PATCH 06/14] RFC: usb/host/fotg210: replace msleep by usleep_range Peter Senna Tschudin <peter.senna@gmail.com> - 2015-09-21 17:10 +0200
                Re: [PATCH 06/14] RFC: usb/host/fotg210: replace msleep by  usleep_range Felipe Balbi <balbi@ti.com> - 2015-10-02 19:40 +0200
                Re: [PATCH 06/14] RFC: usb/host/fotg210: replace msleep by usleep_range Alan Stern <stern@rowland.harvard.edu> - 2015-10-02 20:00 +0200
                Re: [PATCH 06/14] RFC: usb/host/fotg210: replace msleep by usleep_range Peter Senna Tschudin <peter.senna@gmail.com> - 2015-10-04 12:00 +0200
                Re: [PATCH 06/14] RFC: usb/host/fotg210: replace msleep by usleep_range Alan Stern <stern@rowland.harvard.edu> - 2015-10-04 17:30 +0200
                [PATCH 02/14] RFC: usb/host/fotg210: remove KERN_WARNING from pr_info Peter Senna Tschudin <peter.senna@gmail.com> - 2015-09-21 17:10 +0200
                Re: [PATCH 02/14] RFC: usb/host/fotg210: remove KERN_WARNING from  pr_info Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-09-21 21:00 +0200
                Re: [PATCH 02/14] RFC: usb/host/fotg210: remove KERN_WARNING from  pr_info Felipe Balbi <balbi@ti.com> - 2015-10-02 19:40 +0200
                [PATCH 05/14] RFC: usb/host/fotg210: change kmalloc by kmalloc_array Peter Senna Tschudin <peter.senna@gmail.com> - 2015-09-21 17:10 +0200
                Re: [PATCH 05/14] RFC: usb/host/fotg210: change kmalloc by  kmalloc_array Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-09-21 21:00 +0200
                Re: [PATCH 05/14] RFC: usb/host/fotg210: change kmalloc by  kmalloc_array Felipe Balbi <balbi@ti.com> - 2015-10-02 19:40 +0200
                [PATCH 13/14] RFC: usb/host/faraday-hcd: Move #defines outside struct Peter Senna Tschudin <peter.senna@gmail.com> - 2015-09-21 17:10 +0200
                Re: [PATCH 13/14] RFC: usb/host/faraday-hcd: Move #defines outside  struct Felipe Balbi <balbi@ti.com> - 2015-10-02 19:40 +0200
                [PATCH 07/14] RFC: usb/host/fotg210: Remove a macro from snprintf Peter Senna Tschudin <peter.senna@gmail.com> - 2015-09-21 17:10 +0200
                Re: [PATCH 07/14] RFC: usb/host/fotg210: Remove a macro from snprintf Felipe Balbi <balbi@ti.com> - 2015-10-02 19:40 +0200
                Re: [PATCH 01/14] RFC: usb/host/fotg210: Fix coding style issues Felipe Balbi <balbi@ti.com> - 2015-10-02 19:30 +0200
                Re: [PATCH 12/14] RFC: usb/host/faraday-hcd: Replace fotg210 by  fhcd2xx Felipe Balbi <balbi@ti.com> - 2015-10-02 19:40 +0200
                Re: [PATCH 11/14] RFC: usb/host: Rename fotg210-hcd to faraday-hcd Felipe Balbi <balbi@ti.com> - 2015-10-02 19:40 +0200
                Re: [PATCH] usb-host: Remove fusbh200 driver Felipe Balbi <balbi@ti.com> - 2015-10-02 19:50 +0200
                Re: [PATCH] usb-host: Remove fusbh200 driver Peter Senna Tschudin <peter.senna@gmail.com> - 2015-10-03 12:00 +0200
                Re: [PATCH] usb-host: Remove fusbh200 driver Felipe Balbi <balbi@ti.com> - 2015-10-03 23:30 +0200
                RE: [PATCH] usb-host: Remove fusbh200 driver John Feng-Hsin Chiang(江峰興)   <john453@faraday-tech.com> - 2015-10-05 02:50 +0200
                Re: similar files: fusbh200-hcd.c and fotg210-hcd.c Peter Senna Tschudin <peter.senna@gmail.com> - 2015-09-25 15:10 +0200

csiph-web