From patchwork Fri Feb 11 02:30:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?546L5pOO?= X-Patchwork-Id: 12742735 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D346C433EF for ; Fri, 11 Feb 2022 02:32:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347404AbiBKCcI (ORCPT ); Thu, 10 Feb 2022 21:32:08 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244143AbiBKCcH (ORCPT ); Thu, 10 Feb 2022 21:32:07 -0500 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2092.outbound.protection.outlook.com [40.107.255.92]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 956935FBF; Thu, 10 Feb 2022 18:32:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hIfy3zPFMEbsGtSoSPPqbkeOZ/dLOYRhHpUAR5suGf0g13wWkXMBPST8Fhr6n/7cQw5DqX2AdL7hqO2geNXWARmpnRgvAaRXQ/b9VHLTMT8tFEIbPQnJ+qjBY0dhfBHqH/WEA3Jujet6Vqxhxo4ASGgUua+3W2YMZgdME8yLHeHNXszr8EkJZCsegRjL4m4Rrf2hzfQJXoKAzUn2Nziou+RKBQTUIjeWmLStwmtLIoriEyWVYLjFFz+JtfaJE6Yb1fvTU3haZeC0UzG/kJdWGiXtFbCnLk34hPB/ZaevsLKWne/VXoBsxKEaF19bgjwJNc1QD8CB/XAu1TEuuXdT8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AJmrL/wszRwZlM8YVbrQxGpNSgXK6M6vSTblQPIFMZk=; b=fZLtPnmelz9hHT+SBLwremtvuxlBf/i97duKgdlLicJMapgsGYxkM7ekYio7Pqs2xqalvaWb4a4PPyY6ePuE46T+6ECgZEg7AQPNZeiW410j8/dtomsvKjD3vfQIBxHdIFYI6CvJ0HDNZHApXCu+E8yxgvBJg4q5sNHXPw8HaXSTcCff7VQA/oPNpMgyeU0YW9nTl9KFgXwKNJOKiQU98yjlcsPcKdnafBe/Q+9lGFt45RQVyvI7yLjBrl3xGWLMxNeFahRxuyFQDtpEzF4Z/lTa4P0ARmevDbfyt9Wn2JwOJ0Ncn93UcBRzHU2abDTvZSvgJCmVDFnPL8kOP+Y64A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo0.onmicrosoft.com; s=selector2-vivo0-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AJmrL/wszRwZlM8YVbrQxGpNSgXK6M6vSTblQPIFMZk=; b=LDllR3IILBHFO0J/aZBfYXz5fNvlV220gcDU3SWKf+HU7oHuWzU/dB0FR2LJfl/dYcSy8cqB31wWUe2Mb6FEIUq7uzbzVVCpg+g3myBOJgzqZwDq2/jtLrEXi7JxOgHSh2NqwPFlxkIDBzHxIi0wn+xWvRizEAh0w+V3IgMIFtU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SL2PR06MB3082.apcprd06.prod.outlook.com (2603:1096:100:37::17) by TY2PR06MB2895.apcprd06.prod.outlook.com (2603:1096:404:31::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.17; Fri, 11 Feb 2022 02:32:05 +0000 Received: from SL2PR06MB3082.apcprd06.prod.outlook.com ([fe80::80b4:e787:47a9:41bb]) by SL2PR06MB3082.apcprd06.prod.outlook.com ([fe80::80b4:e787:47a9:41bb%4]) with mapi id 15.20.4975.014; Fri, 11 Feb 2022 02:32:05 +0000 From: Qing Wang To: Konrad Rzeszutek Wilk , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= , Jens Axboe , Michael Turquette , Stephen Boyd , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , "Pan, Xinhui" , Srinivas Pandruvada , Jiri Kosina , Benjamin Tissoires , Dmitry Torokhov , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, Mauro Carvalho Chehab , Hans Verkuil , xen-devel@lists.xenproject.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-input@vger.kernel.org, linux-media@vger.kernel.org Cc: Wang Qing Subject: [PATCH V2 6/13] input: serio: use time_is_before_jiffies() instead of jiffies judgment Date: Thu, 10 Feb 2022 18:30:29 -0800 Message-Id: <1644546640-23283-7-git-send-email-wangqing@vivo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1644546640-23283-1-git-send-email-wangqing@vivo.com> References: <1644546640-23283-1-git-send-email-wangqing@vivo.com> X-ClientProxiedBy: HK2PR02CA0178.apcprd02.prod.outlook.com (2603:1096:201:21::14) To SL2PR06MB3082.apcprd06.prod.outlook.com (2603:1096:100:37::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d708849d-f73a-4f4d-cc35-08d9ed06b144 X-MS-TrafficTypeDiagnostic: TY2PR06MB2895:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Knvn+ZoyuwtwWjb9mcX7NX4jSd5sdfPjHKvVg0RXnl4B0HLfdv7nMLFc7oEB4uoAC7nhPliMSDWanEG6pMpbUMVchrTfRPtCpo+Y9i2hsRrc25VPJsQIlYgbOHynMgwohX+gOCxM98x/hcUkKTKy6Ryyhot4nSM/0df5459+EPX+x8NZu34ETQArWLJOO3DJoFyzdyDDJijXFnKF8StSK8SDk/KX6pxA24EhE4BsT7pE8nNubWPzCoKTJZ7vOov0foDGTTu6krh/sLcMo6L6nZ6nydKlrooia830KyO7n+KfO43/q8wgsu0A+JODt2HzqOlnx941h+brnfgGknRGrExAUXDCl8qIKFU0jeXg2oIM3raNNQXDgmZPJOmeMV9EhhTFBr5mgg1YOlGcDkX2Rx3CZfKwql7KkyvR7akXzIHPo3pC+7d2N4rU1kFHPBOq+rv1FrY2/QtW3a0t65ZNCOQDeECkSq5ewxwXJiYpN0ZKgFH1KLjT7ocJcx1ye2Mjkzh1io96S0XXVoxVwnFgltmxzN3tbxnfFLn3kP0Jnh9Sv4sKlzKr13KfQgEjlD66Y8FsDfp3Xp3FqQnn+hJ4WkYB0fL0fxaXSwDlsdL/R1zm5erAtH3JjL2OMueHjzOjBFj1hDM2oTVUQ3HXfriBYbSf4BBfNyfwfOv7LhlhMppZxHs0XurFN1SuOtP7wCSnfPcNMxU25l/4naC+SDZhkRhEnwSvc6XBS+HkJgo+XK7hZZGCTdgfdd8zaO/cYRS9 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SL2PR06MB3082.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(38100700002)(2906002)(316002)(110136005)(86362001)(6486002)(38350700002)(6506007)(6666004)(26005)(186003)(2616005)(6512007)(5660300002)(8676002)(7406005)(508600001)(36756003)(4326008)(8936002)(83380400001)(107886003)(921005)(52116002)(66556008)(66476007)(7416002)(66946007)(21314003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: j1JTYbUZFwE57rs9P/bZPsIXhEWUhUwZYslxJXmoBcB0DzYfbRs71yby+bz/vz75e/QAd9pa2P700yMpBDdgLxzW6+5gs4C2NReUwTJLVy/jkasgGvEJEAMoANyh3VAVxDLRWeKzNgfmUh59OQ0gG7J78o38VzqvB2TASGOVv9JmA04H3jizVATIIQjKFAWUEX2zZraRVTaLYF/Kn/KwzMw+jry1qtD4Pk3NcNq3a9h8UVqazDvMEWaV6dI+Ps0UjvurBJ0po1LIa12Dn1BruvzU4WmY8X/Q2Sur9NeUloSc8ccM0l5hQfo0YztFRCut2eaB6mWaG1NKEJ3KjWSsLKJU1ksTHAptEVL+jpRpQj7+D6zg0cYdt8RfQzBKDr/sxGlyKyCaHs1vK6+Z70aP5NdTA0vFxnluiB8Cp3N6bDN7BqbEpAAAMj+WVfPHTtIByNjhVb+oDGgc/O4OLFVaYNrrrVHz5Zi3tt5ZMkj7zIUURoHN7vpQHb3Y99X2LhgNrHZ8kbkuhPnXNZAU0Ysfw/jsRKosMzLH/vn9iS3+9Jk5h0q75TeX8s/kGubhwUfMgV/S2lLcpf0UpUsYHxxtYzonK0oCVegi+YetZ4v7+g+GSVsGmb+KPqjx4Mr695Kr/ltQ8+JgB8Ia+dmkVLpmdq1udpl1z/U8BjmWMAcnjNrypYQrJkBH0UESuwbjcCN/nGRl+164MP1mXYSCfsVevoaKz+vMKE14aCjXvtA03yJ/PZTteqsLnw66sOptNlHnVKIL9l0Fdcj+jDebUhmOIBpfoOIcioevcPPSiH9jWL1swvSekt6owINn4xveOlxIl0GOQ3j3Yo71yZzslNQDV5uF5+Ur/j7819SU+IkaojzQ1dJJ1+bO7f2XBNBmRiFtCytMviKz23TLEqe5WYTk+T5zePcV84QL1bJ2C+xqdrSkr8Yf6OoaeZBupFAwVm4xcTVHHVYUMWx2PPwExu9WPAKIM7Uh190sthnfabctRky2InIzIZAhV4Mku/KhSzHGHOKpVYOThcYCUVE8Hmk0yhWYjAf4LcHs9rDTRBw7GqMQh0dP3IL9OLY7BQ6HfAy+tZk9yltgjheKpwqhga1YZWgZQPYAlpDINa27srj1yAPpMJDC8MYdUo8qF+DflfHJJQHU/+hRlXiymTJBgXWKu12JEX7xCeknq1Hm2kyhmScKRHlU1vQpaDbZgMU04tH6zjPWq4ENhOO27Qv/3PHBcZXW7HhJQ7IlfO7QKTINUY8edr/J825MBIGDIxE1ZIW2/lJoP+5aYqcAj4Mn9uwCazYon5CmGekCEjPpKYzI/4U+1h5LnacScpbVRhSDZOhzC/nvAredJ67lub0o0a36TEg5zvNi9tugM5q0F30Zr1Xo/YHair/UowF6j/fWerUeIUQhadUX7HZz3tJuCFj3rjerGRWG6qPWq2OOJcB7iltVZ9HQI5GAo4/MsgPPdvQXOtXIVeT2fLFQeQwtp9m5ixLahLkTIevJsLNjsAxF07GN1agDblRVNjIofefahuoICwB6CS/Vxns6d/Yqw/ibLnrtVe0p0IZq4Hz8+TRwiysYCTaru+5OfIlnMukaKBQz5hUy12PLehFXl8E6uVFvuTbGOTOaM/sLAUWkpuhcXA0= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d708849d-f73a-4f4d-cc35-08d9ed06b144 X-MS-Exchange-CrossTenant-AuthSource: SL2PR06MB3082.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2022 02:32:05.1954 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AKip6f9iqiS3IpgYMeOPaufHSDL7O8bFVrZCqIKCGXNHOnl1Y+SvZVBj97LT3qYik6/RGDYwW2+DwZ8sR60wNw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY2PR06MB2895 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Wang Qing It is better to use time_xxx() directly instead of jiffies judgment for understanding. Signed-off-by: Wang Qing --- drivers/input/serio/ps2-gpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/input/serio/ps2-gpio.c b/drivers/input/serio/ps2-gpio.c index 8970b49..7834296 --- a/drivers/input/serio/ps2-gpio.c +++ b/drivers/input/serio/ps2-gpio.c @@ -136,7 +136,7 @@ static irqreturn_t ps2_gpio_irq_rx(struct ps2_gpio_data *drvdata) if (old_jiffies == 0) old_jiffies = jiffies; - if ((jiffies - old_jiffies) > usecs_to_jiffies(100)) { + if (time_is_before_jiffies(old_jiffies + usecs_to_jiffies(100))) { dev_err(drvdata->dev, "RX: timeout, probably we missed an interrupt\n"); goto err; @@ -237,7 +237,7 @@ static irqreturn_t ps2_gpio_irq_tx(struct ps2_gpio_data *drvdata) if (old_jiffies == 0) old_jiffies = jiffies; - if ((jiffies - old_jiffies) > usecs_to_jiffies(100)) { + if (time_is_before_jiffies(old_jiffies + usecs_to_jiffies(100))) { dev_err(drvdata->dev, "TX: timeout, probably we missed an interrupt\n"); goto err;