lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 2 Oct 2015 12:32:39 -0500
From:	Felipe Balbi <balbi@...com>
To:	Peter Senna Tschudin <peter.senna@...il.com>
CC:	<balbi@...com>, <stern@...land.harvard.edu>,
	<sergei.shtylyov@...entembedded.com>, <standby24x7@...il.com>,
	<pmladek@...e.cz>, <linux-usb@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <gregkh@...uxfoundation.org>
Subject: Re: [PATCH 09/14] RFC: usb/host/fotg210: Add function:
 output_buf_tds_dir()

On Mon, Sep 21, 2015 at 05:01:13PM +0200, 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@...il.com>

if you fix Sergei's comment, then I'm okay with $subject

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

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ