Skip to content

Commit 1b83a9f

Browse files
Jacopo Mondihverkuil
authored andcommitted
media: amlogic: c3-mipi-csi2: Handle 64-bits division
The kernel test robot reports the following error when building on Hexagon with hexagon-allmodconfig. ERROR: modpost: "__hexagon_divdi3" [drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.ko] undefined! The error is caused by using DIV_ROUND_UP() with a 64 bits divisor with a 32-bit dividend, which on Hexagon and clang-17 is resolved with a call to the __hexagon_divdi3() helper function, part of the compiler support library and not available when building Linux. Use DIV_ROUND_UP_ULL() to fix the build error and avoid calling the __hexagon_divdi3() helper function. Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Jacopo Mondi <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 3328eb4 commit 1b83a9f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <linux/clk.h>
77
#include <linux/device.h>
8+
#include <linux/math.h>
89
#include <linux/module.h>
910
#include <linux/mutex.h>
1011
#include <linux/platform_device.h>
@@ -321,7 +322,7 @@ static void c3_mipi_csi_cfg_dphy(struct c3_csi_device *csi, s64 rate)
321322
u32 settle;
322323

323324
/* Calculate the high speed settle */
324-
val = DIV_ROUND_UP(1000000000, rate);
325+
val = DIV_ROUND_UP_ULL(1000000000, rate);
325326
settle = (16 * val + 230) / 10;
326327

327328
c3_mipi_csi_write(csi, MIPI_PHY_CLK_LANE_CTRL,

0 commit comments

Comments
 (0)