Re: [PATCH v2] v4l: Add driver for Micron MT9M032 camera sensor

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

 



On Tue, 20 Sep 2011, Laurent Pinchart wrote:

> Hi Guennadi,
> 
> On Monday 19 September 2011 21:28:09 Guennadi Liakhovetski wrote:
> > Hi Laurent
> > 
> > just one question:
> > 
> > On Mon, 19 Sep 2011, Laurent Pinchart wrote:
> > > > diff --git a/drivers/media/video/mt9m032.c
> > > > b/drivers/media/video/mt9m032.c new file mode 100644
> > > > index 0000000..8a64193
> > > > --- /dev/null
> > > > +++ b/drivers/media/video/mt9m032.c
> > > > @@ -0,0 +1,814 @@
> > 
> > [snip]
> > 
> > > > +static int mt9m032_read_reg(struct mt9m032 *sensor, const u8 reg)
> > > 
> > > No need for the const keyword, this isn't a pointer :-)
> > 
> > I was actually wondering about these: of course it's not the same as using
> > const for a pointer to tell the compiler, that this function will not
> > change caller's data. But - doesn't using const for any local variable
> > tell the compiler, that that _variable_ will not be modified in this
> > function? Are there no optimisation possibilities, arising from that?
> 
> I would expect the compiler to be smart enough to notice that the variable is 
> never assigned.

Sure, but using "const" would allow the compiler to catch and complain 
about uses like

	foo(&reg);

unless foo() is also declared as foo(const u8 *). But yes, for small 
obvious functions it makes no difference.

> In practice, for such a small function, the generated code is 
> identical with and without the const keyword.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux