Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp149630imu; Mon, 26 Nov 2018 18:33:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wp31JMHB1MEbd4S9lrjnKcwpG+eIlCR1xaaSufuJDzVVpig2BZjL8+ZP40YrqoYXyf7a/G X-Received: by 2002:a17:902:724a:: with SMTP id c10mr14689223pll.51.1543285998298; Mon, 26 Nov 2018 18:33:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543285998; cv=none; d=google.com; s=arc-20160816; b=N+hH+D5WEngMMbQLCY6qJClso6yIUxgDu4A/wI3jxoXLyYJvYcNjdbjUbK9eKlfOLB E8dZo4qhOiwNgD+qgYlBJUtRI5QtvZ939o2EVUrNAJSAtKWfvFhvBhkFBXAZ4qELrCIv /1uhEi6xH03cm4imeV9sRVIN36prBfBwRufgGM+OLbrAhWkdkWw+YxdVDxtI/qEYdM3M lNKwI20gRZNuCby7psSghYB9CzE1QC122odTfUnZzrtDm5gBIP+mUxzrnJodNipVQx/c XXOryKaNyqMCfm5G16Z6anm0SzqDtg/46PULV3GkvQptQ6IMgbqO5fXuprOJVV5begZb AtEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=eRkoPjDP1r8qj3dgHHFxX4EKbP+69/IBT1wXwscFba4=; b=m26UFdz1KNdhQuh1eu7YwAPwenAyWic1Obcal9AOoBigfAsbdxD9dcjEzWVWMo0xSV 45Ku96V9PfBPLpndauGaOz/O+2UU6yBjmz7PduTgsDKHz3nzr8GlgtDcSbIvO2K1g+5m gYp1RxUk+7mgwjDcCJBrwyyr5Q7zlo/67luodBUl7UmmeR0e1aG5+k/0WA52WFrLG65w QHiEDFqxcAFO7u2EnlOSNN57OAHpfGC5w1rbxVd7FrdMsw/Ei1QaeZHnqfvfkf84EKoy i/QVJR5PitA/U3lz0WYqO39VA0LfMnNxpMl3MZM7lViHrx/IgVukItC3SqB0RWrnXy8t dEkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=AOPno8yK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3-v6si2390603pfa.170.2018.11.26.18.33.03; Mon, 26 Nov 2018 18:33:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=AOPno8yK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728351AbeK0N0m (ORCPT + 99 others); Tue, 27 Nov 2018 08:26:42 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:42708 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728338AbeK0N0l (ORCPT ); Tue, 27 Nov 2018 08:26:41 -0500 Received: by mail-lj1-f195.google.com with SMTP id l15-v6so18628272lja.9 for ; Mon, 26 Nov 2018 18:30:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eRkoPjDP1r8qj3dgHHFxX4EKbP+69/IBT1wXwscFba4=; b=AOPno8yKKBdC0HLKA8oG4B42yoX6tERDuhAgrrXyCkFqHEuKwAsrMW3mMb6jpbuPJ9 ErkSeFsHEObKY5GbC0GdWFWIXCJiGq1DPrFptMnlpcFDvve/iL5NAVcVgicpzPF4ixsm etcfqRiiXAMzhnuqJ8eiRpP9ZNkEIj35eUH5U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eRkoPjDP1r8qj3dgHHFxX4EKbP+69/IBT1wXwscFba4=; b=WwI82i9ozL1Psm+n/vWxsPHtMr2mv7eQ/zV3zi03wrJ3SzvvmrK97F55OEIZnMRBWW F24kLpOasozAYCdKFXe5uAPQoXaJEEYp0wvnh96CaFo87CFwxMxc6m+7EwWxFpMPDQ01 lR6XSXb5S52tcwJ2szxR57VaX/wWd/tVvOb3hg9dbwD/c1R8Iyf1edwzkHPumFf8RSH/ W6OW8KGkVAUUROjzgeSbBpkrFVCijDN16BgZba7sFkh4dwawdxJR0ctN8MLAxbTuM4EW ElkPvAGdNWtBwJKTIUNfnyfKyD1X5Hpu++5qh6RIL+Ae3cT1knWzM+i107WgzsH7YeQ+ wHww== X-Gm-Message-State: AA+aEWbudntEfU3fnNfOsRwzmHVP8OWxrEavw2JNfjE7cXwH4Wq0amWJ 2jip3yQH1AnFUjpVVa6ncMJg6jcA23g= X-Received: by 2002:a2e:9e03:: with SMTP id e3-v6mr18415413ljk.4.1543285822824; Mon, 26 Nov 2018 18:30:22 -0800 (PST) Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com. [209.85.167.53]) by smtp.gmail.com with ESMTPSA id p67sm329069lfe.14.2018.11.26.18.30.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Nov 2018 18:30:22 -0800 (PST) Received: by mail-lf1-f53.google.com with SMTP id z13so15187472lfe.11 for ; Mon, 26 Nov 2018 18:30:21 -0800 (PST) X-Received: by 2002:a19:7013:: with SMTP id h19mr18781286lfc.147.1543285820843; Mon, 26 Nov 2018 18:30:20 -0800 (PST) MIME-Version: 1.0 References: <20181122063409.15816-1-peter.hutterer@who-t.net> <20181122063409.15816-5-peter.hutterer@who-t.net> <20181122232839.GA10747@jelly> In-Reply-To: <20181122232839.GA10747@jelly> From: Linus Torvalds Date: Mon, 26 Nov 2018 18:30:04 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 4/8] HID: input: use the Resolution Multiplier for high-resolution scrolling To: Peter Hutterer Cc: linux-input@vger.kernel.org, Dmitry Torokhov , Jiri Kosina , Harry Cutts , Nestor Lopez Casado , Linux List Kernel Mailing , Benjamin Tissoires Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 22, 2018 at 3:28 PM Peter Hutterer wrote: > > The device sends hi-res values of 4, so it should end up as REL_WHEEL_HI_RES > 30. We are getting 28 instead which doesn't add up to a nice 120. I think you're just doing the math in the wrong order. Why don't you just do update = val * 120 / multiplier which gives you the expected "30". It seems you have done the "120 / multiplier" too early, and you force that value into "wheel_factor". Don't. Do all the calculations (including all the accumulated ones) in the original values, and only do the "multiply by 120 and divide by multiplier" at the very end. Hmm? Linus