Re: [PATCH v7 02/16] media: ov8858: support 19.2 MHz clock and CHT gain setup

From: Andy Shevchenko

Date: Sat Oct 03 2026 - 11:26:23 EST


On Fri, Oct 02, 2026 at 10:13:09PM +0300, Sakari Ailus wrote:
> On Fri, Oct 02, 2026 at 10:14:29AM +0300, Andy Shevchenko wrote:

...

> > > > +#define OV8858_LINK_FREQ (360 * HZ_PER_MHZ)
> > > > +#define OV8858_XVCLK_FREQ_24MHZ 24000000
> > > > +#define OV8858_XVCLK_FREQ_19_2MHZ 19200000
> > >
> > > Why to use HZ_PER_MHZ for LINK_FREQ but not the rest?
> >
> > Because we do not do floats in the kernel. And hence for the consistency's
> > sake.
>
> Floating point operations won't end up in generated code even if you have
> floating point numbers here -- it's an integer constant.

Theoretically there is a room of misinterpretation, not every float number can
be represented as finite binary sequence, meaning that it might be off-by-one
or higher magnitude of difference in the desired and compiled values.

So it is better to avoid floats even on compile-time.

--
With Best Regards,
Andy Shevchenko