On Mon Nov 11 11:41:42 2024 +0100, Arnd Bergmann wrote:
> It appears that do_div() once more gets confused by a complex
> expression that ends up not quite being constant despite
> __builtin_constant_p() thinking it is:
> 
> ERROR: modpost: "__aeabi_uldivmod" [drivers/media/dvb-frontends/cxd2841er.ko] 
> undefined!
> 
> Use div_u64() instead, forcing the expression to be evaluated
> first, and making it a bit more readable.
> 
> Cc: Dan Carpenter <dan.carpen...@linaro.org>
> Reported-by: Naresh Kamboju <naresh.kamb...@linaro.org>
> Closes: 
> https://lore.kernel.org/linux-media/ca+g9fyvvnm-ayodlaawwtjegtx0yxr-1r14foa5ahkt0ssv...@mail.gmail.com/
> Reported-by: Linux Kernel Functional Testing <l...@linaro.org>
> Closes: 
> https://lore.kernel.org/linux-media/ca+g9fyvvnm-ayodlaawwtjegtx0yxr-1r14foa5ahkt0ssv...@mail.gmail.com/
> Signed-off-by: Arnd Bergmann <a...@arndb.de>
> Signed-off-by: Hans Verkuil <hverk...@xs4all.nl>
> [hverkuil: added Closes tags]

Patch committed.

Thanks,
Hans Verkuil

 drivers/media/dvb-frontends/cxd2841er.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

---

diff --git a/drivers/media/dvb-frontends/cxd2841er.c 
b/drivers/media/dvb-frontends/cxd2841er.c
index d925ca24183b..415f1f91cc30 100644
--- a/drivers/media/dvb-frontends/cxd2841er.c
+++ b/drivers/media/dvb-frontends/cxd2841er.c
@@ -311,12 +311,8 @@ static int cxd2841er_set_reg_bits(struct cxd2841er_priv 
*priv,
 
 static u32 cxd2841er_calc_iffreq_xtal(enum cxd2841er_xtal xtal, u32 ifhz)
 {
-       u64 tmp;
-
-       tmp = (u64) ifhz * 16777216;
-       do_div(tmp, ((xtal == SONY_XTAL_24000) ? 48000000 : 41000000));
-
-       return (u32) tmp;
+       return div_u64(ifhz * 16777216ull,
+                      (xtal == SONY_XTAL_24000) ? 48000000 : 41000000);
 }
 
 static u32 cxd2841er_calc_iffreq(u32 ifhz)

Reply via email to