Re: [PATCH v1 1/3] math.h: Add mult_fract() that takes struct __Txx_fract as argument
From: Joshua Crofts
Date: Wed Nov 18 2026 - 03:22:44 EST
On Tue, 17 Nov 2026 10:14:40 +0100
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> Add mult_fract() that takes struct __Txx_fract as argument and
> calls do_div() instead of plain divisions.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
> include/linux/math.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/include/linux/math.h b/include/linux/math.h
> index 1e8fb3efbc8c..ded258df50df 100644
> --- a/include/linux/math.h
> +++ b/include/linux/math.h
> @@ -128,6 +128,10 @@ __STRUCT_FRACT(u32)
> q * n_ + r * n_ / d_; \
> })
>
> +/* Same as above but for a struct __Txx_fract fraction */
> +#define mult_fract(x, f) \
> + mult_frac(x, (f)->numerator, (f)->denominator)
> +
> #define sector_div(a, b) do_div(a, b)
Sashiko has some remarks.
https://sashiko.dev/#/patchset/20261117091638.1463621-1-andriy.shevchenko%40linux.intel.com
--
Kind regards,
Joshua Crofts