[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALAqxLUCD7zxyNrZJnKUE3wbORyZez-bDvScGLXyTjVvvZdinA@mail.gmail.com>
Date: Tue, 2 Dec 2014 08:54:13 -0800
From: John Stultz <john.stultz@...aro.org>
To: Chris Wilson <chris@...is-wilson.co.uk>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Intel Graphics Development <intel-gfx@...ts.freedesktop.org>,
LKML <linux-kernel@...r.kernel.org>,
John Stultz <john.stultz@...aro.org>,
Daniel Vetter <daniel.vetter@...el.com>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: compute wait_ioctl timeout correctly
On Tue, Dec 2, 2014 at 8:35 AM, Chris Wilson <chris@...is-wilson.co.uk> wrote:
> On Tue, Dec 02, 2014 at 04:36:22PM +0100, Daniel Vetter wrote:
>> +static inline unsigned long nsecs_to_jiffies_timeout(const u64 m)
>> +{
>> + u64 usecs = div_u64(m + 999, 1000);
>> + unsigned long j = usecs_to_jiffies(usecs);
>> +
>> + return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1);
>
> Or more concisely and review friendly:
>
> static inline unsigned long nsecs_to_jiffies_timeout(const u64 n)
> {
> return min_t(u64, MAX_JIFFY_OFFSET, nsecs_to_jiffies64(n) + 1);
> }
Yea. This looks much nicer. Seems generic enough it might be better
added next to nsec_to_jiffies64() in kernel/time/time.c or jiffies.h
rather then in a driver header.
And clearly the header comment in nsec_to_jiffies() warning its only
for the scheduler and not for use for drivers (for exactly the reason
of this patch) are not obvious/memorable enough for me and Thomas
makes me wonder if we should change its name to be more clear that its
a sched only function.
thanks
-john
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists