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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9747DC433FE for ; Mon, 28 Nov 2022 13:52:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zVbTU8PtygARrEj2pZpFziD0VPxfJSIptcs51iA7cu8=; b=QD3SKI//oY77Xw wrN1xDgy0yyydhYjxlhBCLmAJ00fkh1quyhyLzF2JLyPXvMUy0bXXbLgSeedosbV9xApLCxtX5Gzu xM/IDmYSr7kioMQ8hovIHqNP2kAezb9o09htaNUMhMoSmm4NscORddbPq70PunE2ky+E4CrSVWx1h M4exabkbnZ2jhuefycpBz2+Z6AsJQ3zFOke2cO4QS7rbT2s39cAKqg460p3JxJ5RPZeUUI16S0ThH KxUIhgDGozDWr+Af79i3NAHOYgtPupYJyPmWJsVOmlTadPTxw5LQL/smyThkvUbMGUbhPVWHbpMTC sKokiZt062x+71ghDSNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ozeXV-001z7c-SU; Mon, 28 Nov 2022 13:51:17 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ozeXR-001z4q-Nw for linux-arm-kernel@lists.infradead.org; Mon, 28 Nov 2022 13:51:16 +0000 Received: by mail-wm1-x32c.google.com with SMTP id l39-20020a05600c1d2700b003cf93c8156dso8384017wms.4 for ; Mon, 28 Nov 2022 05:51:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=A4qIw9CSlOm6ggm9ciNJN1TeZJOcMp5IoO7x7apMWbY=; b=PUheZR1NpZnwy4KRhNf7nnLwIkGHB+FvPg3d4NllsEb6kJdBq7yONBrs3hMeyWlnn1 zq7ZDz79pngmWJGbOOpg7tjdv722XGMIA04Jsft2i512lr13vEq85Gy8pUH0PKhRieln XQS+nVeEIzJPmfy5m7XTKjGQ6VRITUaWFNyBu5tcAumfrmGV5H5nWfrykIKNxDbwpvTB 8hgO296977TfbN+W61Ok9Fi/tYwiQfR/1wUcsq3pyTu5Pn6o+ohkdoHtkmUZPSdSZ+qq Sv+9WnU8J0Vs/sWd7h/Pqtpe60IPEmIyYYHgzk8Y67wIP/PY01VQyNFEVT2hCPxE01im /Qug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=A4qIw9CSlOm6ggm9ciNJN1TeZJOcMp5IoO7x7apMWbY=; b=PDTaL5OT/5UuyB2G28ZupLLfclbQP0WQ5rHQiDy9swhWfqnBid4Wkqg6yfAz+qiiBe OcVFvQsnqxgMdIItyt3OMmyr8jgK1f0X7pWEyy90A9CTo1cngUbmjdq+37FEre+HWmit Py1kZbL6w1QRlkS7kmK5WcsNGZM1j534SyBFXAfxrJLIvaJjA8E01qSUM0kLwmQyvkEV +WVoddgutDt+elK6LkQHCWITBIsN1sPk2IwudMfZ9IJotyZms9y0kJQfKiwNMnC9Xa7u hAHfI/iFI5iv9/zvTQzP8GjEbbYNasRXCeSNL5sWpAwSrzeY8NRxxYT5nPhAS9rqBliV 1sjA== X-Gm-Message-State: ANoB5pl5bpxi/YhBe0G6w/NxTNGymZ2P+sr7mD3TRKFTmcxRjVVF43Zk unQEq5wHnkaibNRhaPJr+Pnu0Q== X-Google-Smtp-Source: AA0mqf6nkBPng31LSUbczvahgKFmzQ1kx1CywnM+9hcT4gIL7Y/Lh2Y4uDKbcBxCZeQ9OdymBWy/Ug== X-Received: by 2002:a1c:f606:0:b0:3b4:bf6d:f9ba with SMTP id w6-20020a1cf606000000b003b4bf6df9bamr37179147wmc.133.1669643471076; Mon, 28 Nov 2022 05:51:11 -0800 (PST) Received: from localhost ([2a01:cb19:85e6:1900:2bf7:7388:731d:c4e1]) by smtp.gmail.com with ESMTPSA id g6-20020a5d5406000000b00241d2df4960sm10884840wrv.17.2022.11.28.05.51.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 05:51:10 -0800 (PST) From: Mattijs Korpershoek To: "Lin, Meng-Bo" , linux-input@vger.kernel.org Cc: Dmitry Torokhov , Maxime Coquelin , Alexandre Torgue , Corey Minyard , Srinivas Pandruvada , Benjamin Mugnier , Greg Kroah-Hartman , Zheng Yongjun , Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , Stephan Gerhold , Nikita Travkin , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht Subject: Re: [PATCH] Input: stmfts - retry commands after timeout In-Reply-To: <20221117142753.2477-1-linmengbo0689@protonmail.com> References: <20221117142753.2477-1-linmengbo0689@protonmail.com> Date: Mon, 28 Nov 2022 14:51:09 +0100 Message-ID: <87wn7frxv6.fsf@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221128_055113_803036_6FC11CE3 X-CRM114-Status: GOOD ( 18.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Nov 17, 2022 at 14:28, "Lin, Meng-Bo" wrote: > Add #define STMFTS_RETRY_COUNT 3 to retry stmfts_command() 3 times. > Without it, STMFTS_SYSTEM_RESET or STMFTS_SLEEP_OUT may return -110 to > failed attempt due to no event received for completion. > > Signed-off-by: Lin, Meng-Bo Reviewed-by: Mattijs Korpershoek > --- > drivers/input/touchscreen/stmfts.c | 20 +++++++++++--------- > 1 file changed, 11 insertions(+), 9 deletions(-) > > diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c > index d5bd170808fb..22de34966373 100644 > --- a/drivers/input/touchscreen/stmfts.c > +++ b/drivers/input/touchscreen/stmfts.c > @@ -68,6 +68,7 @@ > #define STMFTS_DATA_MAX_SIZE (STMFTS_EVENT_SIZE * STMFTS_STACK_DEPTH) > #define STMFTS_MAX_FINGERS 10 > #define STMFTS_DEV_NAME "stmfts" > +#define STMFTS_RETRY_COUNT 3 > > enum stmfts_regulators { > STMFTS_REGULATOR_VDD, > @@ -317,19 +318,20 @@ static irqreturn_t stmfts_irq_handler(int irq, void *dev) > > static int stmfts_command(struct stmfts_data *sdata, const u8 cmd) > { > - int err; > + int err, retry; > > reinit_completion(&sdata->cmd_done); > > - err = i2c_smbus_write_byte(sdata->client, cmd); > - if (err) > - return err; > - > - if (!wait_for_completion_timeout(&sdata->cmd_done, > - msecs_to_jiffies(1000))) > - return -ETIMEDOUT; > + for (retry = 0; retry < STMFTS_RETRY_COUNT; retry++) { > + err = i2c_smbus_write_byte(sdata->client, cmd); > + if (err) > + return err; > > - return 0; > + if (wait_for_completion_timeout(&sdata->cmd_done, > + msecs_to_jiffies(1000))) > + return 0; > + } > + return -ETIMEDOUT; > } > > static int stmfts_input_open(struct input_dev *dev) > -- > 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel