]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
WATCHDOG: sb_wdog: Fix 32 bit build failure
authorRalf Baechle <ralf@linux-mips.org>
Wed, 19 Jun 2013 08:57:33 +0000 (10:57 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Fri, 21 Jun 2013 16:07:03 +0000 (18:07 +0200)
Fixes the following linking problem:
drivers/watchdog/sb_wdog.c:211: undefined reference to `__udivdi3'

This results from reading a 64 bit register, then dividing the value by
1000000.  For 32 bit kernels gcc will use the helper function __udivdi3
from libgcc which the kernel intentionally doesn't provide.

In the read registerbits 23..63 are always zero and only bits 0..22 are
signficant.  So a simple cast to truncate the read value to 32 bits
fixes the issue.

Reported and initial patch by Markos Chandras <markos.chandras@imgtec.com>.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Reported-by: Markos Chandras <markos.chandras@imgtec.com>
drivers/watchdog/sb_wdog.c

index 25c7a3f9652d92781ea03468c369bf0ba746bbf5..ea5d84a1fdad71ad517eba174d5ef1a0fb8cffb0 100644 (file)
@@ -208,7 +208,7 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,
                 * get the remaining count from the ... count register
                 * which is 1*8 before the config register
                 */
-               ret = put_user(__raw_readq(user_dog - 8) / 1000000, p);
+               ret = put_user((u32)__raw_readq(user_dog - 8) / 1000000, p);
                break;
        }
        return ret;