]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
Fix Intel Dollar Cove TI battery driver 32-bit build error
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 26 Nov 2025 20:31:48 +0000 (12:31 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 26 Nov 2025 20:31:48 +0000 (12:31 -0800)
commitad8cccc24887655ebf0a3f459d38d1fb683df46a
treeebc1e653e1aa79655d616e4afe0eda4a62181013
parent32115734c0ed8b463d1020e8da47968735f882c0
Fix Intel Dollar Cove TI battery driver 32-bit build error

The driver is doing a 64-bit divide, rather than using the proper
helpers, causing link errors on i386 allyesconfig builds:

  x86_64-linux-ld: drivers/power/supply/intel_dc_ti_battery.o: in function `dc_ti_battery_get_voltage_and_current_now':
  intel_dc_ti_battery.c:(.text+0x5c): undefined reference to `__udivdi3'
  x86_64-linux-ld: intel_dc_ti_battery.c:(.text+0x96): undefined reference to `__udivdi3'

and while fixing that, fix the double rounding: keep the timing
difference in nanoseconds ('ktime'), and then just convert to usecs at
the end.

Not because the timing precision is likely to matter, but because doing
it right also makes the code simpler.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Cc: Hans de Goede <hansg@kernel.org>
Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/power/supply/intel_dc_ti_battery.c