On Tue, Jul 12, 2022 at 12:13 PM Paul Cercueil <paul@xxxxxxxxxxxxxxx> wrote: > Le mar., juil. 12 2022 at 10:24:02 +0200, Andy Shevchenko > <andy.shevchenko@xxxxxxxxx> a écrit : > > On Mon, Jul 11, 2022 at 9:46 PM Paul Cercueil <paul@xxxxxxxxxxxxxxx> > > wrote: > >> > >> When the IIO channel has a scale_available attribute, we want the > >> values > >> contained to be properly converted the same way the scale value is. > > > > Beside that not very readable `foo <<= x == y;` line, I think this > > will look much better if we first convert the rescale driver to use > > struct s32_fract (or whatever is suitable). > > More like a s64_fract since IIO uses two ints + a type to represent how > the value should be computed from the ints. So, it's s32_fract :-) > Is something like that already implemented somewhere in the kernel? math.h and a few drivers are already using it. -- With Best Regards, Andy Shevchenko