Re: [PATCH 8/8] HID: logitech: Enable high-resolution scrolling on Logitech mice

From: Linus Torvalds
Date: Thu Nov 22 2018 - 12:06:12 EST


On Wed, Nov 21, 2018 at 10:35 PM Peter Hutterer
<peter.hutterer@xxxxxxxxx> wrote:
>
> This patch is a combinations of the now-reverted commits 1ff2e1a44e0,
> d56ca9855bf9, 5fe2ccbef9d, 044ee89028 together with some extra bits for the
> directional and timeout-based reset.

Instead of using an actual timer (which is quite expensive), how about
just saving the "last time" data along with the remainder?

We have a fairly low-overhead 'sched_clock()' function that gives a
clock approximation in nanoseconds (64 bits). Note that it doesn't
actually give nanosecond precision - it might fall back to jiffies for
hardware that doesn't have anything better, but for timeouts on the
order of a second, it's fine.

Linus