From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BC5BC433EF for ; Tue, 7 Sep 2021 12:05:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 63FCC6008E for ; Tue, 7 Sep 2021 12:05:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242215AbhIGMGT (ORCPT ); Tue, 7 Sep 2021 08:06:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233864AbhIGMGT (ORCPT ); Tue, 7 Sep 2021 08:06:19 -0400 Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16680C061575; Tue, 7 Sep 2021 05:05:13 -0700 (PDT) Received: by mail-oi1-x22f.google.com with SMTP id v2so12458813oie.6; Tue, 07 Sep 2021 05:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=QgBuTujDSU4XFdDQMYIGcpmGBFpkqNzxrdv4/MCwCOE=; b=bIod0gT5i3ZfEjlhLunOZmFQZIvXMJG45ZrrYZ7uZdymqWFDwWIRTATKU8MtMr16OF fKSU/0JJdLV6c8zYkVnsAKoC0MMMWISX+6UTkXg78FG6PlbBRCf7Wu6IBofhxkfd+uoT arhRccM/GsM+zQEWxLWVTeHylzax5S4Bv1Vi5yrIUhW08dY/4JybL1kjpP9h7W09BHiQ tA11LhUSeuI/y1aYm14j4a5+diNhnufd8E2Rv2rx4+qLA0KjU36+RgGpXNJckfmFE9Yp niOhICpjrtDw9YIwMoE10LsdYPlttCC84xgMbAjjGFTVXN5KPIRzTor6V6A7MRXznbe8 9PRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=QgBuTujDSU4XFdDQMYIGcpmGBFpkqNzxrdv4/MCwCOE=; b=Z9Yuv5g/6SJGyldMx5yKs6HVW4DLu7l4GyvH4RgxxhonaRUNuFLVoVj+SAQ/XUYqRI sm594PglVlaQXQ3HCXwOu/M2tx9LKrK9hw5FJTv23iBOtML9WVHLeDxN+vkxNrwio0rN 9ChGqJoeTCsNMT2ycUGbyhb/ShvoUECY8vk1x+ZhcjiX7pW9s+826f6Lq7DIKAw7jKZW hXj7t3F+sCDVXjjagp0mo50ifNvRNTyAz/hZa+36vriFvv5nB/pfZEIrlhnaXPWmc8ZG s4nJy3XnKVjBHhpJ/I6N1N6P8Jl4rdY8awkU/VRDEdgpyM86K0atT6t7f4pnaonmPDX5 scdw== X-Gm-Message-State: AOAM530yyin0P1noCMnVpwRjLJfat7sebAjPw2rtq0rHNt3WDvmogpPU sLPSbcRu/6A3HKh1G0cpHxe6cJJhnB8= X-Google-Smtp-Source: ABdhPJwG5ra9L6Q0CifgD5badOMrjlPShe5dwy2PkHJ5ozyxc/5MD40bV+ZHiBoAGKFaInpMKIB/gg== X-Received: by 2002:a05:6808:1148:: with SMTP id u8mr2649798oiu.133.1631016312042; Tue, 07 Sep 2021 05:05:12 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id j17sm2369114ots.10.2021.09.07.05.05.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Sep 2021 05:05:11 -0700 (PDT) Sender: Guenter Roeck Subject: Re: [PATCH v2] Input: analog: Always use ktime functions To: Geert Uytterhoeven Cc: Dmitry Torokhov , linux-input , Linux Kernel Mailing List References: <20210907063335.2837366-1-linux@roeck-us.net> From: Guenter Roeck Message-ID: Date: Tue, 7 Sep 2021 05:05:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org On 9/7/21 2:40 AM, Geert Uytterhoeven wrote: > Hi Günter, > > On Tue, Sep 7, 2021 at 8:35 AM Guenter Roeck wrote: >> m68k, mips, s390, and sparc allmodconfig images fail to build with the >> following error. >> >> drivers/input/joystick/analog.c:160:2: error: >> #warning Precise timer not defined for this architecture. >> >> Remove architecture specific time handling code and always use ktime >> functions to determine time deltas. Also remove the now useless use_ktime >> kernel parameter. >> >> Signed-off-by: Guenter Roeck >> --- >> v2: Drop helper functions and use ktime_get() and ktime_sub() directly >> Drop 'speed' variable and use NSEC_PER_MSEC directly >> >> drivers/input/joystick/analog.c | 103 ++++---------------------------- >> 1 file changed, 11 insertions(+), 92 deletions(-) >> >> diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c >> index f798922a4598..a9ec41f48068 100644 >> --- a/drivers/input/joystick/analog.c >> +++ b/drivers/input/joystick/analog.c > >> @@ -275,7 +210,7 @@ static int analog_cooked_read(struct analog_port *port) >> this |= data[i]; >> for (j = 0; j < 4; j++) >> if (data[i] & (1 << j)) >> - port->axes[j] = (delta(start, time[i]) << ANALOG_FUZZ_BITS) / port->loop; >> + port->axes[j] = (ktime_sub(time[i], start) << ANALOG_FUZZ_BITS) / port->loop; > > This is now a 64-by-32 division, triggering undefined references to __udivdi3 > on some 32-bit platforms. > And I was sure I checked for those. Oh well. I'll send v3 later today. > Assumed deltas are small, the simple solution of truncating to > 32 bit (like delta() did before): > > - port->axes[j] = (ktime_sub(time[i], start) << ANALOG_FUZZ_BITS) / port->loop; > + port->axes[j] = ((u32)ktime_sub(time[i], start) << ANALOG_FUZZ_BITS) > / port->loop; Yes, I'll do that. Thanks, Guenter