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 569E8EB64D8 for ; Wed, 14 Jun 2023 00:09:22 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qvMyqpJvGg2J0FEKyaSajLdva15u63H7AZYRVukNfgk=; b=jjm813iizfiOYt CZTp8zeO6cUoRQ0ZArmP/+VsHtFbosPRwEdw/TR6FojoDYsUU0BCJqyAdb+sChilI1WEgYIEJddoI NgpSirpla3psEtjjht/IGnEvhN1MzpjwCS4FLC9Povj6ZHNn1AHBzRXyhG+GGGWxpENptSgHOisC8 JGhYT7SGc520F7jOUDVdbthN+tlvLfl20J2H7jK0Wrk2PrufE/alKPXTY79IowrVzw/URTpJ/irWJ RBZ8AsYdslailB4gewtuk+Eg0illK+bAFlNdPvetF+bRdaaOo83kvSUCvJFNN1NFF2I7fzl11HA78 XRPzKW4oW2vgO7o3P+4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q9E4N-009VfN-0o; Wed, 14 Jun 2023 00:09:03 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q9E4G-009Veg-0o for linux-arm-kernel@lists.infradead.org; Wed, 14 Jun 2023 00:09:01 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8BB4662F25; Wed, 14 Jun 2023 00:08:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40F9BC433C8; Wed, 14 Jun 2023 00:08:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686701335; bh=XVcCLcjgh55HgAnQRCWkPHl4rRjmtMsm/qZTPHVmnBY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IPP4+tOzUEYHR/mpDuoyZbwNHSpgN2cNlnywQObuJKAna3GdD5z2sqYDPVCsBKfJp 0H47dIdciBIv4CJIxy5EoYAnr9wBjfi3A7McQf+kFHfg3ivcpMSK2fQXm4bKCpkVmS ONYPs3T0rMraQ3E5nSS0vpG7fudbpTTCdHMGG4DCJKobCoLGXKlRtK4MRgdY+7hVYs GTOoIZdEtkWlsKmRBPHC7m54ixovwBNJUrRE3RfcabOUz7fJlZJHQhV1uVJHpXsUd/ vfMKR6F0Xk+u0K5ZJmEXng+4+884IKNiF2FObt/4LvFj6S8cqKcQeeS8wpwA2PoAvx pU7xkqM89xThw== Date: Wed, 14 Jun 2023 02:08:41 +0200 From: Andi Shyti To: carlos.song@nxp.com Cc: aisheng.dong@nxp.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiaoning.wang@nxp.com, haibo.chen@nxp.com, linux-imx@nxp.com, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] i2c: imx-lpi2c: directly return ISR when detect a NACK Message-ID: <20230614000841.frvf4n5zgh5eihmq@intel.intel> References: <20230524024002.1790405-1-carlos.song@nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230524024002.1790405-1-carlos.song@nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230613_170856_354409_4F6861E6 X-CRM114-Status: GOOD ( 21.86 ) 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 Hi, On Wed, May 24, 2023 at 10:40:02AM +0800, carlos.song@nxp.com wrote: > From: Gao Pan > > A NACK flag in ISR means i2c bus error. In such codition, > there is no need to do read/write operation. It's better > to return ISR directly and then stop i2c transfer. > > Fixes: a55fa9d0e42e ("i2c: imx-lpi2c: add low power i2c bus driver") > Signed-off-by: Gao Pan > Signed-off-by: Carlos Song looks good to me, just a little note. > --- > drivers/i2c/busses/i2c-imx-lpi2c.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c > index 1af0a637d7f1..11240bf8e8e2 100644 > --- a/drivers/i2c/busses/i2c-imx-lpi2c.c > +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c > @@ -514,15 +514,17 @@ static irqreturn_t lpi2c_imx_isr(int irq, void *dev_id) > temp = readl(lpi2c_imx->base + LPI2C_MSR); > temp &= enabled; > > + if (temp & MSR_NDF) { > + complete(&lpi2c_imx->complete); > + goto ret; > + } > + > if (temp & MSR_RDF) else if () and remove goto and brackets. You have used the "else if" below and we can keep it consistent. This way the commit log should be a bit different as we decide to check exclusively using else if's for the active bits. This way we also stop processing the MSR register if a NACK is received. With the above I can give you a conditional r-b: are you able to pull Dong into this review as Wolfram asked? Thank you, Andi > lpi2c_imx_read_rxfifo(lpi2c_imx); > - > - if (temp & MSR_TDF) > + else if (temp & MSR_TDF) > lpi2c_imx_write_txfifo(lpi2c_imx); > > - if (temp & MSR_NDF) > - complete(&lpi2c_imx->complete); > - > +ret: > return IRQ_HANDLED; > } > > -- > 2.34.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel