Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp398013pxb; Tue, 15 Feb 2022 16:31:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyHkgo2u7f2WdQOzDZ0tGJB8jOOZI1r/XGuTVhQB9qPZGXCVSqUWVyVSMzN9pyczphglAu X-Received: by 2002:a17:90a:9204:b0:1b9:f22:e35e with SMTP id m4-20020a17090a920400b001b90f22e35emr7217529pjo.73.1644971465328; Tue, 15 Feb 2022 16:31:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644971465; cv=none; d=google.com; s=arc-20160816; b=xf2g8Awk3oaGxoMM8kKwLGinc/XhpQA/dfbPcNabRq18TxsgOHcoJWSnJp0F9sTS8j m+vFknEQCtdtCfHqedId5esvG0Yw+noHZFrKAEO4aC1qctJTIJMGfP42wm6IP17MF1IH XtcZkWRHNgfIsaTSoeFljeJ5/FL/1zIEdWrC6y4S0ZaArl0Dj2oPKNZVdytlvJA4RMXL PyX3gQENE5zAR8sYacBkSttFrFd0U8yr7Wo9+ZaddoHNT/Lcmwfl76jc8MXLi5ONZXMt X/mTX2CirBWkQkZptv2G2tmyGbBpcoFpKaBRE33Rvw3s7pNQhZHXhpXgo/pBb+HaYbPV mhKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=7zOeT4G/e4Vj2MFPMlNq0GvvyumVETGnlUk7Wz+iUUI=; b=w+FD1pNW0a+X+3o9HDId62BZ05tGt3vbWTS5JkGzpXopXXSUDukag7yyn5QI7hIbSb RzhJmak99AZvQYN6KA8+W3THhNJ5ltjlCn9Mv0jVYOiCNHQ0fdGyIgx9tfDzmg0GUoOB kzzYvF7AfIP0erJgchw+4/YoAWzT8G+HO31iiBT7TKvz/7JrF7LoMm1xY2K29D04t0LY zsnq8eyaTQUBr4797qfSIOLY71LnELr8fzFFpjlvfEN95rx+dDM1c8aQvhrerLs/L7aB XIS3K539lRZlqBbaH/+hlcpJkPw1KxWYmhJ6XqKspMU/7X9diH/hFqOeKK4X6fF/vzGJ jT8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l62si4307179pge.729.2022.02.15.16.30.46; Tue, 15 Feb 2022 16:31:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237511AbiBOMJu (ORCPT + 99 others); Tue, 15 Feb 2022 07:09:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237502AbiBOMJt (ORCPT ); Tue, 15 Feb 2022 07:09:49 -0500 X-Greylist: delayed 48415 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 15 Feb 2022 04:09:38 PST Received: from hs01.dk-develop.de (hs01.dk-develop.de [173.249.23.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C29FF68C9; Tue, 15 Feb 2022 04:09:37 -0800 (PST) Date: Tue, 15 Feb 2022 13:09:33 +0100 From: Danilo Krummrich To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linus.walleij@linaro.org Subject: Re: [PATCH 1/3] input: ps2-gpio: use ktime for IRQ timekeeping Message-ID: References: <20220211212258.80345-1-danilokrummrich@dk-develop.de> <20220211212258.80345-2-danilokrummrich@dk-develop.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dmitry, On Mon, Feb 14, 2022 at 10:14:24PM -0800, Dmitry Torokhov wrote: > Hi Danilo, > > On Fri, Feb 11, 2022 at 10:22:56PM +0100, Danilo Krummrich wrote: > > @@ -128,20 +155,33 @@ static irqreturn_t ps2_gpio_irq_rx(struct ps2_gpio_data *drvdata) > > unsigned char byte, cnt; > > int data; > > int rxflags = 0; > > - static unsigned long old_jiffies; > > + static ktime_t t_last, t_now; > > + s64 us_delta; > > > > byte = drvdata->rx_byte; > > cnt = drvdata->rx_cnt; > > > > - if (old_jiffies == 0) > > - old_jiffies = jiffies; > > + t_now = ktime_get(); > > + if (t_last == 0) > > Instead of checking this every time, do you think we could seed the > value in ps2_gpio_open() (and also make it per-port, not static)? Oops! Sure, I'll send a v2. I will also add another patch to refactor struct ps2_gpio_data to clearly separate rx and tx state data, otherwise it might start to become a bit messy. > > Thanks. > > -- > Dmitry - Danilo