* Re: [PATCH] fbdev: radeon: Remove 'struct timeval' usage
@ 2015-06-05 7:55 Tina Ruchandani
2015-06-05 21:12 ` [Y2038] " Arnd Bergmann
0 siblings, 1 reply; 2+ messages in thread
From: Tina Ruchandani @ 2015-06-05 7:55 UTC (permalink / raw)
To: Dave Airlie
Cc: Tomi Valkeinen, Arnd Bergmann, y2038, Benjamin Herrenschmidt,
Jean-Christophe Plagniol-Villard, Linux Fbdev development list,
LKML
>>> + hz = 1000000/delta;
>
> This needs to be on of the do_div family.
>
> Dave.
Hi Dave,
I build-tested the patch for both 32-bit and 64-bit x86. If my
understanding is correct, since the divisor is 64-bit here, the
compiler will do "if (delta > 1000000) hz = 0; else hz =
1000000/(s32)delta" automatically?
In general, is this a good thumb-rule to follow - use do_div if the
dividend is 64-bit, and normal divide operator if only the divisor is
64-bit?
Tina
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Y2038] [PATCH] fbdev: radeon: Remove 'struct timeval' usage
2015-06-05 7:55 [PATCH] fbdev: radeon: Remove 'struct timeval' usage Tina Ruchandani
@ 2015-06-05 21:12 ` Arnd Bergmann
0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2015-06-05 21:12 UTC (permalink / raw)
To: y2038
Cc: Tina Ruchandani, Dave Airlie, Linux Fbdev development list,
Benjamin Herrenschmidt, LKML, Tomi Valkeinen,
Jean-Christophe Plagniol-Villard
On Friday 05 June 2015 00:55:05 Tina Ruchandani wrote:
> >>> + hz = 1000000/delta;
> >
> > This needs to be on of the do_div family.
> >
> > Dave.
>
> Hi Dave,
> I build-tested the patch for both 32-bit and 64-bit x86. If my
> understanding is correct, since the divisor is 64-bit here, the
> compiler will do "if (delta > 1000000) hz = 0; else hz =
> 1000000/(s32)delta" automatically?
> In general, is this a good thumb-rule to follow - use do_div if the
> dividend is 64-bit, and normal divide operator if only the divisor is
> 64-bit?
>
I got a build error on 32-bit arm now. There is already a check
for an overflow of 10 seconds in there (10 million microseconds),
so it is safe to do the easiest fix is to cast that microsecond
value to a u32.
Arnd
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-05 21:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-05 7:55 [PATCH] fbdev: radeon: Remove 'struct timeval' usage Tina Ruchandani
2015-06-05 21:12 ` [Y2038] " Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®