[PATCH v1 1/3] math.h: Add mult_fract() that takes struct __Txx_fract as argument
From: Andy Shevchenko
Date: Tue Nov 17 2026 - 04:17:00 EST
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)
/**
--
2.50.1