Re: do_div64 generic

Andrew Morton (akpm@osdl.org)
Mon, 14 Jul 2003 22:38:05 -0700


Bernardo Innocenti <bernie@develer.com> wrote:
>
> I see. do_div() which updates the dividend in-place did not quite apply
> to the usage pattern of the new timer code.

This is getting silly. The timer stuff has been an ongoing bug factory and
now it is colluding with the do_div() saga.

Can we just get the things working, without mangling every architecture
again?

> > The using code tests for the existance of div_long_long_rem and uses
> > the longer do_div() if it does not exist.
> >
> > Could you consider adding this to the generic code?
> >
> > /*
> > * (long)X = ((long long)divs) / (long)div
> > * (long)rem = ((long long)divs) % (long)div
> > *
> > * Warning, this will do an exception if X overflows.
> > */
> > #define div_long_long_rem(a,b,c) div_ll_X_l_rem(a,b,c)
> >
> > extern inline long
> > div_ll_X_l_rem(long long divs, long div, long *rem)
> > {
> > long dum2;
> > __asm__("divl %2":"=a"(dum2), "=d"(*rem)
> >
> > : "rm"(div), "A"(divs));
> >
> > return dum2;
> >
> > }
>
> Here's a patch that takes care of all architectures.

AFAICT, we can just rework posix-timers.c to use the standard do_div() and
be done with it, can we not? ie: no div_long_long_rem(), no
div_ll_X_l_rem(). Just do_div().

Please use `static inline', not `extern inline', btw.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/