From: Dan Carpenter <dan.carpenter@oracle.com>
To: Kaaira Gupta <kgupta@es.iitr.ac.in>
Cc: linux-arm-kernel@lists.infradead.org, devel@driverdev.osuosl.org,
Florian Fainelli <f.fainelli@gmail.com>,
Scott Branden <sbranden@broadcom.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org,
bcm-kernel-feedback-list@broadcom.com,
linux-rpi-kernel@lists.infradead.org, Ray Jui <rjui@broadcom.com>,
Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Subject: Re: [PATCH] staging: bcm2835-camera: call function instead of macro
Date: Wed, 19 Feb 2020 07:02:44 +0300 [thread overview]
Message-ID: <20200219040244.GI7838@kadam> (raw)
In-Reply-To: <20200218191747.GA12782@kaaira-HP-Pavilion-Notebook>
On Wed, Feb 19, 2020 at 12:47:47AM +0530, Kaaira Gupta wrote:
> On Tue, Feb 18, 2020 at 09:37:11PM +0300, Dan Carpenter wrote:
> > On Tue, Feb 18, 2020 at 09:37:28PM +0530, Kaaira Gupta wrote:
> > > Fix checkpatch.pl warning of 'macro argument reuse' in bcm2835-camera.h
> > > by removing the macro and calling the function, written in macro in
> > > bcm2835-camera.h, directly in bcm2835-camera.c
> > >
> > > Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
> > > ---
> > > .../bcm2835-camera/bcm2835-camera.c | 28 +++++++++++++++----
> > > .../bcm2835-camera/bcm2835-camera.h | 10 -------
> > > 2 files changed, 22 insertions(+), 16 deletions(-)
> > >
> > > diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
> > > index 1ef31a984741..19b3ba80d0e7 100644
> > > --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
> > > +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
> > > @@ -919,9 +919,17 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
> > > else
> > > f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
> > > f->fmt.pix.priv = 0;
> > > -
> > > - v4l2_dump_pix_format(1, bcm2835_v4l2_debug, &dev->v4l2_dev, &f->fmt.pix,
> > > - __func__);
> > > + v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
> > > + "%s: w %u h %u field %u pfmt 0x%x bpl %u sz_img %u colorspace 0x%x priv %u\n",
> > > + __func__,
> > > + (&f->fmt.pix)->width,
> > > + (&f->fmt.pix)->height,
> > > + (&f->fmt.pix)->field,
> > > + (&f->fmt.pix)->pixelformat,
> > > + (&f->fmt.pix)->bytesperline,
> > > + (&f->fmt.pix)->sizeimage,
> > > + (&f->fmt.pix)->colorspace,
> > > + (&f->fmt.pix)->priv);
> >
> > This is not as nice to look at as the original. Just ignore the
> > warning.
> >
> > regards,
> > dan carpenter
> >
> So, is this warning to be ignored from everywhere in every driver, as it
> doesn't look good? And if yes, then why is it there in the first place?
Obviously the reason for the warning is a good idea. Do a google
search for the dangers of c macros if you don't understand.
But at the same time uniformity and clean code is nice so it's a matter
of setting priorities. Checkpatch is just a Perl script and not the
King of The World. We can ignore it if we want to.
regards,
dan carpenter
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2020-02-19 4:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-18 16:07 [PATCH] staging: bcm2835-camera: call function instead of macro Kaaira Gupta
2020-02-18 18:37 ` Dan Carpenter
2020-02-18 19:17 ` Kaaira Gupta
2020-02-19 4:02 ` Dan Carpenter [this message]
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=20200219040244.GI7838@kadam \
--to=dan.carpenter@oracle.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=devel@driverdev.osuosl.org \
--cc=f.fainelli@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kgupta@es.iitr.ac.in \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=nsaenzjulienne@suse.de \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.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;
as well as URLs for NNTP newsgroup(s).