Re: [PATCH v4 2/3] media: i2c: Add support for the OV8865 image sensor

From: Paul Kocialkowski
Date: Tue Jan 05 2021 - 09:50:28 EST


Hi Sakari,

On Tue 05 Jan 21, 16:41, Sakari Ailus wrote:
> Hi Paul,
>
> On Tue, Jan 05, 2021 at 10:38:47AM +0100, Paul Kocialkowski wrote:
> > Hi Sakari,
> >
> > On Mon 04 Jan 21, 14:07, Sakari Ailus wrote:
> > > Hi Paul,
> > >
> > > On Thu, Dec 31, 2020 at 03:27:01PM +0100, Paul Kocialkowski wrote:
> > > > The OV8865 is a 8 Mpx CMOS image sensor producing 3264x2448 at 30 fps.
> > > > Other modes (including some with sub-sampling) are available too.
> > > > It outputs 10-bit bayer CFA data through a MIPI CSI-2 interface with
> > > > up to 4 lanes supported.
> > >
> > > I've added the patches to a pull request to Mauro; there appear to still be
> > > some checkpatch.pl issues in both of the drivers.
> > >
> > > I don't mind the warnings on the assignment or the mutex though. Could you
> > > address these in additional patches, please?
> >
> > Sorry about that, I realized that I never run checkpatch with --strict
> > so I completely missed those.
> >
> > I'll fix the cosmetic issues in a following patch.
> >
> > Just to clarify one thing:
> > #define OV8865_PAD_PK_DRIVE_STRENGTH_2X (1 << 5)
> > #define OV8865_BLC_CTRL1_COL_SHIFT_128 (1 << 4)
> >
> > these are not single-bit fields so even though it looks like they should
> > use BIT(), this would be incoherent with other possible values, such as:
> > #define OV8865_PAD_PK_DRIVE_STRENGTH_3X (2 << 5)
> > #define OV8865_BLC_CTRL1_COL_SHIFT_64 (2 << 4)
>
> Agreed.
>
> You might not assign the top bit, but if you did, the left operand would
> have to be unsigned to guarantee the intended result (otherwise it's
> undefined).

Ah right, that's the issue with shifting signed constants up to the sign bit.
I had a quick look and I think this driver's safe about it.

Cheers,

Paul

--
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

Attachment: signature.asc
Description: PGP signature