Re: [PATCH] staging: bcm2835-camera: call function instead of macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
> > > ---
> > >  .../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

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux