From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753842AbbJBRcq (ORCPT ); Fri, 2 Oct 2015 13:32:46 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:37306 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752407AbbJBRcn (ORCPT ); Fri, 2 Oct 2015 13:32:43 -0400 Date: Fri, 2 Oct 2015 12:32:39 -0500 From: Felipe Balbi To: Peter Senna Tschudin CC: , , , , , , , Subject: Re: [PATCH 09/14] RFC: usb/host/fotg210: Add function: output_buf_tds_dir() Message-ID: <20151002173239.GT5552@saruman.tx.rr.com> Reply-To: References: <20150915165002.GP19948@saruman.tx.rr.com> <1442847678-7970-1-git-send-email-peter.senna@gmail.com> <1442847678-7970-10-git-send-email-peter.senna@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HtRZva1Vzv8iP5ye" Content-Disposition: inline In-Reply-To: <1442847678-7970-10-git-send-email-peter.senna@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --HtRZva1Vzv8iP5ye Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 21, 2015 at 05:01:13PM +0200, Peter Senna Tschudin wrote: > checkpatch complains about too many leading tabs because the switch > statement starts after 6 tabs. >=20 > fill_periodic_buffer() -> for() -> do -> switch() -> if() -> > list_for_each_entry() and finally the last switch(). >=20 > This patch moves the list_for_each_entry() and the last switch() to a > new inline function named output_buf_tds_dir(). This change makes the > code easier to read and calm down checkpatch. This patch changes it to: >=20 > fill_periodic_buffer() -> for() -> do -> switch() -> if() -> > output_buf_tds_dir() >=20 > Signed-off-by: Peter Senna Tschudin if you fix Sergei's comment, then I'm okay with $subject > --- > drivers/usb/host/fotg210-hcd.c | 64 ++++++++++++++++++++++--------------= ------ > 1 file changed, 33 insertions(+), 31 deletions(-) >=20 > diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hc= d.c > index 82cd5da..13cca41 100644 > --- a/drivers/usb/host/fotg210-hcd.c > +++ b/drivers/usb/host/fotg210-hcd.c > @@ -497,6 +497,36 @@ static ssize_t fill_async_buffer(struct debug_buffer= *buf) > return strlen(buf->output_buf); > } > =20 > +/* count tds, get ep direction */ > +static inline unsigned output_buf_tds_dir(char *buf, > + struct fotg210_hcd *fotg210, > + struct fotg210_qh_hw *hw, > + struct fotg210_qh *qh, unsigned size) > +{ > + u32 scratch =3D hc32_to_cpup(fotg210, &hw->hw_info1); > + struct fotg210_qtd *qtd; > + char *type =3D ""; > + unsigned temp =3D 0; > + > + /* count tds, get ep direction */ > + list_for_each_entry(qtd, &qh->qtd_list, qtd_list) { > + temp++; > + switch (0x03 & (hc32_to_cpu(fotg210, qtd->hw_token) >> 8)) { > + case 0: > + type =3D "out"; > + continue; > + case 1: > + type =3D "in"; > + continue; > + } > + } > + > + return scnprintf(buf, size, "(%c%d ep%d%s [%d/%d] q%d p%d)", > + speed_char(scratch), scratch & 0x007f, > + (scratch >> 8) & 0x000f, type, qh->usecs, > + qh->c_usecs, temp, 0x7ff & (scratch >> 16)); > +} > + > #define DBG_SCHED_LIMIT 64 > static ssize_t fill_periodic_buffer(struct debug_buffer *buf) > { > @@ -568,37 +598,9 @@ static ssize_t fill_periodic_buffer(struct debug_buf= fer *buf) > } > /* show more info the first time around */ > if (temp =3D=3D seen_count) { > - u32 scratch =3D hc32_to_cpup(fotg210, > - &hw->hw_info1); > - struct fotg210_qtd *qtd; > - char *type =3D ""; > - > - /* count tds, get ep direction */ > - temp =3D 0; > - list_for_each_entry(qtd, > - &p.qh->qtd_list, > - qtd_list) { > - temp++; > - switch (0x03 & (hc32_to_cpu( > - fotg210, > - qtd->hw_token) >> 8)) { > - case 0: > - type =3D "out"; > - continue; > - case 1: > - type =3D "in"; > - continue; > - } > - } > - > - temp =3D scnprintf(next, size, > - "(%c%d ep%d%s [%d/%d] q%d p%d)", > - speed_char(scratch), > - scratch & 0x007f, > - (scratch >> 8) & 0x000f, type, > - p.qh->usecs, p.qh->c_usecs, > - temp, > - 0x7ff & (scratch >> 16)); > + temp =3D output_buf_tds_dir(next, > + fotg210, hw, > + p.qh, size); > =20 > if (seen_count < DBG_SCHED_LIMIT) > seen[seen_count++].qh =3D p.qh; > --=20 > 2.1.0 >=20 --=20 balbi --HtRZva1Vzv8iP5ye Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWDr+3AAoJEIaOsuA1yqREWWMP/A8+Dc3Hqx7SfPnPPlOaYhDj UzoSOYofM2b77EGNIln9uxknpTzx+QGwziN0+Ef7CvAs1z2iiq1K2GzchQ+ZAMah mhTpLtlrPbSeQrVjw9Ejxb23btpM+yOCgL/M/uMxri+EEOPLWYs5DZvvGQH5Biaf p/OQChJuOkQjr0AD3DtMzEoxUvPgXj6KGfqLTHzQ36pwWhz6OsfAlQ2B0Av5V34C X4y3AiOMcwdUMEzPflLvurGBax0Pq4cNI7t9kfxItjnYKOOcPuqCPkkgPactVeuU HS14zE9ZWk6bH+2dCCEwTFvjktI3shrlVLCHk+XYDFOnTgNhw2IJgA3df7XN1/7O ykAmhqLnsE0ZsDeYwJu1N3Rh1uTlI5JveEIzqOE78SStGfrSG7CNsGYPZs3/B/c3 Pa6q0UYngBdL7uBV8DetzHhp4mfiCcPRJHNPzC+mGrKeWt2/gqmLWiLbf6G7oX/6 xc+KU11BL5ZZZQEo9GAtcV/u7AO5m59LmRlwOVHde32iJjDVl35u7ahDDDzYXnLP oIS+I+Bh/QPj0F8Z2kcNYtgsRcmPgcQOHIRGWxgWxU2lAHPveEOgp6g4KgBir6ui LDURAhive48CWUCMrsNqan+pg0W1/600dyeY9NzriInt0un0wrOBWBBSFSFaUqGv DmVzuQrBcPVgbubUjuH+ =uZxg -----END PGP SIGNATURE----- --HtRZva1Vzv8iP5ye--