Skip to content

Commit 5d515eb

Browse files
committed
drm/sun4i: hdmi: Fix u64 div on 32bit arch
Commit 358e76f ("drm/sun4i: hdmi: Consolidate atomic_check and mode_valid") changed the clock rate from an unsigned long to an unsigned long long resulting in a a 64-bit division that might not be supported on all platforms. The resulted in compilation being broken at least for m68k, xtensa and some arm configurations, at least. Fixes: 358e76f ("drm/sun4i: hdmi: Consolidate atomic_check and mode_valid") Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org> Closes: https://lore.kernel.org/r/CA+G9fYvG9KE15PGNoLu+SBVyShe+u5HBLQ81+kK9Zop6u=ywmw@mail.gmail.com/ Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202403011839.KLiXh4wC-lkp@intel.com/ Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://lore.kernel.org/r/20240304091225.366325-1-mripard@kernel.org Signed-off-by: Maxime Ripard <mripard@kernel.org>
1 parent 9dd81b2 commit 5d515eb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ sun4i_hdmi_connector_clock_valid(const struct drm_connector *connector,
166166
unsigned long long clock)
167167
{
168168
const struct sun4i_hdmi *hdmi = drm_connector_to_sun4i_hdmi(connector);
169-
unsigned long diff = clock / 200; /* +-0.5% allowed by HDMI spec */
169+
unsigned long diff = div_u64(clock, 200); /* +-0.5% allowed by HDMI spec */
170170
long rounded_rate;
171171

172172
if (mode->flags & DRM_MODE_FLAG_DBLCLK)

0 commit comments

Comments
 (0)