All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: Aastha Gupta <aastha.gupta4104@gmail.com>,
	 outreachy-kernel@googlegroups.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [Outreachy kernel] [PATCH] staging: most: hdm-usb: add comment for struct mutex definition
Date: Sat, 16 Sep 2017 02:52:29 -0700	[thread overview]
Message-ID: <1505555549.16316.3.camel@perches.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1709161134380.2943@hadrien>

On Sat, 2017-09-16 at 11:35 +0200, Julia Lawall wrote:
> 
> On Sat, 16 Sep 2017, Joe Perches wrote:
> 
> > On Sat, 2017-09-16 at 10:23 +0200, Julia Lawall wrote:
> > > On Sat, 16 Sep 2017, Aastha Gupta wrote:
> > > > On Sat, Sep 16, 2017 at 1:18 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > > > > On Sat, 16 Sep 2017, Aastha Gupta wrote:
> > > > > 
> > > > > > This patch fixes following checkpatch.pl checks:
> > > > > > CHECK: struct mutex definition without comment
> > 
> > []
> > > > > > diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c
> > 
> > []
> > > > > > @@ -122,7 +122,7 @@ struct most_dev {
> > > > > >       bool is_channel_healthy[MAX_NUM_ENDPOINTS];
> > > > > >       struct clear_hold_work clear_work[MAX_NUM_ENDPOINTS];
> > > > > >       struct usb_anchor *busy_urbs;
> > > > > > -     struct mutex io_mutex;
> > > > > > +     struct mutex io_mutex; /* synchronize I/O with disconnect */
> > > > > 
> > > > > Why did you choose this comment?
> > > > > 
> > > > > julia
> > > > 
> > > > The use of this struct mutex was mentioned before in the code.
> > > 
> > > I see that it is just in the doc of the same structure.  I'm not sure that
> > > a double comment is needed in this case. I wonder if checkpatch
> > > should/could be extended to address this.
> > 
> > I think that's not feasible.
> > 
> > checkpatch is a patch context based check and wouldn't
> > necessarily know that the mutex is documented elsewhere.
> 
> OK.  It doesn't keep any history?  The kerneldoc is before the structure
> field declaration.

checkpatch reads and stores its input.

checkpatch is, with very few exceptions, a line based
regex scanner.

An input patch context is typically 3 lines above
and below modified content.

Whatever context outside of that +/- 3 is unavailable.

Kernel-doc comments are not parsed by checkpatch as
anything special.

checkpatch code that looks for specific comments looks
only at whether or not a particular block has a comment
at all, not the specific content of the comment.

The checkpatch function test is ctx_has_comment

You are welcome to try to expand the code but I think
there are better possible tools for this.




  reply	other threads:[~2017-09-16  9:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-16  6:43 [PATCH] staging: most: hdm-usb: add comment for struct mutex definition Aastha Gupta
2017-09-16  7:48 ` [Outreachy kernel] " Julia Lawall
2017-09-16  7:56   ` Aastha Gupta
2017-09-16  8:23     ` Julia Lawall
2017-09-16  8:39       ` Joe Perches
2017-09-16  9:35         ` Julia Lawall
2017-09-16  9:52           ` Joe Perches [this message]
2017-09-16 10:09             ` Julia Lawall

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=1505555549.16316.3.camel@perches.com \
    --to=joe@perches.com \
    --cc=aastha.gupta4104@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=julia.lawall@lip6.fr \
    --cc=outreachy-kernel@googlegroups.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.