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


Groups > linux.kernel > #1301043 > unrolled thread

[PATCH 00/17] usb: host: ehci-dbg: cleanup and refactoring

Started by"Geyslan G. Bem" <geyslan@gmail.com>
First post2016-01-04 21:20 +0100
Last post2016-01-04 22:50 +0100
Articles 16 — 5 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 00/17] usb: host: ehci-dbg: cleanup and refactoring "Geyslan G. Bem" <geyslan@gmail.com> - 2016-01-04 21:20 +0100
    [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function "Geyslan G. Bem" <geyslan@gmail.com> - 2016-01-04 21:20 +0100
      Re: [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer  function Alan Stern <stern@rowland.harvard.edu> - 2016-01-04 22:10 +0100
        Re: [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function "Geyslan G. Bem" <geyslan@gmail.com> - 2016-01-05 02:20 +0100
          Re: [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer  function Alan Stern <stern@rowland.harvard.edu> - 2016-01-05 16:20 +0100
            Re: [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function "Geyslan G. Bem" <geyslan@gmail.com> - 2016-01-05 16:50 +0100
    [PATCH 10/17] usb: host: ehci-dbg: use a blank line after struct declarations "Geyslan G. Bem" <geyslan@gmail.com> - 2016-01-04 21:20 +0100
    [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast "Geyslan G. Bem" <geyslan@gmail.com> - 2016-01-04 21:30 +0100
      Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space  after cast Alan Stern <stern@rowland.harvard.edu> - 2016-01-04 22:00 +0100
        Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space  after cast Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-01-04 22:50 +0100
          Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after  cast Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-01-04 23:00 +0100
            Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast "Geyslan G. Bem" <geyslan@gmail.com> - 2016-01-04 23:10 +0100
              Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space  after cast Joe Perches <joe@perches.com> - 2016-01-05 03:50 +0100
                Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast "Geyslan G. Bem" <geyslan@gmail.com> - 2016-01-05 16:20 +0100
                Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space  after cast Alan Stern <stern@rowland.harvard.edu> - 2016-01-05 17:50 +0100
        Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast "Geyslan G. Bem" <geyslan@gmail.com> - 2016-01-04 22:50 +0100

#1301043 — [PATCH 00/17] usb: host: ehci-dbg: cleanup and refactoring

From"Geyslan G. Bem" <geyslan@gmail.com>
Date2016-01-04 21:20 +0100
Subject[PATCH 00/17] usb: host: ehci-dbg: cleanup and refactoring
Message-ID<qNjLI-8i4-5@gated-at.bofh.it>
This patchset removes all errors reported by checkpatch in addition to
some refactoring.

Geyslan G. Bem (17):
  usb: host: ehci-dbg: remove space before open parenthesis
  usb: host: ehci-dbg: remove space before open square bracket
  usb: host: ehci-dbg: use C89-style comments
  usb: host: ehci-dbg: move trailing statements to next line
  usb: host: ehci-dbg: fix up closing parenthesis
  usb: host: ehci-dbg: put spaces around operators
  usb: host: ehci-dbg: fix unsigned comparison
  usb: host: ehci-dbg: remove unnecessary space after cast
  usb: host: ehci-dbg: fix up function definitions
  usb: host: ehci-dbg: use a blank line after struct declarations
  usb: host: ehci-dbg: convert macro to inline function
  usb: host: ehci-dbg: add blank line after declarations
  usb: host: ehci-dbg: remove blank line before close brace
  usb: host: ehci-dbg: replace sizeof operand
  usb: host: ehci-dbg: enclose conditional blocks with braces
  usb: host: ehci-dbg: prefer kmalloc_array over kmalloc times size
  usb: host: ehci-dbg: refactor fill_periodic_buffer function

 drivers/usb/host/ehci-dbg.c | 585 ++++++++++++++++++++++++--------------------
 1 file changed, 315 insertions(+), 270 deletions(-)

-- 
2.6.4

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

[toc] | [next] | [standalone]


#1301046 — [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function

From"Geyslan G. Bem" <geyslan@gmail.com>
Date2016-01-04 21:20 +0100
Subject[PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function
Message-ID<qNjLL-8i4-71@gated-at.bofh.it>
In reply to#1301043
This patch fixes a coding style issue reported by checkpatch related to
many leading tabs, removing a 'do while' loop and making use of goto tag instead.

Others changes in this patch are:
 - Some multiline statements are reduced (718, 729, 780, 786, 790).
 - A constant is moved to right on line 770.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---

Notes:
    Tested by compilation only.

 drivers/usb/host/ehci-dbg.c | 180 ++++++++++++++++++++++----------------------
 1 file changed, 88 insertions(+), 92 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 2268756..278333d 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -698,6 +698,8 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
 	 */
 	spin_lock_irqsave(&ehci->lock, flags);
 	for (i = 0; i < ehci->periodic_size; i++) {
+		struct ehci_qh_hw *hw;
+
 		p = ehci->pshadow[i];
 		if (likely(!p.ptr))
 			continue;
@@ -707,104 +709,98 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
 		size -= temp;
 		next += temp;
 
-		do {
-			struct ehci_qh_hw *hw;
-
-			switch (hc32_to_cpu(ehci, tag)) {
-			case Q_TYPE_QH:
-				hw = p.qh->hw;
-				temp = scnprintf(next, size, " qh%d-%04x/%p",
-						p.qh->ps.period,
-						hc32_to_cpup(ehci,
-							&hw->hw_info2)
-							/* uframe masks */
-							& (QH_CMASK | QH_SMASK),
-						p.qh);
-				size -= temp;
-				next += temp;
-				/* don't repeat what follows this qh */
-				for (temp = 0; temp < seen_count; temp++) {
-					if (seen[temp].ptr != p.ptr)
+do_loop:
+		switch (hc32_to_cpu(ehci, tag)) {
+		case Q_TYPE_QH:
+			hw = p.qh->hw;
+			temp = scnprintf(next, size, " qh%d-%04x/%p",
+					p.qh->ps.period,
+					hc32_to_cpup(ehci, &hw->hw_info2)
+						/* uframe masks */
+						& (QH_CMASK | QH_SMASK),
+					p.qh);
+			size -= temp;
+			next += temp;
+			/* don't repeat what follows this qh */
+			for (temp = 0; temp < seen_count; temp++) {
+				if (seen[temp].ptr != p.ptr)
+					continue;
+				if (p.qh->qh_next.ptr) {
+					temp = scnprintf(next, size, " ...");
+					size -= temp;
+					next += temp;
+				}
+				break;
+			}
+			/* show more info the first time around */
+			if (temp == seen_count) {
+				u32	scratch = hc32_to_cpup(ehci,
+						&hw->hw_info1);
+				struct ehci_qtd	*qtd;
+				char		*type = "";
+
+				/* count tds, get ep direction */
+				temp = 0;
+				list_for_each_entry(qtd,
+						&p.qh->qtd_list,
+						qtd_list) {
+					temp++;
+					switch ((hc32_to_cpu(ehci,
+						qtd->hw_token) >> 8)
+							& 0x03) {
+					case 0:
+						type = "out";
+						continue;
+					case 1:
+						type = "in";
 						continue;
-					if (p.qh->qh_next.ptr) {
-						temp = scnprintf(next, size,
-							" ...");
-						size -= temp;
-						next += temp;
 					}
-					break;
 				}
-				/* show more info the first time around */
-				if (temp == seen_count) {
-					u32	scratch = hc32_to_cpup(ehci,
-							&hw->hw_info1);
-					struct ehci_qtd	*qtd;
-					char		*type = "";
-
-					/* count tds, get ep direction */
-					temp = 0;
-					list_for_each_entry(qtd,
-							&p.qh->qtd_list,
-							qtd_list) {
-						temp++;
-						switch ((hc32_to_cpu(ehci,
-							qtd->hw_token) >> 8)
-								& 0x03) {
-						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->ps.usecs,
-						p.qh->ps.c_usecs,
-						temp,
-						0x7ff & (scratch >> 16));
-
-					if (seen_count < DBG_SCHED_LIMIT)
-						seen[seen_count++].qh = p.qh;
-				} else {
-					temp = 0;
-				}
-				tag = Q_NEXT_TYPE(ehci, hw->hw_next);
-				p = p.qh->qh_next;
-				break;
-			case Q_TYPE_FSTN:
-				temp = scnprintf(next, size,
-					" fstn-%8x/%p", p.fstn->hw_prev,
-					p.fstn);
-				tag = Q_NEXT_TYPE(ehci, p.fstn->hw_next);
-				p = p.fstn->fstn_next;
-				break;
-			case Q_TYPE_ITD:
-				temp = scnprintf(next, size,
-					" itd/%p", p.itd);
-				tag = Q_NEXT_TYPE(ehci, p.itd->hw_next);
-				p = p.itd->itd_next;
-				break;
-			case Q_TYPE_SITD:
 				temp = scnprintf(next, size,
-					" sitd%d-%04x/%p",
-					p.sitd->stream->ps.period,
-					hc32_to_cpup(ehci, &p.sitd->hw_uframe)
-						& 0x0000ffff,
-					p.sitd);
-				tag = Q_NEXT_TYPE(ehci, p.sitd->hw_next);
-				p = p.sitd->sitd_next;
-				break;
+					" (%c%d ep%d%s "
+					"[%d/%d] q%d p%d)",
+					speed_char (scratch),
+					scratch & 0x007f,
+					(scratch >> 8) & 0x000f, type,
+					p.qh->ps.usecs,
+					p.qh->ps.c_usecs,
+					temp,
+					(scratch >> 16) & 0x7ff);
+
+				if (seen_count < DBG_SCHED_LIMIT)
+					seen[seen_count++].qh = p.qh;
+			} else {
+				temp = 0;
 			}
-			size -= temp;
-			next += temp;
-		} while (p.ptr);
+			tag = Q_NEXT_TYPE(ehci, hw->hw_next);
+			p = p.qh->qh_next;
+			break;
+		case Q_TYPE_FSTN:
+			temp = scnprintf(next, size, " fstn-%8x/%p",
+				p.fstn->hw_prev, p.fstn);
+			tag = Q_NEXT_TYPE(ehci, p.fstn->hw_next);
+			p = p.fstn->fstn_next;
+			break;
+		case Q_TYPE_ITD:
+			temp = scnprintf(next, size, " itd/%p", p.itd);
+			tag = Q_NEXT_TYPE(ehci, p.itd->hw_next);
+			p = p.itd->itd_next;
+			break;
+		case Q_TYPE_SITD:
+			temp = scnprintf(next, size, " sitd%d-%04x/%p",
+				p.sitd->stream->ps.period,
+				hc32_to_cpup(ehci, &p.sitd->hw_uframe)
+					& 0x0000ffff,
+				p.sitd);
+			tag = Q_NEXT_TYPE(ehci, p.sitd->hw_next);
+			p = p.sitd->sitd_next;
+			break;
+		}
+		size -= temp;
+		next += temp;
+		if (p.ptr)
+			goto do_loop;
 
 		temp = scnprintf(next, size, "\n");
 		size -= temp;
-- 
2.6.4

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

[toc] | [prev] | [next] | [standalone]


#1301098 — Re: [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function

FromAlan Stern <stern@rowland.harvard.edu>
Date2016-01-04 22:10 +0100
SubjectRe: [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function
Message-ID<qNky7-oU-35@gated-at.bofh.it>
In reply to#1301046
On Mon, 4 Jan 2016, Geyslan G. Bem wrote:

> This patch fixes a coding style issue reported by checkpatch related to
> many leading tabs, removing a 'do while' loop and making use of goto tag instead.

This is highly questionable.  It's a big amount of code churn, nearly 
impossible to verify visually, just to remove one level of indentation.  
It also introduces an unnecessary backwards "goto", which seems like a 
bad idea.

Alan Stern

> Others changes in this patch are:
>  - Some multiline statements are reduced (718, 729, 780, 786, 790).
>  - A constant is moved to right on line 770.
> 
> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
> ---
> 
> Notes:
>     Tested by compilation only.
> 
>  drivers/usb/host/ehci-dbg.c | 180 ++++++++++++++++++++++----------------------
>  1 file changed, 88 insertions(+), 92 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
> index 2268756..278333d 100644
> --- a/drivers/usb/host/ehci-dbg.c
> +++ b/drivers/usb/host/ehci-dbg.c
> @@ -698,6 +698,8 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
>  	 */
>  	spin_lock_irqsave(&ehci->lock, flags);
>  	for (i = 0; i < ehci->periodic_size; i++) {
> +		struct ehci_qh_hw *hw;
> +
>  		p = ehci->pshadow[i];
>  		if (likely(!p.ptr))
>  			continue;
> @@ -707,104 +709,98 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
>  		size -= temp;
>  		next += temp;
>  
> -		do {
> -			struct ehci_qh_hw *hw;
> -
> -			switch (hc32_to_cpu(ehci, tag)) {
> -			case Q_TYPE_QH:
> -				hw = p.qh->hw;
> -				temp = scnprintf(next, size, " qh%d-%04x/%p",
> -						p.qh->ps.period,
> -						hc32_to_cpup(ehci,
> -							&hw->hw_info2)
> -							/* uframe masks */
> -							& (QH_CMASK | QH_SMASK),
> -						p.qh);
> -				size -= temp;
> -				next += temp;
> -				/* don't repeat what follows this qh */
> -				for (temp = 0; temp < seen_count; temp++) {
> -					if (seen[temp].ptr != p.ptr)
> +do_loop:
> +		switch (hc32_to_cpu(ehci, tag)) {
> +		case Q_TYPE_QH:
> +			hw = p.qh->hw;
> +			temp = scnprintf(next, size, " qh%d-%04x/%p",
> +					p.qh->ps.period,
> +					hc32_to_cpup(ehci, &hw->hw_info2)
> +						/* uframe masks */
> +						& (QH_CMASK | QH_SMASK),
> +					p.qh);
> +			size -= temp;
> +			next += temp;
> +			/* don't repeat what follows this qh */
> +			for (temp = 0; temp < seen_count; temp++) {
> +				if (seen[temp].ptr != p.ptr)
> +					continue;
> +				if (p.qh->qh_next.ptr) {
> +					temp = scnprintf(next, size, " ...");
> +					size -= temp;
> +					next += temp;
> +				}
> +				break;
> +			}
> +			/* show more info the first time around */
> +			if (temp == seen_count) {
> +				u32	scratch = hc32_to_cpup(ehci,
> +						&hw->hw_info1);
> +				struct ehci_qtd	*qtd;
> +				char		*type = "";
> +
> +				/* count tds, get ep direction */
> +				temp = 0;
> +				list_for_each_entry(qtd,
> +						&p.qh->qtd_list,
> +						qtd_list) {
> +					temp++;
> +					switch ((hc32_to_cpu(ehci,
> +						qtd->hw_token) >> 8)
> +							& 0x03) {
> +					case 0:
> +						type = "out";
> +						continue;
> +					case 1:
> +						type = "in";
>  						continue;
> -					if (p.qh->qh_next.ptr) {
> -						temp = scnprintf(next, size,
> -							" ...");
> -						size -= temp;
> -						next += temp;
>  					}
> -					break;
>  				}
> -				/* show more info the first time around */
> -				if (temp == seen_count) {
> -					u32	scratch = hc32_to_cpup(ehci,
> -							&hw->hw_info1);
> -					struct ehci_qtd	*qtd;
> -					char		*type = "";
> -
> -					/* count tds, get ep direction */
> -					temp = 0;
> -					list_for_each_entry(qtd,
> -							&p.qh->qtd_list,
> -							qtd_list) {
> -						temp++;
> -						switch ((hc32_to_cpu(ehci,
> -							qtd->hw_token) >> 8)
> -								& 0x03) {
> -						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->ps.usecs,
> -						p.qh->ps.c_usecs,
> -						temp,
> -						0x7ff & (scratch >> 16));
> -
> -					if (seen_count < DBG_SCHED_LIMIT)
> -						seen[seen_count++].qh = p.qh;
> -				} else {
> -					temp = 0;
> -				}
> -				tag = Q_NEXT_TYPE(ehci, hw->hw_next);
> -				p = p.qh->qh_next;
> -				break;
> -			case Q_TYPE_FSTN:
> -				temp = scnprintf(next, size,
> -					" fstn-%8x/%p", p.fstn->hw_prev,
> -					p.fstn);
> -				tag = Q_NEXT_TYPE(ehci, p.fstn->hw_next);
> -				p = p.fstn->fstn_next;
> -				break;
> -			case Q_TYPE_ITD:
> -				temp = scnprintf(next, size,
> -					" itd/%p", p.itd);
> -				tag = Q_NEXT_TYPE(ehci, p.itd->hw_next);
> -				p = p.itd->itd_next;
> -				break;
> -			case Q_TYPE_SITD:
>  				temp = scnprintf(next, size,
> -					" sitd%d-%04x/%p",
> -					p.sitd->stream->ps.period,
> -					hc32_to_cpup(ehci, &p.sitd->hw_uframe)
> -						& 0x0000ffff,
> -					p.sitd);
> -				tag = Q_NEXT_TYPE(ehci, p.sitd->hw_next);
> -				p = p.sitd->sitd_next;
> -				break;
> +					" (%c%d ep%d%s "
> +					"[%d/%d] q%d p%d)",
> +					speed_char (scratch),
> +					scratch & 0x007f,
> +					(scratch >> 8) & 0x000f, type,
> +					p.qh->ps.usecs,
> +					p.qh->ps.c_usecs,
> +					temp,
> +					(scratch >> 16) & 0x7ff);
> +
> +				if (seen_count < DBG_SCHED_LIMIT)
> +					seen[seen_count++].qh = p.qh;
> +			} else {
> +				temp = 0;
>  			}
> -			size -= temp;
> -			next += temp;
> -		} while (p.ptr);
> +			tag = Q_NEXT_TYPE(ehci, hw->hw_next);
> +			p = p.qh->qh_next;
> +			break;
> +		case Q_TYPE_FSTN:
> +			temp = scnprintf(next, size, " fstn-%8x/%p",
> +				p.fstn->hw_prev, p.fstn);
> +			tag = Q_NEXT_TYPE(ehci, p.fstn->hw_next);
> +			p = p.fstn->fstn_next;
> +			break;
> +		case Q_TYPE_ITD:
> +			temp = scnprintf(next, size, " itd/%p", p.itd);
> +			tag = Q_NEXT_TYPE(ehci, p.itd->hw_next);
> +			p = p.itd->itd_next;
> +			break;
> +		case Q_TYPE_SITD:
> +			temp = scnprintf(next, size, " sitd%d-%04x/%p",
> +				p.sitd->stream->ps.period,
> +				hc32_to_cpup(ehci, &p.sitd->hw_uframe)
> +					& 0x0000ffff,
> +				p.sitd);
> +			tag = Q_NEXT_TYPE(ehci, p.sitd->hw_next);
> +			p = p.sitd->sitd_next;
> +			break;
> +		}
> +		size -= temp;
> +		next += temp;
> +		if (p.ptr)
> +			goto do_loop;
>  
>  		temp = scnprintf(next, size, "\n");
>  		size -= temp;
> 

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

[toc] | [prev] | [next] | [standalone]


#1301217 — Re: [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function

From"Geyslan G. Bem" <geyslan@gmail.com>
Date2016-01-05 02:20 +0100
SubjectRe: [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function
Message-ID<qNos1-34q-3@gated-at.bofh.it>
In reply to#1301098
2016-01-04 18:01 GMT-03:00 Alan Stern <stern@rowland.harvard.edu>:
> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>
>> This patch fixes a coding style issue reported by checkpatch related to
>> many leading tabs, removing a 'do while' loop and making use of goto tag instead.
>
> This is highly questionable.  It's a big amount of code churn, nearly
> impossible to verify visually, just to remove one level of indentation.
> It also introduces an unnecessary backwards "goto", which seems like a
> bad idea.
After hear you I agree. I saw that others drivers uses similar
structure (fotg210-hcd.c and ohci-dbg.c), but they have less code. It
would be the case in this file of moving code to a new function? If
not, please disregard this patch.

>
> Alan Stern
>
>> Others changes in this patch are:
>>  - Some multiline statements are reduced (718, 729, 780, 786, 790).
>>  - A constant is moved to right on line 770.
>>
>> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
>> ---
>>
>> Notes:
>>     Tested by compilation only.
>>
>>  drivers/usb/host/ehci-dbg.c | 180 ++++++++++++++++++++++----------------------
>>  1 file changed, 88 insertions(+), 92 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
>> index 2268756..278333d 100644
>> --- a/drivers/usb/host/ehci-dbg.c
>> +++ b/drivers/usb/host/ehci-dbg.c
>> @@ -698,6 +698,8 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
>>        */
>>       spin_lock_irqsave(&ehci->lock, flags);
>>       for (i = 0; i < ehci->periodic_size; i++) {
>> +             struct ehci_qh_hw *hw;
>> +
>>               p = ehci->pshadow[i];
>>               if (likely(!p.ptr))
>>                       continue;
>> @@ -707,104 +709,98 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
>>               size -= temp;
>>               next += temp;
>>
>> -             do {
>> -                     struct ehci_qh_hw *hw;
>> -
>> -                     switch (hc32_to_cpu(ehci, tag)) {
>> -                     case Q_TYPE_QH:
>> -                             hw = p.qh->hw;
>> -                             temp = scnprintf(next, size, " qh%d-%04x/%p",
>> -                                             p.qh->ps.period,
>> -                                             hc32_to_cpup(ehci,
>> -                                                     &hw->hw_info2)
>> -                                                     /* uframe masks */
>> -                                                     & (QH_CMASK | QH_SMASK),
>> -                                             p.qh);
>> -                             size -= temp;
>> -                             next += temp;
>> -                             /* don't repeat what follows this qh */
>> -                             for (temp = 0; temp < seen_count; temp++) {
>> -                                     if (seen[temp].ptr != p.ptr)
>> +do_loop:
>> +             switch (hc32_to_cpu(ehci, tag)) {
>> +             case Q_TYPE_QH:
>> +                     hw = p.qh->hw;
>> +                     temp = scnprintf(next, size, " qh%d-%04x/%p",
>> +                                     p.qh->ps.period,
>> +                                     hc32_to_cpup(ehci, &hw->hw_info2)
>> +                                             /* uframe masks */
>> +                                             & (QH_CMASK | QH_SMASK),
>> +                                     p.qh);
>> +                     size -= temp;
>> +                     next += temp;
>> +                     /* don't repeat what follows this qh */
>> +                     for (temp = 0; temp < seen_count; temp++) {
>> +                             if (seen[temp].ptr != p.ptr)
>> +                                     continue;
>> +                             if (p.qh->qh_next.ptr) {
>> +                                     temp = scnprintf(next, size, " ...");
>> +                                     size -= temp;
>> +                                     next += temp;
>> +                             }
>> +                             break;
>> +                     }
>> +                     /* show more info the first time around */
>> +                     if (temp == seen_count) {
>> +                             u32     scratch = hc32_to_cpup(ehci,
>> +                                             &hw->hw_info1);
>> +                             struct ehci_qtd *qtd;
>> +                             char            *type = "";
>> +
>> +                             /* count tds, get ep direction */
>> +                             temp = 0;
>> +                             list_for_each_entry(qtd,
>> +                                             &p.qh->qtd_list,
>> +                                             qtd_list) {
>> +                                     temp++;
>> +                                     switch ((hc32_to_cpu(ehci,
>> +                                             qtd->hw_token) >> 8)
>> +                                                     & 0x03) {
>> +                                     case 0:
>> +                                             type = "out";
>> +                                             continue;
>> +                                     case 1:
>> +                                             type = "in";
>>                                               continue;
>> -                                     if (p.qh->qh_next.ptr) {
>> -                                             temp = scnprintf(next, size,
>> -                                                     " ...");
>> -                                             size -= temp;
>> -                                             next += temp;
>>                                       }
>> -                                     break;
>>                               }
>> -                             /* show more info the first time around */
>> -                             if (temp == seen_count) {
>> -                                     u32     scratch = hc32_to_cpup(ehci,
>> -                                                     &hw->hw_info1);
>> -                                     struct ehci_qtd *qtd;
>> -                                     char            *type = "";
>> -
>> -                                     /* count tds, get ep direction */
>> -                                     temp = 0;
>> -                                     list_for_each_entry(qtd,
>> -                                                     &p.qh->qtd_list,
>> -                                                     qtd_list) {
>> -                                             temp++;
>> -                                             switch ((hc32_to_cpu(ehci,
>> -                                                     qtd->hw_token) >> 8)
>> -                                                             & 0x03) {
>> -                                             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->ps.usecs,
>> -                                             p.qh->ps.c_usecs,
>> -                                             temp,
>> -                                             0x7ff & (scratch >> 16));
>> -
>> -                                     if (seen_count < DBG_SCHED_LIMIT)
>> -                                             seen[seen_count++].qh = p.qh;
>> -                             } else {
>> -                                     temp = 0;
>> -                             }
>> -                             tag = Q_NEXT_TYPE(ehci, hw->hw_next);
>> -                             p = p.qh->qh_next;
>> -                             break;
>> -                     case Q_TYPE_FSTN:
>> -                             temp = scnprintf(next, size,
>> -                                     " fstn-%8x/%p", p.fstn->hw_prev,
>> -                                     p.fstn);
>> -                             tag = Q_NEXT_TYPE(ehci, p.fstn->hw_next);
>> -                             p = p.fstn->fstn_next;
>> -                             break;
>> -                     case Q_TYPE_ITD:
>> -                             temp = scnprintf(next, size,
>> -                                     " itd/%p", p.itd);
>> -                             tag = Q_NEXT_TYPE(ehci, p.itd->hw_next);
>> -                             p = p.itd->itd_next;
>> -                             break;
>> -                     case Q_TYPE_SITD:
>>                               temp = scnprintf(next, size,
>> -                                     " sitd%d-%04x/%p",
>> -                                     p.sitd->stream->ps.period,
>> -                                     hc32_to_cpup(ehci, &p.sitd->hw_uframe)
>> -                                             & 0x0000ffff,
>> -                                     p.sitd);
>> -                             tag = Q_NEXT_TYPE(ehci, p.sitd->hw_next);
>> -                             p = p.sitd->sitd_next;
>> -                             break;
>> +                                     " (%c%d ep%d%s "
>> +                                     "[%d/%d] q%d p%d)",
>> +                                     speed_char (scratch),
>> +                                     scratch & 0x007f,
>> +                                     (scratch >> 8) & 0x000f, type,
>> +                                     p.qh->ps.usecs,
>> +                                     p.qh->ps.c_usecs,
>> +                                     temp,
>> +                                     (scratch >> 16) & 0x7ff);
>> +
>> +                             if (seen_count < DBG_SCHED_LIMIT)
>> +                                     seen[seen_count++].qh = p.qh;
>> +                     } else {
>> +                             temp = 0;
>>                       }
>> -                     size -= temp;
>> -                     next += temp;
>> -             } while (p.ptr);
>> +                     tag = Q_NEXT_TYPE(ehci, hw->hw_next);
>> +                     p = p.qh->qh_next;
>> +                     break;
>> +             case Q_TYPE_FSTN:
>> +                     temp = scnprintf(next, size, " fstn-%8x/%p",
>> +                             p.fstn->hw_prev, p.fstn);
>> +                     tag = Q_NEXT_TYPE(ehci, p.fstn->hw_next);
>> +                     p = p.fstn->fstn_next;
>> +                     break;
>> +             case Q_TYPE_ITD:
>> +                     temp = scnprintf(next, size, " itd/%p", p.itd);
>> +                     tag = Q_NEXT_TYPE(ehci, p.itd->hw_next);
>> +                     p = p.itd->itd_next;
>> +                     break;
>> +             case Q_TYPE_SITD:
>> +                     temp = scnprintf(next, size, " sitd%d-%04x/%p",
>> +                             p.sitd->stream->ps.period,
>> +                             hc32_to_cpup(ehci, &p.sitd->hw_uframe)
>> +                                     & 0x0000ffff,
>> +                             p.sitd);
>> +                     tag = Q_NEXT_TYPE(ehci, p.sitd->hw_next);
>> +                     p = p.sitd->sitd_next;
>> +                     break;
>> +             }
>> +             size -= temp;
>> +             next += temp;
>> +             if (p.ptr)
>> +                     goto do_loop;
>>
>>               temp = scnprintf(next, size, "\n");
>>               size -= temp;
>>
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
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/

[toc] | [prev] | [next] | [standalone]


#1301596 — Re: [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function

FromAlan Stern <stern@rowland.harvard.edu>
Date2016-01-05 16:20 +0100
SubjectRe: [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function
Message-ID<qNByW-4zh-9@gated-at.bofh.it>
In reply to#1301217
On Mon, 4 Jan 2016, Geyslan G. Bem wrote:

> 2016-01-04 18:01 GMT-03:00 Alan Stern <stern@rowland.harvard.edu>:
> > On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
> >
> >> This patch fixes a coding style issue reported by checkpatch related to
> >> many leading tabs, removing a 'do while' loop and making use of goto tag instead.
> >
> > This is highly questionable.  It's a big amount of code churn, nearly
> > impossible to verify visually, just to remove one level of indentation.
> > It also introduces an unnecessary backwards "goto", which seems like a
> > bad idea.
> After hear you I agree. I saw that others drivers uses similar
> structure (fotg210-hcd.c and ohci-dbg.c), but they have less code. It
> would be the case in this file of moving code to a new function? If
> not, please disregard this patch.

Moving code into a new sub-function would be okay.

BTW, you don't need to post these patches to both linux-usb and LKML.  
linux-usb alone is good enough.  Nothing about the patches would be
especially interesting to a general Linux kernel programmer, so there's 
no point in bringing them to everybody's attention.

Alan Stern

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

[toc] | [prev] | [next] | [standalone]


#1301622 — Re: [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function

From"Geyslan G. Bem" <geyslan@gmail.com>
Date2016-01-05 16:50 +0100
SubjectRe: [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function
Message-ID<qNC1X-4OF-3@gated-at.bofh.it>
In reply to#1301596
2016-01-05 12:15 GMT-03:00 Alan Stern <stern@rowland.harvard.edu>:
> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>
>> 2016-01-04 18:01 GMT-03:00 Alan Stern <stern@rowland.harvard.edu>:
>> > On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>> >
>> >> This patch fixes a coding style issue reported by checkpatch related to
>> >> many leading tabs, removing a 'do while' loop and making use of goto tag instead.
>> >
>> > This is highly questionable.  It's a big amount of code churn, nearly
>> > impossible to verify visually, just to remove one level of indentation.
>> > It also introduces an unnecessary backwards "goto", which seems like a
>> > bad idea.
>> After hear you I agree. I saw that others drivers uses similar
>> structure (fotg210-hcd.c and ohci-dbg.c), but they have less code. It
>> would be the case in this file of moving code to a new function? If
>> not, please disregard this patch.
>
> Moving code into a new sub-function would be okay.
Ok.

>
> BTW, you don't need to post these patches to both linux-usb and LKML.
> linux-usb alone is good enough.  Nothing about the patches would be
> especially interesting to a general Linux kernel programmer, so there's
> no point in bringing them to everybody's attention.
You're right. I used git send-email
--cc-cmd="scripts/get_maintainer.pl -i". Next patchset will not be
sent to LKML.
Tks.

>
> Alan Stern
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
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/

[toc] | [prev] | [next] | [standalone]


#1301047 — [PATCH 10/17] usb: host: ehci-dbg: use a blank line after struct declarations

From"Geyslan G. Bem" <geyslan@gmail.com>
Date2016-01-04 21:20 +0100
Subject[PATCH 10/17] usb: host: ehci-dbg: use a blank line after struct declarations
Message-ID<qNjLL-8i4-73@gated-at.bofh.it>
In reply to#1301043
This patch fixes coding style issues reported by checkpatch concerning
to missing line after struct declarations.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
 drivers/usb/host/ehci-dbg.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index a365d9d..4ba577d 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -367,6 +367,7 @@ static const struct file_operations debug_async_fops = {
 	.release	= debug_close,
 	.llseek		= default_llseek,
 };
+
 static const struct file_operations debug_bandwidth_fops = {
 	.owner		= THIS_MODULE,
 	.open		= debug_bandwidth_open,
@@ -374,6 +375,7 @@ static const struct file_operations debug_bandwidth_fops = {
 	.release	= debug_close,
 	.llseek		= default_llseek,
 };
+
 static const struct file_operations debug_periodic_fops = {
 	.owner		= THIS_MODULE,
 	.open		= debug_periodic_open,
@@ -381,6 +383,7 @@ static const struct file_operations debug_periodic_fops = {
 	.release	= debug_close,
 	.llseek		= default_llseek,
 };
+
 static const struct file_operations debug_registers_fops = {
 	.owner		= THIS_MODULE,
 	.open		= debug_registers_open,
-- 
2.6.4

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

[toc] | [prev] | [next] | [standalone]


#1301051 — [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

From"Geyslan G. Bem" <geyslan@gmail.com>
Date2016-01-04 21:30 +0100
Subject[PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast
Message-ID<qNjVp-8lm-15@gated-at.bofh.it>
In reply to#1301043
This patch fixes coding style issues reported by checkpatch concerning
to unnecessary space after a cast.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
 drivers/usb/host/ehci-dbg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 1645120..edae79e 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -123,7 +123,7 @@ dbg_qh(const char *label, struct ehci_hcd *ehci, struct ehci_qh *qh)
 
 	ehci_dbg(ehci, "%s qh %p n%08x info %x %x qtd %x\n", label,
 		qh, hw->hw_next, hw->hw_info1, hw->hw_info2, hw->hw_current);
-	dbg_qtd("overlay", ehci, (struct ehci_qtd *) &hw->hw_qtd_next);
+	dbg_qtd("overlay", ehci, (struct ehci_qtd *)&hw->hw_qtd_next);
 }
 
 static void __maybe_unused
@@ -491,7 +491,7 @@ static void qh_lines(
 				(scratch >> 16) & 0x7fff,
 				scratch,
 				td->urb,
-				(u32) td->qtd_dma,
+				(u32)td->qtd_dma,
 				hc32_to_cpup(ehci, &td->hw_buf[0]));
 		if (size < temp)
 			temp = size;
-- 
2.6.4

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

[toc] | [prev] | [next] | [standalone]


#1301086 — Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

FromAlan Stern <stern@rowland.harvard.edu>
Date2016-01-04 22:00 +0100
SubjectRe: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast
Message-ID<qNkoq-6b-11@gated-at.bofh.it>
In reply to#1301051
On Mon, 4 Jan 2016, Geyslan G. Bem wrote:

> This patch fixes coding style issues reported by checkpatch concerning
> to unnecessary space after a cast.

This is a case where checkpatch is wrong, IMO.  Casts should always be 
followed by a space.  I will not accept this patch.

This must be something recently added to checkpatch.  It never used to
complain about casts, whether they were followed by a space or not.

Alan Stern

> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
> ---
>  drivers/usb/host/ehci-dbg.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
> index 1645120..edae79e 100644
> --- a/drivers/usb/host/ehci-dbg.c
> +++ b/drivers/usb/host/ehci-dbg.c
> @@ -123,7 +123,7 @@ dbg_qh(const char *label, struct ehci_hcd *ehci, struct ehci_qh *qh)
>  
>  	ehci_dbg(ehci, "%s qh %p n%08x info %x %x qtd %x\n", label,
>  		qh, hw->hw_next, hw->hw_info1, hw->hw_info2, hw->hw_current);
> -	dbg_qtd("overlay", ehci, (struct ehci_qtd *) &hw->hw_qtd_next);
> +	dbg_qtd("overlay", ehci, (struct ehci_qtd *)&hw->hw_qtd_next);
>  }
>  
>  static void __maybe_unused
> @@ -491,7 +491,7 @@ static void qh_lines(
>  				(scratch >> 16) & 0x7fff,
>  				scratch,
>  				td->urb,
> -				(u32) td->qtd_dma,
> +				(u32)td->qtd_dma,
>  				hc32_to_cpup(ehci, &td->hw_buf[0]));
>  		if (size < temp)
>  			temp = size;
> 

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

[toc] | [prev] | [next] | [standalone]


#1301119 — Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-01-04 22:50 +0100
SubjectRe: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast
Message-ID<qNlaP-Er-17@gated-at.bofh.it>
In reply to#1301086
On Mon, Jan 04, 2016 at 06:40:38PM -0300, Geyslan G. Bem wrote:
> 2016-01-04 17:58 GMT-03:00 Alan Stern <stern@rowland.harvard.edu>:
> > On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
> >
> >> This patch fixes coding style issues reported by checkpatch concerning
> >> to unnecessary space after a cast.
> >
> > This is a case where checkpatch is wrong, IMO.  Casts should always be
> > followed by a space.  I will not accept this patch.
> Ok. I understand.
> 
> >
> > This must be something recently added to checkpatch.  It never used to
> > complain about casts, whether they were followed by a space or not.
> I'm using the checkpatch --strict option.

Please never use that on existing kernel code, except for
drivers/staging/ stuff, otherwise your patches will start to very
quickly be ignored.

thanks,

greg k-h
--
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/

[toc] | [prev] | [next] | [standalone]


#1301136 — Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

FromSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date2016-01-04 23:00 +0100
SubjectRe: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast
Message-ID<qNlkw-HP-57@gated-at.bofh.it>
In reply to#1301119
Hello.

On 01/05/2016 12:49 AM, Greg Kroah-Hartman wrote:

>>>> This patch fixes coding style issues reported by checkpatch concerning
>>>> to unnecessary space after a cast.
>>>
>>> This is a case where checkpatch is wrong, IMO.  Casts should always be
>>> followed by a space.  I will not accept this patch.
>> Ok. I understand.
>>
>>>
>>> This must be something recently added to checkpatch.  It never used to
>>> complain about casts, whether they were followed by a space or not.
>> I'm using the checkpatch --strict option.
>
> Please never use that on existing kernel code, except for
> drivers/staging/ stuff, otherwise your patches will start to very
> quickly be ignored.

    Just wanted to remind everybody that this option is forced when checking 
the networking code...

> thanks,
>
> greg k-h

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/

[toc] | [prev] | [next] | [standalone]


#1301141 — Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

From"Geyslan G. Bem" <geyslan@gmail.com>
Date2016-01-04 23:10 +0100
SubjectRe: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast
Message-ID<qNlub-10M-31@gated-at.bofh.it>
In reply to#1301136
2016-01-04 18:52 GMT-03:00 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>:
> Hello.
>
> On 01/05/2016 12:49 AM, Greg Kroah-Hartman wrote:
>
>>>>> This patch fixes coding style issues reported by checkpatch concerning
>>>>> to unnecessary space after a cast.
>>>>
>>>>
>>>> This is a case where checkpatch is wrong, IMO.  Casts should always be
>>>> followed by a space.  I will not accept this patch.
>>>
>>> Ok. I understand.
>>>
>>>>
>>>> This must be something recently added to checkpatch.  It never used to
>>>> complain about casts, whether they were followed by a space or not.
>>>
>>> I'm using the checkpatch --strict option.
>>
>>
>> Please never use that on existing kernel code, except for
>> drivers/staging/ stuff, otherwise your patches will start to very
>> quickly be ignored.
Good to know. Tks.

>
>
>    Just wanted to remind everybody that this option is forced when checking
> the networking code...
Ditto.

>
>> thanks,
>>
>> greg k-h
>
>
> MBR, Sergei
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
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/

[toc] | [prev] | [next] | [standalone]


#1301240 — Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

FromJoe Perches <joe@perches.com>
Date2016-01-05 03:50 +0100
SubjectRe: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast
Message-ID<qNpR8-3Te-3@gated-at.bofh.it>
In reply to#1301141
On Mon, 2016-01-04 at 19:07 -0300, Geyslan G. Bem wrote:
> 2016-01-04 18:52 GMT-03:00 Sergei Shtylyov :
> > > > > > This patch fixes coding style issues reported by checkpatch concerning
> > > > > > to unnecessary space after a cast.
> > > > > This is a case where checkpatch is wrong, IMO.  Casts should always be
> > > > > followed by a space.  I will not accept this patch.

Your choice, but most kernel code disagrees with you.

measuring only kernel casts to a pointer, (because there are
too many false positives otherwise) casts without a space
are preferred ~3:1 over casts followed by a space.

(without space)
$ grep -rP --include=*.[ch] -oh "\(\s*(\w{3,}\s+){0,2}\w{3,}\s*\*+\s*\)\w+" * | \
  sort|cut -f1 -d")"| sed 's/$/)/' | wc -l
36612

(with space)
$ grep -rP --include=*.[ch] -oh "\(\s*(\w{3,}\s+){0,2}\w{3,}\s*\*+\s*\)[ \t]\w+" * | \
  sort|cut -f1 -d")"| sed 's/$/)/' | wc -l
13233
--
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/

[toc] | [prev] | [next] | [standalone]


#1301593 — Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

From"Geyslan G. Bem" <geyslan@gmail.com>
Date2016-01-05 16:20 +0100
SubjectRe: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast
Message-ID<qNByW-4zh-11@gated-at.bofh.it>
In reply to#1301240
2016-01-04 23:40 GMT-03:00 Joe Perches <joe@perches.com>:
> On Mon, 2016-01-04 at 19:07 -0300, Geyslan G. Bem wrote:
>> 2016-01-04 18:52 GMT-03:00 Sergei Shtylyov :
>> > > > > > This patch fixes coding style issues reported by checkpatch concerning
>> > > > > > to unnecessary space after a cast.
>> > > > > This is a case where checkpatch is wrong, IMO.  Casts should always be
>> > > > > followed by a space.  I will not accept this patch.
>
> Your choice, but most kernel code disagrees with you.
>
> measuring only kernel casts to a pointer, (because there are
> too many false positives otherwise) casts without a space
> are preferred ~3:1 over casts followed by a space.
>
> (without space)
> $ grep -rP --include=*.[ch] -oh "\(\s*(\w{3,}\s+){0,2}\w{3,}\s*\*+\s*\)\w+" * | \
>   sort|cut -f1 -d")"| sed 's/$/)/' | wc -l
> 36612
>
> (with space)
> $ grep -rP --include=*.[ch] -oh "\(\s*(\w{3,}\s+){0,2}\w{3,}\s*\*+\s*\)[ \t]\w+" * | \
>   sort|cut -f1 -d")"| sed 's/$/)/' | wc -l
> 13233

FWIW I really don't have a side here since it's not defined in Coding
Style. Please disregard this patch.

-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
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/

[toc] | [prev] | [next] | [standalone]


#1301703 — Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

FromAlan Stern <stern@rowland.harvard.edu>
Date2016-01-05 17:50 +0100
SubjectRe: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast
Message-ID<qNCY3-5qN-37@gated-at.bofh.it>
In reply to#1301240
On Mon, 4 Jan 2016, Joe Perches wrote:

> On Mon, 2016-01-04 at 19:07 -0300, Geyslan G. Bem wrote:
> > 2016-01-04 18:52 GMT-03:00 Sergei Shtylyov :
> > > > > > > This patch fixes coding style issues reported by checkpatch concerning
> > > > > > > to unnecessary space after a cast.
> > > > > > This is a case where checkpatch is wrong, IMO.��Casts should always be
> > > > > > followed by a space.��I will not accept this patch.
> 
> Your choice, but most kernel code disagrees with you.
> 
> measuring only kernel casts to a pointer, (because there are
> too many false positives otherwise) casts without a space
> are preferred ~3:1 over casts followed by a space.

Then most kernel code is implicitly in violation of CodingStyle.
I'm referring to the section that says (admittedly, in a different 
context):

			... all right-thinking people know that
	(a) K&R are _right_ and (b) K&R are right.

K&R, both the first and second editions, is very consistent about 
always putting a space after a cast.

Alan Stern

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

[toc] | [prev] | [next] | [standalone]


#1301124 — Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

From"Geyslan G. Bem" <geyslan@gmail.com>
Date2016-01-04 22:50 +0100
SubjectRe: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast
Message-ID<qNlaP-Er-19@gated-at.bofh.it>
In reply to#1301086
2016-01-04 17:58 GMT-03:00 Alan Stern <stern@rowland.harvard.edu>:
> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>
>> This patch fixes coding style issues reported by checkpatch concerning
>> to unnecessary space after a cast.
>
> This is a case where checkpatch is wrong, IMO.  Casts should always be
> followed by a space.  I will not accept this patch.
Ok. I understand.

>
> This must be something recently added to checkpatch.  It never used to
> complain about casts, whether they were followed by a space or not.
I'm using the checkpatch --strict option.

>
> Alan Stern
>
>> Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
>> ---
>>  drivers/usb/host/ehci-dbg.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
>> index 1645120..edae79e 100644
>> --- a/drivers/usb/host/ehci-dbg.c
>> +++ b/drivers/usb/host/ehci-dbg.c
>> @@ -123,7 +123,7 @@ dbg_qh(const char *label, struct ehci_hcd *ehci, struct ehci_qh *qh)
>>
>>       ehci_dbg(ehci, "%s qh %p n%08x info %x %x qtd %x\n", label,
>>               qh, hw->hw_next, hw->hw_info1, hw->hw_info2, hw->hw_current);
>> -     dbg_qtd("overlay", ehci, (struct ehci_qtd *) &hw->hw_qtd_next);
>> +     dbg_qtd("overlay", ehci, (struct ehci_qtd *)&hw->hw_qtd_next);
>>  }
>>
>>  static void __maybe_unused
>> @@ -491,7 +491,7 @@ static void qh_lines(
>>                               (scratch >> 16) & 0x7fff,
>>                               scratch,
>>                               td->urb,
>> -                             (u32) td->qtd_dma,
>> +                             (u32)td->qtd_dma,
>>                               hc32_to_cpup(ehci, &td->hw_buf[0]));
>>               if (size < temp)
>>                       temp = size;
>>
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web