public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: J Freyensee <james_p_freyensee@linux.intel.com>
To: Jesper Juhl <jj@chaosbits.net>
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
	suhail.ahmed@intel.com, christophe.guerard@intel.com
Subject: Re: [PATCH 4/4] n_tracerouter and n_tracesink ldisc additions.
Date: Thu, 05 May 2011 10:08:44 -0700	[thread overview]
Message-ID: <1304615324.8860.61.camel@localhost> (raw)
In-Reply-To: <alpine.LNX.2.00.1104240256160.28014@swampdragon.chaosbits.net>

On Sun, 2011-04-24 at 03:04 +0200, Jesper Juhl wrote:
> On Fri, 22 Apr 2011, james_p_freyensee@linux.intel.com wrote:
> 
> > From: J Freyensee <james_p_freyensee@linux.intel.com>
> > 
> > The n_tracerouter and n_tracesink line discpline drivers use the
> > Linux tty line discpline framework to route trace data coming
> > from a tty port (say UART for example) to the trace sink line
> > discipline driver and to another tty port(say USB).  Those
> > these two line discipline drivers can be used together,
> > independently from pti.c, they are part of the original
> > implementation solution of the MIPI P1149.7, compact JTAG, PTI
> > solution for Intel mobile platforms starting with the
> > Medfield platform.
> > 
> > Signed-off-by: J Freyensee <james_p_freyensee@linux.intel.com>
> 
> A few minor comments can be found below.
> 
> 
> ...
> > +static int n_tracesink_open(struct tty_struct *tty)
> > +{
> > +	int retval = -EEXIST;
> > +
> > +	mutex_lock(&writelock);
> > +	if (this_tty == NULL) {
> > +
> > +		this_tty = tty_kref_get(tty);
> > +
> 
> pointless blank line. I'd suggest removing it.
> 
> 
> ...
> > +		if (this_tty == NULL)
> > +			retval = -EFAULT;
> > +		else {
> 
> If one branch requires braces, both should have them
> 
>         } else {
> 

It's not this way because it passed checkpatch.pl.  In fact, I believe
checkpatch.pl will complain if I add {} to a single if() line.

> 
> ...
> > +static void n_tracesink_close(struct tty_struct *tty)
> > +{
> > +
> > +	mutex_lock(&writelock);
> > +	tty_driver_flush_buffer(tty);
> > +	tty_kref_put(this_tty);
> > +	this_tty = NULL;
> > +	tty->disc_data = NULL;
> > +	mutex_unlock(&writelock);
> > +
> > +}
> 
> pointless blank line at end of function. Remove it.
> 
> 
> > +static int __init n_tracesink_init(void)
> > +{
> > +	int retval;
> > +
> > +	/* Note N_TRACESINK is defined in linux/tty.h */
> > +	retval = tty_register_ldisc(N_TRACESINK, &tty_n_tracesink);
> > +
> > +	if (retval < 0)
> > +		pr_err("%s: Registration failed: %d\n", __func__, retval);
> > +
> > +	return retval;
> > +}
> 
> How about shortening is a bit - like this?
> 
> static int __init n_tracesink_init(void)
> {
>      /* Note N_TRACESINK is defined in linux/tty.h */
>      int retval = tty_register_ldisc(N_TRACESINK, &tty_n_tracesink);
>      
>      if (retval < 0)
>              pr_err("%s: Registration failed: %d\n", __func__, retval);
>              
>      return retval;
> }

I can make the minor modification.

> 
> ...
> > +static void __exit n_tracesink_exit(void)
> > +{
> > +	int retval;
> > +
> > +	retval = tty_unregister_ldisc(N_TRACESINK);
> > +
> > +	if (retval < 0)
> > +		pr_err("%s: Unregistration failed: %d\n", __func__,  retval);
> > +}
> 
> How about:
> 
> static void __exit n_tracesink_exit(void)
> {
>      int retval = tty_unregister_ldisc(N_TRACESINK);
>      
>      if (retval < 0)
>              pr_err("%s: Unregistration failed: %d\n", __func__,  retval);
> }
> 
> 
Dido here.

> ...
> > --- a/include/linux/tty.h
> > +++ b/include/linux/tty.h
> > @@ -50,6 +50,8 @@
> >  #define N_CAIF		20      /* CAIF protocol for talking to modems */
> >  #define N_GSM0710	21	/* GSM 0710 Mux */
> >  #define N_TI_WL		22	/* for TI's WL BT, FM, GPS combo chips */
> > +#define N_TRACESINK	23	/* Trace data routing for MIPI P1149.7 */
> > +#define N_TRACEROUTER	24	/* Trace data routing for MIPI P1149.7 */
> >  
> 
> Lining up those defines would be nice :)
> 
> 



  parent reply	other threads:[~2011-05-05 17:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-22 23:32 [PATCH 4/4] n_tracerouter and n_tracesink ldisc additions james_p_freyensee
2011-04-24  1:04 ` Jesper Juhl
2011-04-24  1:51   ` Greg KH
2011-04-24 23:03     ` Jesper Juhl
2011-04-29 17:02   ` J Freyensee
2011-05-05 17:08   ` J Freyensee [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-05-06 23:56 james_p_freyensee
2011-04-19 22:58 james_p_freyensee
2011-04-19 23:20 ` Randy Dunlap
2011-04-20  0:05   ` J Freyensee
2011-04-20  0:14     ` Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1304615324.8860.61.camel@localhost \
    --to=james_p_freyensee@linux.intel.com \
    --cc=christophe.guerard@intel.com \
    --cc=gregkh@suse.de \
    --cc=jj@chaosbits.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suhail.ahmed@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox