staging: goldfish: use div64_s64 instead of do_div
authorArnd Bergmann <arnd@arndb.de>
Mon, 1 Feb 2016 10:33:00 +0000 (11:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Feb 2016 02:26:36 +0000 (18:26 -0800)
commitb0e302b40873c0418aacaad2aa455bf867c9d1a2
tree50511fab437e90cb7e042507e544e54de803740f
parent025fb792bac33632c19fe12265ba1f6108921300
staging: goldfish: use div64_s64 instead of do_div

The goldfish nand driver divides a signed 64-bit number (loff_t)
in multiple places using the do_div() function. This has always
been unreliable but now produces a compiler warning (since 4.5-rc1):

goldfish/goldfish_nand.c: In function 'goldfish_nand_erase':
goldfish/goldfish_nand.c:107:91: error: comparison of distinct pointer types lacks a cast [-Werror]
goldfish/goldfish_nand.c: In function 'goldfish_nand_read_oob':
goldfish/goldfish_nand.c:145:91: error: comparison of distinct pointer types lacks a cast [-Werror]

This changes the code to the equivalent div_s64{,_rem} that
works correctly for negative numbers (which we should never
get here).

The warning has shown up on ARM allmodconfig builds after the goldfish
bus driver has become visible on ARM.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: bd2f348db503 ("goldfish: refactor goldfish platform configs")
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/goldfish/goldfish_nand.c