Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp5342489ybf; Wed, 4 Mar 2020 22:45:44 -0800 (PST) X-Google-Smtp-Source: ADFU+vtG68RWpS/dorIBdLvMN0EX3IhE1gQRIWURKMxgA0fbEXOkzJxba8U6PS6dY1snC1N8TJDm X-Received: by 2002:a05:6830:57:: with SMTP id d23mr5509338otp.224.1583390744515; Wed, 04 Mar 2020 22:45:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583390744; cv=none; d=google.com; s=arc-20160816; b=0/mK3solf7xaEIW5j9Iq2b8m3xN1J/kVjZtHIL8LZFg5RspVAb/dbTjQ+XdjeUA2Q9 +2hi7Jvocx8E0d+JIonUj+8G8EpAu6qy5XLf5m+0vWaHNjPjzGfuJBTFvswNs4s4m+Dh c+gIXxkEcOomIaQFEOnDZ5vjToEcyGmRUCBZ/8S7bQ4nZF3FSyBl4sZRGBQQhusU+tfg w6ygBDABgIpPW0jxJWSnRl8mBQBx9OLe7kuCchmco85TqKsuyQl9Wys/unZdIOB/0lAs OcmGMuECyGB8swePbDEvNv45UnCu5GPEIriSewjsSX0GXG40HeLjzOJoefsPY+X36iLH 93rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :dkim-signature; bh=iHCLUX4LlZEuEw2wjTqn+Kf9HUrwO3gyzSzh9eS6vB8=; b=xCueFRKk1V4g4pFjw32VP2BcWHLseuYUetohvhCrX7UZt097bSeOeMfx6LngUQMjw1 OHnpUtnNqKsVlLWj7/tV77O7zdcchSE+VvGzIGJTOa5wlIQPjzl5VFiyDC4yLtxxDPMo qr2Dgjwo16kXjZw1pCMRhGdb5RmJsZ6dI7fl0LJne+nHW5/YQyDUHGg7C5AhY82+ZMJf lHkbc9b5JX3qzPRQqd95b+GsUGyx0tGYUEV3iP31vzKsKuV4FK2PI/FSFchtWqB0eiuO AlyHyWqaSsGOMfp6JMJAsXY0IYIzs8tuwihVOT6mkp1lNMIgmqNz8f6H2mKgWoxu5bwa NmwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=i8Z7wwYJ; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9si2921738ota.239.2020.03.04.22.45.32; Wed, 04 Mar 2020 22:45:44 -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=fail header.i=@gmail.com header.s=20161025 header.b=i8Z7wwYJ; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726436AbgCEGo2 (ORCPT + 99 others); Thu, 5 Mar 2020 01:44:28 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:43343 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726251AbgCEGo1 (ORCPT ); Thu, 5 Mar 2020 01:44:27 -0500 Received: by mail-pf1-f193.google.com with SMTP id c144so2275444pfb.10; Wed, 04 Mar 2020 22:44:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id; bh=iHCLUX4LlZEuEw2wjTqn+Kf9HUrwO3gyzSzh9eS6vB8=; b=i8Z7wwYJp4A559I+KmDI1uIIDf4ALcKodvGO5dAfEp8Pbp7WGuoD2aDGeQYZXcGTnh DxJMSLMKx6+dWWK0vx+xrr6VWqM2SeCHrDslGkN1w7SIhXeb+OW9jKBpwu/4wuR4R0fo qcKtYtsGBAV3ozx6TlKvkzo+j6Sqxv7hyngUOOP94we/DANDqxX2X3jjRzZiecp6fw3N +wA/UWriRtmXxNZ7WyLcxnRR7/eM2Au+eB1wJgOrrQ0DPsNFvwBxyiBZvwU8HgVwP93e QfEk7+AAWRL01NFi7tMxF2SuelaHgdOZU/DZUGqXRYbkwx41U5TQJUWYI2nm1zf7O6eB /75w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id; bh=iHCLUX4LlZEuEw2wjTqn+Kf9HUrwO3gyzSzh9eS6vB8=; b=e5FXFKZY8Sbma/zOqeUN/8zUzDytnqJmkfqTvJm2XOY9rBjZZIGKyMfuz0ouAoaEjT vgf9lD1YpgSFE+Thtu3s4bmy4dLEw1WmP2be/5tgZIVXMWtD2JxlMM5NQBtRzGLE+1jX eL+IrY5F8q186NiW4+M8oxG1eFLW3oHap5bmXLc4i29AvV3pQ7pfNtvQI98Jm/p0bWJh eVCrfe86hGryOj1mk+cj+9d5LSY0POIGjPOLcdBk8LgAnX+KmR5J1yVE7lbBKmV4d/03 +Y1zdlNbp9Wqh17hKaWr2mq8UIzsODr69TEAiD6Fbv+n8jUjntIACT1BCyfiSAdiEjbq nYqQ== X-Gm-Message-State: ANhLgQ2pYlz71ljUhTiMqnG7uWSIOEA6pX1WnBKmeyZeVTAmH3Mbl5nh Zil0woQjwKdNbXbKW5Yt6uI= X-Received: by 2002:a62:d10b:: with SMTP id z11mr7164103pfg.38.1583390665965; Wed, 04 Mar 2020 22:44:25 -0800 (PST) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id e1sm30964891pff.188.2020.03.04.22.44.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Mar 2020 22:44:25 -0800 (PST) From: AceLan Kao To: Dmitry Torokhov , "Rafael J. Wysocki" , Thomas Gleixner , Allison Randal , Enrico Weigelt , Stephen Boyd , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Input: i8042 - Fix the selftest retry logic Date: Thu, 5 Mar 2020 14:44:23 +0800 Message-Id: <20200305064423.16196-1-acelan.kao@canonical.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It returns -NODEV at the first selftest timeout, so the retry logic doesn't work. Move the return outside of the while loop to make it real retry 5 times before returns -ENODEV. BTW, the origin loop will retry 6 times, also fix this. Signed-off-by: AceLan Kao --- drivers/input/serio/i8042.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 20ff2bed3917..3f6433a5c8e6 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -944,10 +944,9 @@ static int i8042_controller_selftest(void) */ do { - if (i8042_command(¶m, I8042_CMD_CTL_TEST)) { - pr_err("i8042 controller selftest timeout\n"); - return -ENODEV; - } + if (i8042_command(¶m, I8042_CMD_CTL_TEST)) + pr_err("i8042 controller selftest timeout (%d/5)\n", + i+1); if (param == I8042_RET_CTL_TEST) return 0; @@ -955,7 +954,9 @@ static int i8042_controller_selftest(void) dbg("i8042 controller selftest: %#x != %#x\n", param, I8042_RET_CTL_TEST); msleep(50); - } while (i++ < 5); + } while (++i < 5); + if (i == 5) + return -ENODEV; #ifdef CONFIG_X86 /* -- 2.17.1