Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp643159ybh; Thu, 12 Mar 2020 08:29:09 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuH9u9U+YUCq0HzAGV9y+P4TE5lpjkTcT7QODUkzoIc1K0fzuX3cBXOOr0Y2apcWwBkfoLw X-Received: by 2002:a9d:1eea:: with SMTP id n97mr3235356otn.139.1584026949107; Thu, 12 Mar 2020 08:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584026949; cv=none; d=google.com; s=arc-20160816; b=BfaU1KfVPaEQaVrLw1ff2s8M/YkyiwS1Z/vdmNEp4qNiOw6ehLN5iD//vqzZzHEFmn FlVDJ6K2Cp0c+Y5PXIrCa/2mn9jVOwCH8T5pD4KnkbyoU4UsK1IxntXJ+vz1ei0g+SJU V8w9H3eMz5i3ji/ZrB7P2nIbzOxt8vdOEKTW4SAuEa6wenQkBfnaC12Vi7Nthe4LXoli OKwfGX68rVbJ6JdS3kzKlsP1QI0qDJYoyB+FxwqyO20ak7icgIX5rwYRDGftGH/d73Ph qQosIQRXfW4vVwZPG1qEEZSiMg0+8enumIEftxKWVGk/OqLq9fOSSANl+oB/Fz4aIqw2 /6ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=DM2sty0HqS4SZcjmZmsbs99dVfE/89uzdO4Kf3eNQ5g=; b=A4U8KnFEd5vkb7l+8iPlHMb4i+S9PMwNm3JmsmcKXBS1XMdLMmNWjqMRMzXlgAxpg8 hTeqBuATKP3DC7Tw1gQA7zGFp4mE0B80hQ3liqt3o2I09+Ww9oR/NiIswrvBCcFI0fEw T2/XhLsvB4PeWdJuLF8gONsZHQ3PXAN18QgMzJdAdP0MC1gA02PF0yxL96BLW9m+eKo0 AfTQfTmYeRe2K/nRW5BA2190WKfLsMcUIhhWU5d3iJQJIO4T2qRBpHcUSbUCA8NlKPFQ QdKGwacREuiG57glqHiHCK17yyzUaSPu0qLj2aJa3mKYXCBnflPp/XF/ysdBtj3F3s92 gaXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sg9TuAzG; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w13si2926539otg.2.2020.03.12.08.28.55; Thu, 12 Mar 2020 08:29:09 -0700 (PDT) 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=pass header.i=@gmail.com header.s=20161025 header.b=sg9TuAzG; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727785AbgCLP23 (ORCPT + 99 others); Thu, 12 Mar 2020 11:28:29 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:43414 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727455AbgCLP22 (ORCPT ); Thu, 12 Mar 2020 11:28:28 -0400 Received: by mail-lf1-f66.google.com with SMTP id n20so1847621lfl.10; Thu, 12 Mar 2020 08:28:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=DM2sty0HqS4SZcjmZmsbs99dVfE/89uzdO4Kf3eNQ5g=; b=sg9TuAzG5qW6xY9HltsXNCanIGZsfcL0BeS892DQrm1giBIt2t4L1NgdMWRRMNvcjy 9guRUE5ip4P+jhw01Fk71KagofpCtyt/Lp2hxM5dDP23aoual5cA+ExNVubbtNGnBefe jiIMzk2NDoKssSOL6l1T7VXfRCbPCKTpWsSY1fuYMLmazzRLskhpOgBf7MvMW79og1O5 YyK3PhXcfbUmSQC0REDDDdFh2e0/ZAgxJYFO550UP/thdNuzR+UMrcux6IY+SNPhCLUD ZHTlD7DX/A/xhWVA0K/M8VOhDbgahaysXsDw+1T2+QT/0fOqgQrAs23ZAJ7rsW4sez/e YMOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=DM2sty0HqS4SZcjmZmsbs99dVfE/89uzdO4Kf3eNQ5g=; b=gxOTYKioxi/vV+ICsO+FiXec6mMIRDDI3HgBTqq9YpQGdq4Rkr7I8628l0NnUnoKi9 z6mDBqROBYYNwG6lExJlNJF7U7r8DWdLgiTcPjcmGybqGin+bmC6E1ycPKWlyqw1qbBC Txzl4JajGot5dl49MXdpdxGBBrnpbpIBGsIzC/QDFQ9ffXT4DX5tdZkwnR0vr0AArmeu ACzJvH0ML0KviaMLhr9k7Mime+KjZpss1pV4UPYNedML82xUflYsnkfQCH2uomq+JT08 M+7yJjA4qFUe75kctL0rZXOteO/tDPJ1Uv+5WrIfaKW+jRon23ctgrrYZ4jAdK5B1Biq NNDQ== X-Gm-Message-State: ANhLgQ2HRakehEW4WweOMONm28yV0hbJviuIiGtOy63BEhIZMprZvb5v K0ypgk2PHeHJ72+7c429200= X-Received: by 2002:a19:cbd5:: with SMTP id b204mr5552015lfg.102.1584026906577; Thu, 12 Mar 2020 08:28:26 -0700 (PDT) Received: from [192.168.2.145] (94-29-39-224.dynamic.spd-mgts.ru. [94.29.39.224]) by smtp.googlemail.com with ESMTPSA id o7sm28916578ljp.95.2020.03.12.08.28.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Mar 2020 08:28:26 -0700 (PDT) Subject: Re: [PATCH v7 22/48] Input: atmel_mxt_ts - improve bootloader state machine handling To: Jiada Wang , jikos@kernel.org, benjamin.tissoires@redhat.com, rydberg@bitmath.org, dmitry.torokhov@gmail.com, nick@shmanahar.org, bsz@semihalf.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, erosca@de.adit-jv.com, Andrew_Gabbasov@mentor.com References: <20200212084218.32344-1-jiada_wang@mentor.com> <20200212084218.32344-23-jiada_wang@mentor.com> From: Dmitry Osipenko Message-ID: Date: Thu, 12 Mar 2020 18:28:25 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200212084218.32344-23-jiada_wang@mentor.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 12.02.2020 11:41, Jiada Wang пишет: > From: Nick Dyer > > The code is much clearer if we switch on the actual state the bootloader > is in, rather than the state we want it to be in, and allows the removal > of a goto retry tangle. ... > case MXT_WAITING_FRAME_DATA: > - case MXT_APP_CRC_FAIL: > - val &= ~MXT_BOOT_STATUS_MASK; > + if ((f->previous != MXT_WAITING_BOOTLOAD_CMD) > + && (f->previous != MXT_FRAME_CRC_PASS) > + && (f->previous != MXT_FRAME_CRC_FAIL)) This will cleaner to write as follows: if (f->previous != MXT_WAITING_BOOTLOAD_CMD && f->previous != MXT_FRAME_CRC_PASS && f->previous != MXT_FRAME_CRC_FAIL)