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


Groups > linux.kernel > #1220250 > unrolled thread

similar files: fusbh200-hcd.c and fotg210-hcd.c

Started byPeter Senna Tschudin <peter.senna@gmail.com>
First post2015-09-07 16:50 +0200
Last post2015-09-25 15:10 +0200
Articles 20 on this page of 45 — 5 participants

Back to article view | Back to linux.kernel


Contents

  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

Page 2 of 3 — ← Prev page 1 [2] 3  Next page →


#1229460 — [PATCH 10/14] RFC: usb/host/fotg210: Add function scan_frame_queue()

FromPeter Senna Tschudin <peter.senna@gmail.com>
Date2015-09-21 17:10 +0200
Subject[PATCH 10/14] RFC: usb/host/fotg210: Add function scan_frame_queue()
Message-ID<qbaT9-1N0-53@gated-at.bofh.it>
In reply to#1229455
checkpatch complains about too many leading tabs because the if
statement starts after 6 tabs:

scan_iosoc() -> for() -> while() -> switch() -> if() -> for() -> if()

There is also a goto statement going backwards in case of failure. This
patch creates a new inline function named scan_frame_queue() containing
the last 4 nesting levels, and removes the need of backwards goto,
making the code easier to read. After the patch it becomes:

scan_iosoc() -> for() -> while() -> scan_frame_queue()

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
 drivers/usb/host/fotg210-hcd.c | 142 ++++++++++++++++++++++-------------------
 1 file changed, 76 insertions(+), 66 deletions(-)

diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index 13cca41..e60a239 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -4645,13 +4645,81 @@ done:
 	return status;
 }
 
-/*-------------------------------------------------------------------------*/
+static inline int scan_frame_queue(struct fotg210_hcd *fotg210, unsigned frame,
+				   unsigned now_frame, bool live)
+{
+	unsigned uf;
+	bool modified;
+	union fotg210_shadow q, *q_p;
+	__hc32 type, *hw_p;
+
+	/* scan each element in frame's queue for completions */
+	q_p = &fotg210->pshadow[frame];
+	hw_p = &fotg210->periodic[frame];
+	q.ptr = q_p->ptr;
+	type = Q_NEXT_TYPE(fotg210, *hw_p);
+	modified = false;
+
+	while (q.ptr != NULL) {
+		switch (hc32_to_cpu(fotg210, type)) {
+		case Q_TYPE_ITD:
+			/* If this ITD is still active, leave it for
+			 * later processing ... check the next entry.
+			 * No need to check for activity unless the
+			 * frame is current.
+			 */
+			if (frame == now_frame && live) {
+				rmb();
+				for (uf = 0; uf < 8; uf++) {
+					if (q.itd->hw_transaction[uf] &
+						    ITD_ACTIVE(fotg210))
+						break;
+				}
+				if (uf < 8) {
+					q_p = &q.itd->itd_next;
+					hw_p = &q.itd->hw_next;
+					type = Q_NEXT_TYPE(fotg210,
+						q.itd->hw_next);
+					q = *q_p;
+					break;
+				}
+			}
+
+			/* Take finished ITDs out of the schedule
+			 * and process them:  recycle, maybe report
+			 * URB completion.  HC won't cache the
+			 * pointer for much longer, if at all.
+			 */
+			*q_p = q.itd->itd_next;
+			*hw_p = q.itd->hw_next;
+			type = Q_NEXT_TYPE(fotg210, q.itd->hw_next);
+			wmb();
+			modified = itd_complete(fotg210, q.itd);
+			q = *q_p;
+			break;
+		default:
+			fotg210_dbg(fotg210, "corrupt type %d frame %d shadow %p\n",
+				type, frame, q.ptr);
+			/* FALL THROUGH */
+		case Q_TYPE_QH:
+		case Q_TYPE_FSTN:
+			/* End of the iTDs and siTDs */
+			q.ptr = NULL;
+			break;
+		}
+
+		/* assume completion callbacks modify the queue */
+		if (unlikely(modified && fotg210->isoc_count > 0))
+			return -1;
+	}
+	return 0;
+}
 
 static void scan_isoc(struct fotg210_hcd *fotg210)
 {
-	unsigned	uf, now_frame, frame;
-	unsigned	fmask = fotg210->periodic_size - 1;
-	bool		modified, live;
+	unsigned uf, now_frame, frame, ret;
+	unsigned fmask = fotg210->periodic_size - 1;
+	bool live;
 
 	/*
 	 * When running, scan from last scan point up to "now"
@@ -4670,69 +4738,11 @@ static void scan_isoc(struct fotg210_hcd *fotg210)
 
 	frame = fotg210->next_frame;
 	for (;;) {
-		union fotg210_shadow	q, *q_p;
-		__hc32			type, *hw_p;
 
-restart:
-		/* scan each element in frame's queue for completions */
-		q_p = &fotg210->pshadow[frame];
-		hw_p = &fotg210->periodic[frame];
-		q.ptr = q_p->ptr;
-		type = Q_NEXT_TYPE(fotg210, *hw_p);
-		modified = false;
-
-		while (q.ptr != NULL) {
-			switch (hc32_to_cpu(fotg210, type)) {
-			case Q_TYPE_ITD:
-				/* If this ITD is still active, leave it for
-				 * later processing ... check the next entry.
-				 * No need to check for activity unless the
-				 * frame is current.
-				 */
-				if (frame == now_frame && live) {
-					rmb();
-					for (uf = 0; uf < 8; uf++) {
-						if (q.itd->hw_transaction[uf] &
-							    ITD_ACTIVE(fotg210))
-							break;
-					}
-					if (uf < 8) {
-						q_p = &q.itd->itd_next;
-						hw_p = &q.itd->hw_next;
-						type = Q_NEXT_TYPE(fotg210,
-							q.itd->hw_next);
-						q = *q_p;
-						break;
-					}
-				}
-
-				/* Take finished ITDs out of the schedule
-				 * and process them:  recycle, maybe report
-				 * URB completion.  HC won't cache the
-				 * pointer for much longer, if at all.
-				 */
-				*q_p = q.itd->itd_next;
-				*hw_p = q.itd->hw_next;
-				type = Q_NEXT_TYPE(fotg210, q.itd->hw_next);
-				wmb();
-				modified = itd_complete(fotg210, q.itd);
-				q = *q_p;
-				break;
-			default:
-				fotg210_dbg(fotg210, "corrupt type %d frame %d shadow %p\n",
-					type, frame, q.ptr);
-				/* FALL THROUGH */
-			case Q_TYPE_QH:
-			case Q_TYPE_FSTN:
-				/* End of the iTDs and siTDs */
-				q.ptr = NULL;
-				break;
-			}
-
-			/* assume completion callbacks modify the queue */
-			if (unlikely(modified && fotg210->isoc_count > 0))
-				goto restart;
-		}
+		ret = 1;
+		while (ret != 0)
+			ret = scan_frame_queue(fotg210, frame, now_frame,
+					       live);
 
 		/* Stop when we have reached the current frame */
 		if (frame == now_frame)
-- 
2.1.0

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


#1238452 — Re: [PATCH 10/14] RFC: usb/host/fotg210: Add function scan_frame_queue()

FromFelipe Balbi <balbi@ti.com>
Date2015-10-02 19:40 +0200
SubjectRe: [PATCH 10/14] RFC: usb/host/fotg210: Add function scan_frame_queue()
Message-ID<qfctl-1MB-27@gated-at.bofh.it>
In reply to#1229460

[Multipart message — attachments visible in raw view] — view raw

On Mon, Sep 21, 2015 at 05:01:14PM +0200, Peter Senna Tschudin wrote:
> checkpatch complains about too many leading tabs because the if
> statement starts after 6 tabs:
> 
> scan_iosoc() -> for() -> while() -> switch() -> if() -> for() -> if()
> 
> There is also a goto statement going backwards in case of failure. This
> patch creates a new inline function named scan_frame_queue() containing
> the last 4 nesting levels, and removes the need of backwards goto,
> making the code easier to read. After the patch it becomes:
> 
> scan_iosoc() -> for() -> while() -> scan_frame_queue()
> 
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
> ---
>  drivers/usb/host/fotg210-hcd.c | 142 ++++++++++++++++++++++-------------------
>  1 file changed, 76 insertions(+), 66 deletions(-)
> 
> diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
> index 13cca41..e60a239 100644
> --- a/drivers/usb/host/fotg210-hcd.c
> +++ b/drivers/usb/host/fotg210-hcd.c
> @@ -4645,13 +4645,81 @@ done:
>  	return status;
>  }
>  
> -/*-------------------------------------------------------------------------*/
> +static inline int scan_frame_queue(struct fotg210_hcd *fotg210, unsigned frame,
> +				   unsigned now_frame, bool live)
> +{
> +	unsigned uf;
> +	bool modified;
> +	union fotg210_shadow q, *q_p;
> +	__hc32 type, *hw_p;
> +
> +	/* scan each element in frame's queue for completions */
> +	q_p = &fotg210->pshadow[frame];
> +	hw_p = &fotg210->periodic[frame];
> +	q.ptr = q_p->ptr;
> +	type = Q_NEXT_TYPE(fotg210, *hw_p);
> +	modified = false;
> +
> +	while (q.ptr != NULL) {

while (q.ptr) is enough

> +		switch (hc32_to_cpu(fotg210, type)) {
> +		case Q_TYPE_ITD:
> +			/* If this ITD is still active, leave it for

comment style

> +			 * later processing ... check the next entry.
> +			 * No need to check for activity unless the
> +			 * frame is current.
> +			 */
> +			if (frame == now_frame && live) {
> +				rmb();
> +				for (uf = 0; uf < 8; uf++) {
> +					if (q.itd->hw_transaction[uf] &
> +						    ITD_ACTIVE(fotg210))
> +						break;
> +				}
> +				if (uf < 8) {
> +					q_p = &q.itd->itd_next;
> +					hw_p = &q.itd->hw_next;
> +					type = Q_NEXT_TYPE(fotg210,
> +						q.itd->hw_next);
> +					q = *q_p;
> +					break;
> +				}
> +			}
> +
> +			/* Take finished ITDs out of the schedule

comment style

> +			 * and process them:  recycle, maybe report
> +			 * URB completion.  HC won't cache the
> +			 * pointer for much longer, if at all.
> +			 */
> +			*q_p = q.itd->itd_next;
> +			*hw_p = q.itd->hw_next;
> +			type = Q_NEXT_TYPE(fotg210, q.itd->hw_next);
> +			wmb();
> +			modified = itd_complete(fotg210, q.itd);
> +			q = *q_p;
> +			break;
> +		default:
> +			fotg210_dbg(fotg210, "corrupt type %d frame %d shadow %p\n",
> +				type, frame, q.ptr);
> +			/* FALL THROUGH */
> +		case Q_TYPE_QH:
> +		case Q_TYPE_FSTN:
> +			/* End of the iTDs and siTDs */
> +			q.ptr = NULL;
> +			break;
> +		}
> +
> +		/* assume completion callbacks modify the queue */
> +		if (unlikely(modified && fotg210->isoc_count > 0))
> +			return -1;

can't you add a proper error code here ?

other than these, patch looks good.

-- 
balbi

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


#1229461 — [PATCH 06/14] RFC: usb/host/fotg210: replace msleep by usleep_range

FromPeter Senna Tschudin <peter.senna@gmail.com>
Date2015-09-21 17:10 +0200
Subject[PATCH 06/14] RFC: usb/host/fotg210: replace msleep by usleep_range
Message-ID<qbaT9-1N0-59@gated-at.bofh.it>
In reply to#1229455
msleep under 20ms can result in sleeping up to 20ms, which may not be
intended. Replace msleep(5) by usleep_range(5000, 6000).

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
 drivers/usb/host/fotg210-hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index e7e9991..55c2279 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -5122,7 +5122,7 @@ static int fotg210_run(struct usb_hcd *hcd)
 	fotg210->rh_state = FOTG210_RH_RUNNING;
 	/* unblock posted writes */
 	fotg210_readl(fotg210, &fotg210->regs->command);
-	msleep(5);
+	usleep_range(5000, 6000);
 	up_write(&ehci_cf_port_reset_rwsem);
 	fotg210->last_periodic_enable = ktime_get_real();
 
-- 
2.1.0

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


#1238457 — Re: [PATCH 06/14] RFC: usb/host/fotg210: replace msleep by usleep_range

FromFelipe Balbi <balbi@ti.com>
Date2015-10-02 19:40 +0200
SubjectRe: [PATCH 06/14] RFC: usb/host/fotg210: replace msleep by usleep_range
Message-ID<qfctl-1MB-35@gated-at.bofh.it>
In reply to#1229461

[Multipart message — attachments visible in raw view] — view raw

On Mon, Sep 21, 2015 at 05:01:10PM +0200, Peter Senna Tschudin wrote:
> msleep under 20ms can result in sleeping up to 20ms, which may not be
> intended. Replace msleep(5) by usleep_range(5000, 6000).
> 
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>

good catch. I'd apply this straight away. Alan ?

> ---
>  drivers/usb/host/fotg210-hcd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
> index e7e9991..55c2279 100644
> --- a/drivers/usb/host/fotg210-hcd.c
> +++ b/drivers/usb/host/fotg210-hcd.c
> @@ -5122,7 +5122,7 @@ static int fotg210_run(struct usb_hcd *hcd)
>  	fotg210->rh_state = FOTG210_RH_RUNNING;
>  	/* unblock posted writes */
>  	fotg210_readl(fotg210, &fotg210->regs->command);
> -	msleep(5);
> +	usleep_range(5000, 6000);
>  	up_write(&ehci_cf_port_reset_rwsem);
>  	fotg210->last_periodic_enable = ktime_get_real();
>  
> -- 
> 2.1.0
> 

-- 
balbi

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


#1238491 — Re: [PATCH 06/14] RFC: usb/host/fotg210: replace msleep by usleep_range

FromAlan Stern <stern@rowland.harvard.edu>
Date2015-10-02 20:00 +0200
SubjectRe: [PATCH 06/14] RFC: usb/host/fotg210: replace msleep by usleep_range
Message-ID<qfcMJ-29a-51@gated-at.bofh.it>
In reply to#1238457
On Fri, 2 Oct 2015, Felipe Balbi wrote:

> On Mon, Sep 21, 2015 at 05:01:10PM +0200, Peter Senna Tschudin wrote:
> > msleep under 20ms can result in sleeping up to 20ms, which may not be
> > intended. Replace msleep(5) by usleep_range(5000, 6000).
> > 
> > Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
> 
> good catch. I'd apply this straight away. Alan ?

It really doesn't matter.  As long as the delay is at least 5 ms, it
can be arbitrarily long.  This won't hurt, and if it prevents automated
tools from complaining then it's worthwhile.

Peter, a lot of the changes you have been making will also apply to the 
ehci-hcd driver.  Do you want to update it as well?  One caution: The 
style used for continuation lines is to add two extra tab stops, not to 
align things with an open paren on the original line.

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]


#1239083 — Re: [PATCH 06/14] RFC: usb/host/fotg210: replace msleep by usleep_range

FromPeter Senna Tschudin <peter.senna@gmail.com>
Date2015-10-04 12:00 +0200
SubjectRe: [PATCH 06/14] RFC: usb/host/fotg210: replace msleep by usleep_range
Message-ID<qfOff-5eb-1@gated-at.bofh.it>
In reply to#1238491
On Fri, Oct 2, 2015 at 7:52 PM, Alan Stern <stern@rowland.harvard.edu> wrote:
> On Fri, 2 Oct 2015, Felipe Balbi wrote:
>
>> On Mon, Sep 21, 2015 at 05:01:10PM +0200, Peter Senna Tschudin wrote:
>> > msleep under 20ms can result in sleeping up to 20ms, which may not be
>> > intended. Replace msleep(5) by usleep_range(5000, 6000).
>> >
>> > Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
>>
>> good catch. I'd apply this straight away. Alan ?
>
> It really doesn't matter.  As long as the delay is at least 5 ms, it
> can be arbitrarily long.  This won't hurt, and if it prevents automated
> tools from complaining then it's worthwhile.
Then is it a good idea to increase the range to reduce chances of
creating an interrupt?

usleep_range(5000, 10000)?

>
> Peter, a lot of the changes you have been making will also apply to the
> ehci-hcd driver.  Do you want to update it as well?  One caution: The
> style used for continuation lines is to add two extra tab stops, not to
> align things with an open paren on the original line.
The drivers with more checkpatch errors and warnings are:

<number of errors> <number of warnings> <path>

117 586 drivers/usb/host/fusbh200-hcd.c
38 124 drivers/usb/host/ohci-q.c
38 122 drivers/usb/host/ehci-dbg.c
37 118 drivers/usb/host/ohci-dbg.c
36 129 drivers/usb/host/ehci-sched.c
24 136 drivers/usb/host/ohci-hcd.c
23 16 drivers/usb/host/sl811-hcd.c
20 105 drivers/usb/host/ohci-hub.c
18 48 drivers/usb/host/ehci-hub.c

17 70 drivers/usb/host/ehci-hcd.c

13 4 drivers/usb/host/uhci-debug.c
12 93 drivers/usb/host/ehci-q.c
9 83 drivers/usb/host/isp116x-hcd.c
9 32 drivers/usb/host/fotg210-hcd.c
7 29 drivers/usb/host/oxu210hp-hcd.c
6 4 drivers/usb/host/sl811_cs.c

I'll fix ehci-hcd. Do you want patches for the others?

I'll fix the alignment using two extra tabs instead of aligning with
opening parenthesis. Thank you.


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


#1239142 — Re: [PATCH 06/14] RFC: usb/host/fotg210: replace msleep by usleep_range

FromAlan Stern <stern@rowland.harvard.edu>
Date2015-10-04 17:30 +0200
SubjectRe: [PATCH 06/14] RFC: usb/host/fotg210: replace msleep by usleep_range
Message-ID<qfToB-4fU-3@gated-at.bofh.it>
In reply to#1239083
On Sun, 4 Oct 2015, Peter Senna Tschudin wrote:

> On Fri, Oct 2, 2015 at 7:52 PM, Alan Stern <stern@rowland.harvard.edu> wrote:
> > On Fri, 2 Oct 2015, Felipe Balbi wrote:
> >
> >> On Mon, Sep 21, 2015 at 05:01:10PM +0200, Peter Senna Tschudin wrote:
> >> > msleep under 20ms can result in sleeping up to 20ms, which may not be
> >> > intended. Replace msleep(5) by usleep_range(5000, 6000).
> >> >
> >> > Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
> >>
> >> good catch. I'd apply this straight away. Alan ?
> >
> > It really doesn't matter.  As long as the delay is at least 5 ms, it
> > can be arbitrarily long.  This won't hurt, and if it prevents automated
> > tools from complaining then it's worthwhile.
> Then is it a good idea to increase the range to reduce chances of
> creating an interrupt?
> 
> usleep_range(5000, 10000)?

That wold be okay.

> > Peter, a lot of the changes you have been making will also apply to the
> > ehci-hcd driver.  Do you want to update it as well?  One caution: The
> > style used for continuation lines is to add two extra tab stops, not to
> > align things with an open paren on the original line.
> The drivers with more checkpatch errors and warnings are:
> 
> <number of errors> <number of warnings> <path>
> 
> 117 586 drivers/usb/host/fusbh200-hcd.c
> 38 124 drivers/usb/host/ohci-q.c
> 38 122 drivers/usb/host/ehci-dbg.c
> 37 118 drivers/usb/host/ohci-dbg.c
> 36 129 drivers/usb/host/ehci-sched.c
> 24 136 drivers/usb/host/ohci-hcd.c
> 23 16 drivers/usb/host/sl811-hcd.c
> 20 105 drivers/usb/host/ohci-hub.c
> 18 48 drivers/usb/host/ehci-hub.c
> 
> 17 70 drivers/usb/host/ehci-hcd.c
> 
> 13 4 drivers/usb/host/uhci-debug.c
> 12 93 drivers/usb/host/ehci-q.c
> 9 83 drivers/usb/host/isp116x-hcd.c
> 9 32 drivers/usb/host/fotg210-hcd.c
> 7 29 drivers/usb/host/oxu210hp-hcd.c
> 6 4 drivers/usb/host/sl811_cs.c
> 
> I'll fix ehci-hcd. Do you want patches for the others?

I was speaking of ehci-*.c, because the code in there is extremely
similar to the code you've already been working on.

There's no point in trying to fix _all_ those checkpatch violations.  A 
lot of them are trivial things like an extra space character between a 
function name and the following left paren.

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]


#1229462 — [PATCH 02/14] RFC: usb/host/fotg210: remove KERN_WARNING from pr_info

FromPeter Senna Tschudin <peter.senna@gmail.com>
Date2015-09-21 17:10 +0200
Subject[PATCH 02/14] RFC: usb/host/fotg210: remove KERN_WARNING from pr_info
Message-ID<qbaT9-1N0-65@gated-at.bofh.it>
In reply to#1229455
This patch remove KERN_WARNING from a call to pr_info().

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
 drivers/usb/host/fotg210-hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index 48eac34..36413b2 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -5740,7 +5740,7 @@ static int __init fotg210_hcd_init(void)
 	set_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
 	if (test_bit(USB_UHCI_LOADED, &usb_hcds_loaded) ||
 			test_bit(USB_OHCI_LOADED, &usb_hcds_loaded))
-		pr_warn(KERN_WARNING "Warning! fotg210_hcd should always be loaded before uhci_hcd and ohci_hcd, not after\n");
+		pr_warn("Warning! fotg210_hcd should always be loaded before uhci_hcd and ohci_hcd, not after\n");
 
 	pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd\n",
 		 hcd_name,
-- 
2.1.0

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


#1229665 — Re: [PATCH 02/14] RFC: usb/host/fotg210: remove KERN_WARNING from pr_info

FromSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date2015-09-21 21:00 +0200
SubjectRe: [PATCH 02/14] RFC: usb/host/fotg210: remove KERN_WARNING from pr_info
Message-ID<qbetI-6Kf-43@gated-at.bofh.it>
In reply to#1229462
Hello.

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

> This patch remove KERN_WARNING from a call to pr_info().

    Not pr_warn()?

> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
> ---
>   drivers/usb/host/fotg210-hcd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
> index 48eac34..36413b2 100644
> --- a/drivers/usb/host/fotg210-hcd.c
> +++ b/drivers/usb/host/fotg210-hcd.c
> @@ -5740,7 +5740,7 @@ static int __init fotg210_hcd_init(void)
>   	set_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
>   	if (test_bit(USB_UHCI_LOADED, &usb_hcds_loaded) ||
>   			test_bit(USB_OHCI_LOADED, &usb_hcds_loaded))
> -		pr_warn(KERN_WARNING "Warning! fotg210_hcd should always be loaded before uhci_hcd and ohci_hcd, not after\n");
> +		pr_warn("Warning! fotg210_hcd should always be loaded before uhci_hcd and ohci_hcd, not after\n");
[...]

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]


#1238453 — Re: [PATCH 02/14] RFC: usb/host/fotg210: remove KERN_WARNING from pr_info

FromFelipe Balbi <balbi@ti.com>
Date2015-10-02 19:40 +0200
SubjectRe: [PATCH 02/14] RFC: usb/host/fotg210: remove KERN_WARNING from pr_info
Message-ID<qfctl-1MB-31@gated-at.bofh.it>
In reply to#1229462

[Multipart message — attachments visible in raw view] — view raw

On Mon, Sep 21, 2015 at 05:01:06PM +0200, Peter Senna Tschudin wrote:
> This patch remove KERN_WARNING from a call to pr_info().

s/pr_info/pr_warn/

other than that, looks good

> 
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
> ---
>  drivers/usb/host/fotg210-hcd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
> index 48eac34..36413b2 100644
> --- a/drivers/usb/host/fotg210-hcd.c
> +++ b/drivers/usb/host/fotg210-hcd.c
> @@ -5740,7 +5740,7 @@ static int __init fotg210_hcd_init(void)
>  	set_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
>  	if (test_bit(USB_UHCI_LOADED, &usb_hcds_loaded) ||
>  			test_bit(USB_OHCI_LOADED, &usb_hcds_loaded))
> -		pr_warn(KERN_WARNING "Warning! fotg210_hcd should always be loaded before uhci_hcd and ohci_hcd, not after\n");
> +		pr_warn("Warning! fotg210_hcd should always be loaded before uhci_hcd and ohci_hcd, not after\n");
>  
>  	pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd\n",
>  		 hcd_name,
> -- 
> 2.1.0
> 

-- 
balbi

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


#1229464 — [PATCH 05/14] RFC: usb/host/fotg210: change kmalloc by kmalloc_array

FromPeter Senna Tschudin <peter.senna@gmail.com>
Date2015-09-21 17:10 +0200
Subject[PATCH 05/14] RFC: usb/host/fotg210: change kmalloc by kmalloc_array
Message-ID<qbaT9-1N0-57@gated-at.bofh.it>
In reply to#1229455
This patch change:

kmalloc(DBG_SCHED_LIMIT * sizeof(*seen), GFP_ATOMIC)

by:

kmalloc_array(DBG_SCHED_LIMIT, sizeof(*seen), GFP_ATOMIC)

as kmalloc_array() should be used for allocating arrays.

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
 drivers/usb/host/fotg210-hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index 51feb61..e7e9991 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -501,7 +501,7 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
 	unsigned i;
 	__hc32 tag;
 
-	seen = kmalloc(DBG_SCHED_LIMIT * sizeof(*seen), GFP_ATOMIC);
+	seen = kmalloc_array(DBG_SCHED_LIMIT, sizeof(*seen), GFP_ATOMIC);
 	if (!seen)
 		return 0;
 
-- 
2.1.0

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


#1229660 — Re: [PATCH 05/14] RFC: usb/host/fotg210: change kmalloc by kmalloc_array

FromSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date2015-09-21 21:00 +0200
SubjectRe: [PATCH 05/14] RFC: usb/host/fotg210: change kmalloc by kmalloc_array
Message-ID<qbetI-6Kf-33@gated-at.bofh.it>
In reply to#1229464
On 09/21/2015 06:01 PM, Peter Senna Tschudin wrote:

> This patch change:

    "Replaces" maybe?

> kmalloc(DBG_SCHED_LIMIT * sizeof(*seen), GFP_ATOMIC)
>
> by:
>
> kmalloc_array(DBG_SCHED_LIMIT, sizeof(*seen), GFP_ATOMIC)
>
> as kmalloc_array() should be used for allocating arrays.
>
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>

[...]

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]


#1238451 — Re: [PATCH 05/14] RFC: usb/host/fotg210: change kmalloc by kmalloc_array

FromFelipe Balbi <balbi@ti.com>
Date2015-10-02 19:40 +0200
SubjectRe: [PATCH 05/14] RFC: usb/host/fotg210: change kmalloc by kmalloc_array
Message-ID<qfctk-1MB-25@gated-at.bofh.it>
In reply to#1229464

[Multipart message — attachments visible in raw view] — view raw

On Mon, Sep 21, 2015 at 05:01:09PM +0200, Peter Senna Tschudin wrote:
> This patch change:
> 
> kmalloc(DBG_SCHED_LIMIT * sizeof(*seen), GFP_ATOMIC)
> 
> by:
> 
> kmalloc_array(DBG_SCHED_LIMIT, sizeof(*seen), GFP_ATOMIC)
> 
> as kmalloc_array() should be used for allocating arrays.
> 
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>

looks good to me

> ---
>  drivers/usb/host/fotg210-hcd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
> index 51feb61..e7e9991 100644
> --- a/drivers/usb/host/fotg210-hcd.c
> +++ b/drivers/usb/host/fotg210-hcd.c
> @@ -501,7 +501,7 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
>  	unsigned i;
>  	__hc32 tag;
>  
> -	seen = kmalloc(DBG_SCHED_LIMIT * sizeof(*seen), GFP_ATOMIC);
> +	seen = kmalloc_array(DBG_SCHED_LIMIT, sizeof(*seen), GFP_ATOMIC);
>  	if (!seen)
>  		return 0;
>  
> -- 
> 2.1.0
> 

-- 
balbi

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


#1229465 — [PATCH 13/14] RFC: usb/host/faraday-hcd: Move #defines outside struct

FromPeter Senna Tschudin <peter.senna@gmail.com>
Date2015-09-21 17:10 +0200
Subject[PATCH 13/14] RFC: usb/host/faraday-hcd: Move #defines outside struct
Message-ID<qbaT9-1N0-63@gated-at.bofh.it>
In reply to#1229455
For making the code more readable and to facilitate supporting multiple
hardware versions, move #defines to outside the struct declaration. This
patch also renames fhcd2xx_regs to fotg210_regs as this struct is
specific to fotg210.

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
 drivers/usb/host/faraday-hcd.h | 137 ++++++++++++++++++++++-------------------
 1 file changed, 74 insertions(+), 63 deletions(-)

diff --git a/drivers/usb/host/faraday-hcd.h b/drivers/usb/host/faraday-hcd.h
index cf29edf..f75c467 100644
--- a/drivers/usb/host/faraday-hcd.h
+++ b/drivers/usb/host/faraday-hcd.h
@@ -85,7 +85,7 @@ struct fhcd2xx_hcd {			/* one per controller */
 
 	/* glue to PCI and HCD framework */
 	struct fhcd2xx_caps __iomem *caps;
-	struct fhcd2xx_regs __iomem *regs;
+	struct fotg210_regs __iomem *regs;
 	struct ehci_dbg_port __iomem *debug;
 
 	__u32			hcs_params;	/* cached register copy */
@@ -221,84 +221,95 @@ struct fhcd2xx_caps {
 	u8		portroute[8];	 /* nibbles for routing - offset 0xC */
 };
 
-
-/* Section 2.3 Host Controller Operational Registers */
-struct fhcd2xx_regs {
-
-	/* USBCMD: offset 0x00 */
-	u32		command;
-
 /* EHCI 1.1 addendum */
 /* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */
-#define CMD_PARK	(1<<11)		/* enable "park" on async qh */
-#define CMD_PARK_CNT(c)	(((c)>>8)&3)	/* how many transfers to park for */
-#define CMD_IAAD	(1<<6)		/* "doorbell" interrupt async advance */
-#define CMD_ASE		(1<<5)		/* async schedule enable */
-#define CMD_PSE		(1<<4)		/* periodic schedule enable */
+#define CMD_PARK	(1<<11) /* enable "park" on async qh */
+#define CMD_PARK_CNT(c)	(((c)>>8)&3) /* how many transfers to park for */
+#define CMD_IAAD	(1<<6) /* "doorbell" interrupt async advance */
+#define CMD_ASE		(1<<5) /* async schedule enable */
+#define CMD_PSE		(1<<4) /* periodic schedule enable */
+
 /* 3:2 is periodic frame list size */
-#define CMD_RESET	(1<<1)		/* reset HC not bus */
-#define CMD_RUN		(1<<0)		/* start/stop HC */
+#define CMD_RESET	(1<<1) /* reset HC not bus */
+#define CMD_RUN		(1<<0) /* start/stop HC */
 
-	/* USBSTS: offset 0x04 */
-	u32		status;
-#define STS_ASS		(1<<15)		/* Async Schedule Status */
-#define STS_PSS		(1<<14)		/* Periodic Schedule Status */
-#define STS_RECL	(1<<13)		/* Reclamation */
-#define STS_HALT	(1<<12)		/* Not running (any reason) */
-/* some bits reserved */
-	/* these STS_* flags are also intr_enable bits (USBINTR) */
-#define STS_IAA		(1<<5)		/* Interrupted on async advance */
-#define STS_FATAL	(1<<4)		/* such as some PCI access errors */
-#define STS_FLR		(1<<3)		/* frame list rolled over */
-#define STS_PCD		(1<<2)		/* port change detect */
-#define STS_ERR		(1<<1)		/* "error" completion (overflow, ...) */
-#define STS_INT		(1<<0)		/* "normal" completion (short, ...) */
+#define STS_ASS		(1<<15) /* Async Schedule Status */
+#define STS_PSS		(1<<14) /* Periodic Schedule Status */
+#define STS_RECL	(1<<13) /* Reclamation */
+#define STS_HALT	(1<<12) /* Not running (any reason) */
+
+/* some bits reserved
+ * these STS_* flags are also intr_enable bits (USBINTR)
+ */
+#define STS_IAA		(1<<5) /* Interrupted on async advance */
+#define STS_FATAL	(1<<4) /* such as some PCI access errors */
+#define STS_FLR		(1<<3) /* frame list rolled over */
+#define STS_PCD		(1<<2) /* port change detect */
+#define STS_ERR		(1<<1) /* "error" completion (overflow, ...) */
+#define STS_INT		(1<<0) /* "normal" completion (short, ...) */
 
-	/* USBINTR: offset 0x08 */
-	u32		intr_enable;
-
-	/* FRINDEX: offset 0x0C */
-	u32		frame_index;	/* current microframe number */
-	/* CTRLDSSEGMENT: offset 0x10 */
-	u32		segment;	/* address bits 63:32 if needed */
-	/* PERIODICLISTBASE: offset 0x14 */
-	u32		frame_list;	/* points to periodic list */
-	/* ASYNCLISTADDR: offset 0x18 */
-	u32		async_next;	/* address of next async queue head */
-
-	u32	reserved1;
-	/* PORTSC: offset 0x20 */
-	u32	port_status;
 /* 31:23 reserved */
-#define PORT_USB11(x) (((x)&(3<<10)) == (1<<10))	/* USB 1.1 device */
-#define PORT_RESET	(1<<8)		/* reset port */
-#define PORT_SUSPEND	(1<<7)		/* suspend port */
-#define PORT_RESUME	(1<<6)		/* resume it */
-#define PORT_PEC	(1<<3)		/* port enable change */
-#define PORT_PE		(1<<2)		/* port enable */
-#define PORT_CSC	(1<<1)		/* connect status change */
-#define PORT_CONNECT	(1<<0)		/* device connected */
+#define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */
+#define PORT_RESET	(1<<8) /* reset port */
+#define PORT_SUSPEND	(1<<7) /* suspend port */
+#define PORT_RESUME	(1<<6) /* resume it */
+#define PORT_PEC	(1<<3) /* port enable change */
+#define PORT_PE		(1<<2) /* port enable */
+#define PORT_CSC	(1<<1) /* connect status change */
+#define PORT_CONNECT	(1<<0) /* device connected */
 #define PORT_RWC_BITS   (PORT_CSC | PORT_PEC)
-	u32     reserved2[19];
 
-	/* OTGCSR: offet 0x70 */
-	u32     otgcsr;
+/* FOTG210 only: */
 #define OTGCSR_HOST_SPD_TYP     (3 << 22)
 #define OTGCSR_A_BUS_DROP	(1 << 5)
 #define OTGCSR_A_BUS_REQ	(1 << 4)
+#define OTGISR_OVC		(1 << 10)
+#define GMIR_INT_POLARITY	(1 << 3) /*Active High*/
+#define GMIR_MHC_INT		(1 << 2)
+#define GMIR_MOTG_INT		(1 << 1)
+#define GMIR_MDEV_INT		(1 << 0)
+
+/* Section 2.3 Host Controller Operational Registers */
+struct fotg210_regs {
+
+	/* USBCMD: offset 0x00 */
+	u32 command;
+
+	/* USBSTS: offset 0x04 */
+	u32 status;
+
+	/* USBINTR: offset 0x08 */
+	u32 intr_enable;
+
+	/* FRINDEX: offset 0x0C - current microframe number */
+	u32 frame_index;
+
+	/* CTRLDSSEGMENT: offset 0x10 - address bits 63:32 if needed */
+	u32 segment;
+
+	/* PERIODICLISTBASE: offset 0x14 - points to periodic list */
+	u32 frame_list;
+
+	/* ASYNCLISTADDR: offset 0x18 - address of next async queue head */
+	u32 async_next;
+
+	u32 reserved1;
+
+	/* PORTSC: offset 0x20 */
+	u32 port_status;
+
+	u32 reserved2[19];
+
+	/* OTGCSR: offet 0x70 */
+	u32 otgcsr;
 
 	/* OTGISR: offset 0x74 */
-	u32     otgisr;
-#define OTGISR_OVC	(1 << 10)
+	u32 otgisr;
 
-	u32     reserved3[15];
+	u32 reserved3[15];
 
 	/* GMIR: offset 0xB4 */
-	u32     gmir;
-#define GMIR_INT_POLARITY	(1 << 3) /*Active High*/
-#define GMIR_MHC_INT		(1 << 2)
-#define GMIR_MOTG_INT		(1 << 1)
-#define GMIR_MDEV_INT	(1 << 0)
+	u32 gmir;
 };
 
 /*-------------------------------------------------------------------------*/
-- 
2.1.0

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


#1238444 — Re: [PATCH 13/14] RFC: usb/host/faraday-hcd: Move #defines outside struct

FromFelipe Balbi <balbi@ti.com>
Date2015-10-02 19:40 +0200
SubjectRe: [PATCH 13/14] RFC: usb/host/faraday-hcd: Move #defines outside struct
Message-ID<qfctj-1MB-13@gated-at.bofh.it>
In reply to#1229465

[Multipart message — attachments visible in raw view] — view raw

On Mon, Sep 21, 2015 at 05:01:17PM +0200, Peter Senna Tschudin wrote:
> For making the code more readable and to facilitate supporting multiple
> hardware versions, move #defines to outside the struct declaration. This
> patch also renames fhcd2xx_regs to fotg210_regs as this struct is
> specific to fotg210.
> 
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
> ---
>  drivers/usb/host/faraday-hcd.h | 137 ++++++++++++++++++++++-------------------
>  1 file changed, 74 insertions(+), 63 deletions(-)
> 
> diff --git a/drivers/usb/host/faraday-hcd.h b/drivers/usb/host/faraday-hcd.h
> index cf29edf..f75c467 100644
> --- a/drivers/usb/host/faraday-hcd.h
> +++ b/drivers/usb/host/faraday-hcd.h
> @@ -85,7 +85,7 @@ struct fhcd2xx_hcd {			/* one per controller */
>  
>  	/* glue to PCI and HCD framework */
>  	struct fhcd2xx_caps __iomem *caps;
> -	struct fhcd2xx_regs __iomem *regs;
> +	struct fotg210_regs __iomem *regs;

should this be in previous patch ?

personally, I don't see what's the benefit of this patch, however not against it
either.

-- 
balbi

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


#1229469 — [PATCH 07/14] RFC: usb/host/fotg210: Remove a macro from snprintf

FromPeter Senna Tschudin <peter.senna@gmail.com>
Date2015-09-21 17:10 +0200
Subject[PATCH 07/14] RFC: usb/host/fotg210: Remove a macro from snprintf
Message-ID<qbaT9-1N0-45@gated-at.bofh.it>
In reply to#1229455
This patch removes a macro from a call to snprintf() and moves it's
content to just before the call to snprintf() assigning a value to a new
variable named tmp. The goal of this patch is to make the code easier to
understand.

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
---
 drivers/usb/host/fotg210-hcd.c | 43 ++++++++++++++++++++++--------------------
 1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index 55c2279..4032ed0 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -367,6 +367,8 @@ static void qh_lines(struct fotg210_hcd *fotg210, struct fotg210_qh *qh,
 	unsigned size = *sizep;
 	char *next = *nextp;
 	char mark;
+	char *tmp;
+
 	__le32 list_end = FOTG210_LIST_END(fotg210);
 	struct fotg210_qh_hw *hw = qh->hw;
 
@@ -411,28 +413,29 @@ static void qh_lines(struct fotg210_hcd *fotg210, struct fotg210_qh *qh,
 			else if (td->hw_alt_next != list_end)
 				mark = '/';
 		}
-		temp = snprintf(next, size,
-				"\n\t%p%c%s len=%d %08x urb %p",
-				td, mark, ({ char *tmp;
-				 switch ((scratch>>8)&0x03) {
-				 case 0:
-					tmp = "out";
-					break;
-				 case 1:
-					tmp = "in";
-					break;
-				 case 2:
-					tmp = "setup";
-					break;
-				 default:
-					tmp = "?";
-					break;
-				 } tmp; }),
-				(scratch >> 16) & 0x7fff,
-				scratch,
-				td->urb);
+
+		switch ((scratch >> 8) & 0x03) {
+		case 0:
+			tmp = "out";
+			break;
+		case 1:
+			tmp = "in";
+			break;
+		case 2:
+			tmp = "setup";
+			break;
+		default:
+			tmp = "?";
+			break;
+		}
+
+		temp = snprintf(next, size, "\n\t%p%c%s len=%d %08x urb %p",
+				td, mark, tmp, (scratch >> 16) & 0x7fff,
+				scratch, td->urb);
+
 		if (size < temp)
 			temp = size;
+
 		size -= temp;
 		next += temp;
 		if (temp == size)
-- 
2.1.0

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


#1238458 — Re: [PATCH 07/14] RFC: usb/host/fotg210: Remove a macro from snprintf

FromFelipe Balbi <balbi@ti.com>
Date2015-10-02 19:40 +0200
SubjectRe: [PATCH 07/14] RFC: usb/host/fotg210: Remove a macro from snprintf
Message-ID<qfctl-1MB-41@gated-at.bofh.it>
In reply to#1229469

[Multipart message — attachments visible in raw view] — view raw

On Mon, Sep 21, 2015 at 05:01:11PM +0200, Peter Senna Tschudin wrote:
> This patch removes a macro from a call to snprintf() and moves it's
> content to just before the call to snprintf() assigning a value to a new
> variable named tmp. The goal of this patch is to make the code easier to
> understand.
> 
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>

it's a little unnecessary, but no objections.

> ---
>  drivers/usb/host/fotg210-hcd.c | 43 ++++++++++++++++++++++--------------------
>  1 file changed, 23 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
> index 55c2279..4032ed0 100644
> --- a/drivers/usb/host/fotg210-hcd.c
> +++ b/drivers/usb/host/fotg210-hcd.c
> @@ -367,6 +367,8 @@ static void qh_lines(struct fotg210_hcd *fotg210, struct fotg210_qh *qh,
>  	unsigned size = *sizep;
>  	char *next = *nextp;
>  	char mark;
> +	char *tmp;
> +
>  	__le32 list_end = FOTG210_LIST_END(fotg210);
>  	struct fotg210_qh_hw *hw = qh->hw;
>  
> @@ -411,28 +413,29 @@ static void qh_lines(struct fotg210_hcd *fotg210, struct fotg210_qh *qh,
>  			else if (td->hw_alt_next != list_end)
>  				mark = '/';
>  		}
> -		temp = snprintf(next, size,
> -				"\n\t%p%c%s len=%d %08x urb %p",
> -				td, mark, ({ char *tmp;
> -				 switch ((scratch>>8)&0x03) {
> -				 case 0:
> -					tmp = "out";
> -					break;
> -				 case 1:
> -					tmp = "in";
> -					break;
> -				 case 2:
> -					tmp = "setup";
> -					break;
> -				 default:
> -					tmp = "?";
> -					break;
> -				 } tmp; }),
> -				(scratch >> 16) & 0x7fff,
> -				scratch,
> -				td->urb);
> +
> +		switch ((scratch >> 8) & 0x03) {
> +		case 0:
> +			tmp = "out";
> +			break;
> +		case 1:
> +			tmp = "in";
> +			break;
> +		case 2:
> +			tmp = "setup";
> +			break;
> +		default:
> +			tmp = "?";
> +			break;
> +		}
> +
> +		temp = snprintf(next, size, "\n\t%p%c%s len=%d %08x urb %p",
> +				td, mark, tmp, (scratch >> 16) & 0x7fff,
> +				scratch, td->urb);
> +
>  		if (size < temp)
>  			temp = size;
> +
>  		size -= temp;
>  		next += temp;
>  		if (temp == size)
> -- 
> 2.1.0
> 

-- 
balbi

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


#1238437 — Re: [PATCH 01/14] RFC: usb/host/fotg210: Fix coding style issues

FromFelipe Balbi <balbi@ti.com>
Date2015-10-02 19:30 +0200
SubjectRe: [PATCH 01/14] RFC: usb/host/fotg210: Fix coding style issues
Message-ID<qfcjF-1AV-17@gated-at.bofh.it>
In reply to#1229455

[Multipart message — attachments visible in raw view] — view raw

On Mon, Sep 21, 2015 at 05:01:05PM +0200, Peter Senna Tschudin wrote:
> This patch fix coding style issues reported by checkpatch that do not
> change semantics of the code.
> 
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
> ---
>  drivers/usb/host/fotg210-hcd.c | 1248 +++++++++++++++++-----------------------
>  drivers/usb/host/fotg210.h     |   36 +-
>  2 files changed, 558 insertions(+), 726 deletions(-)
> 
> diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
> index 000ed80..48eac34 100644
> --- a/drivers/usb/host/fotg210-hcd.c
> +++ b/drivers/usb/host/fotg210-hcd.c
> @@ -50,32 +50,30 @@
>  #include <asm/irq.h>
>  #include <asm/unaligned.h>
>  
> -/*-------------------------------------------------------------------------*/
>  #define DRIVER_AUTHOR "Yuan-Hsin Chen"
>  #define DRIVER_DESC "FOTG210 Host Controller (EHCI) Driver"
> -
> -static const char	hcd_name[] = "fotg210_hcd";
> +static const char hcd_name[] = "fotg210_hcd";
>  
>  #undef FOTG210_URB_TRACE
> -
>  #define FOTG210_STATS
>  
>  /* magic numbers that can affect system performance */
> -#define	FOTG210_TUNE_CERR		3 /* 0-3 qtd retries; 0 == don't stop */
> -#define	FOTG210_TUNE_RL_HS		4 /* nak throttle; see 4.9 */
> -#define	FOTG210_TUNE_RL_TT		0
> -#define	FOTG210_TUNE_MULT_HS	1	/* 1-3 transactions/uframe; 4.10.3 */
> -#define	FOTG210_TUNE_MULT_TT	1
> +#define FOTG210_TUNE_CERR	3 /* 0-3 qtd retries; 0 == don't stop */
> +#define FOTG210_TUNE_RL_HS	4 /* nak throttle; see 4.9 */
> +#define FOTG210_TUNE_RL_TT	0
> +#define FOTG210_TUNE_MULT_HS	1 /* 1-3 transactions/uframe; 4.10.3 */
> +#define FOTG210_TUNE_MULT_TT	1
> +
>  /*
> - * Some drivers think it's safe to schedule isochronous transfers more than
> - * 256 ms into the future (partly as a result of an old bug in the scheduling
> + * Some drivers think it's safe to schedule isochronous transfers more than 256
> + * ms into the future (partly as a result of an old bug in the scheduling
>   * code).  In an attempt to avoid trouble, we will use a minimum scheduling
>   * length of 512 frames instead of 256.
>   */
> -#define	FOTG210_TUNE_FLS		1 /* (medium) 512-frame schedule */
> +#define FOTG210_TUNE_FLS 1 /* (medium) 512-frame schedule */
>  
>  /* Initial IRQ latency:  faster than hw default */
> -static int log2_irq_thresh;		/* 0 to 6 */
> +static int log2_irq_thresh; /* 0 to 6 */
>  module_param(log2_irq_thresh, int, S_IRUGO);
>  MODULE_PARM_DESC(log2_irq_thresh, "log2 IRQ latency, 1-64 microframes");
>  
> @@ -89,66 +87,57 @@ static unsigned int hird;
>  module_param(hird, int, S_IRUGO);
>  MODULE_PARM_DESC(hird, "host initiated resume duration, +1 for each 75us");
>  
> -#define	INTR_MASK (STS_IAA | STS_FATAL | STS_PCD | STS_ERR | STS_INT)
> +#define INTR_MASK (STS_IAA | STS_FATAL | STS_PCD | STS_ERR | STS_INT)
>  
>  #include "fotg210.h"
>  
> -/*-------------------------------------------------------------------------*/
> -
>  #define fotg210_dbg(fotg210, fmt, args...) \
> -	dev_dbg(fotg210_to_hcd(fotg210)->self.controller , fmt , ## args)
> +	dev_dbg(fotg210_to_hcd(fotg210)->self.controller, fmt, ## args)
>  #define fotg210_err(fotg210, fmt, args...) \
> -	dev_err(fotg210_to_hcd(fotg210)->self.controller , fmt , ## args)
> +	dev_err(fotg210_to_hcd(fotg210)->self.controller, fmt, ## args)
>  #define fotg210_info(fotg210, fmt, args...) \
> -	dev_info(fotg210_to_hcd(fotg210)->self.controller , fmt , ## args)
> +	dev_info(fotg210_to_hcd(fotg210)->self.controller, fmt, ## args)
>  #define fotg210_warn(fotg210, fmt, args...) \
> -	dev_warn(fotg210_to_hcd(fotg210)->self.controller , fmt , ## args)
> +	dev_warn(fotg210_to_hcd(fotg210)->self.controller, fmt, ## args)
>  
> -/* check the values in the HCSPARAMS register
> - * (host controller _Structural_ parameters)
> - * see EHCI spec, Table 2-4 for each value
> +/* check the values in the HCSPARAMS register (host controller _Structural_

if you're fixing coding style issues, you might as well go ahead and fix this
comment style too:

/*
 * check the values ....

--
balbi

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


#1238443 — Re: [PATCH 12/14] RFC: usb/host/faraday-hcd: Replace fotg210 by fhcd2xx

FromFelipe Balbi <balbi@ti.com>
Date2015-10-02 19:40 +0200
SubjectRe: [PATCH 12/14] RFC: usb/host/faraday-hcd: Replace fotg210 by fhcd2xx
Message-ID<qfctj-1MB-9@gated-at.bofh.it>
In reply to#1229455

[Multipart message — attachments visible in raw view] — view raw

On Mon, Sep 21, 2015 at 05:01:16PM +0200, Peter Senna Tschudin wrote:
> This patch replaces the strings:
> FOTG210 by FHCD2XX
> fotg210 by fhcd2xx
> 
> The goal is to remove all references to fotg210 as the driver will
> support both fotg210 and fusbh200.
> 
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>

after a quick look, it looks okay. Keep in mind I don't have HW.


-- 
balbi

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


#1238448 — Re: [PATCH 11/14] RFC: usb/host: Rename fotg210-hcd to faraday-hcd

FromFelipe Balbi <balbi@ti.com>
Date2015-10-02 19:40 +0200
SubjectRe: [PATCH 11/14] RFC: usb/host: Rename fotg210-hcd to faraday-hcd
Message-ID<qfctk-1MB-21@gated-at.bofh.it>
In reply to#1229455

[Multipart message — attachments visible in raw view] — view raw

On Mon, Sep 21, 2015 at 05:01:15PM +0200, Peter Senna Tschudin wrote:
> This patch renames fotg210-hcd to faraday-hcd as a first step of
> consolitating Faraday fotg210 and fusbh200 EHCI-like drivers.
> 
> The patch also updates Kconfig and Makefile.
> 
> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>

please regenerate the patch with -C -M added to git format-patch

-- 
balbi

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


Page 2 of 3 — ← Prev page 1 [2] 3  Next page →

Back to top | Article view | linux.kernel


csiph-web