Re: [PATCH 5/6] IIO:hwmon interface client driver.

From: Russell King - ARM Linux
Date: Mon Oct 24 2011 - 15:33:56 EST


On Mon, Oct 24, 2011 at 04:58:49PM +0100, Jonathan Cameron wrote:
> On 10/24/11 16:39, Guenter Roeck wrote:
> > Is div_s64 really necessary, or would
> >
> > result = (long)val * (long)scaleint +
> > DIV_ROUND_CLOSEST((s64)val * (s64)scalepart,
> > 1000000000LL);
> >
> > work as well ?
> Not if you want it to compile on arm v5 by the look of it.
>
> ERROR: "__aeabi_ldivmod" [drivers/staging/iio/iio_hwmon.ko] undefined!

You know, div64 is there to deal with the case of _sanely_ dividing
a 64-bit number by a 32-bit number - there should be absolutely no
question about _not_ using it if that's the operation you are wanting
to perform.

Expecting gcc to do a better job without using div64 is just asking for
bad code on 32-bit platforms.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/