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 X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D437C433E2 for ; Thu, 17 Sep 2020 14:28:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4BF1E2075B for ; Thu, 17 Sep 2020 14:28:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727440AbgIQO2X (ORCPT ); Thu, 17 Sep 2020 10:28:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727472AbgIQO2U (ORCPT ); Thu, 17 Sep 2020 10:28:20 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 520E2C0612F2 for ; Thu, 17 Sep 2020 07:02:47 -0700 (PDT) Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kIuUe-0000yr-Dp; Thu, 17 Sep 2020 16:02:36 +0200 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1kIuUd-0007sB-D8; Thu, 17 Sep 2020 16:02:35 +0200 Date: Thu, 17 Sep 2020 16:02:35 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Christian Eggers Cc: Oleksij Rempel , Shawn Guo , Sascha Hauer , Fabio Estevam , linux-kernel@vger.kernel.org, stable@vger.kernel.org, NXP Linux Team , Pengutronix Kernel Team , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org Subject: Re: [PATCH 1/3] i2c: imx: Fix reset of I2SR_IAL flag Message-ID: <20200917140235.igfq2hq63f4qqhrr@pengutronix.de> References: <20200917122029.11121-1-ceggers@arri.de> <20200917122029.11121-2-ceggers@arri.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="hsjb7ttwvxthj4ux" Content-Disposition: inline In-Reply-To: <20200917122029.11121-2-ceggers@arri.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-i2c@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org --hsjb7ttwvxthj4ux Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, On Thu, Sep 17, 2020 at 02:20:27PM +0200, Christian Eggers wrote: > According to the "VFxxx Controller Reference Manual" (and the comment > block starting at line 97), Vybrid requires writing a one for clearing > an interrupt flag. Syncing with the method for clearing I2SR_IIF in > i2c_imx_isr(). >=20 > Signed-off-by: Christian Eggers > Cc: stable@vger.kernel.org > --- > drivers/i2c/busses/i2c-imx.c | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c > index 0ab5381aa012..d8b2e632dd10 100644 > --- a/drivers/i2c/busses/i2c-imx.c > +++ b/drivers/i2c/busses/i2c-imx.c > @@ -425,6 +425,7 @@ static int i2c_imx_bus_busy(struct imx_i2c_struct *i2= c_imx, int for_busy, bool a > /* check for arbitration lost */ > if (temp & I2SR_IAL) { > temp &=3D ~I2SR_IAL; > + temp |=3D (i2c_imx->hwdata->i2sr_clr_opcode & I2SR_IAL); > imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2SR); > return -EAGAIN; This looks strange. First the flag is cleared and then it is (in some cases) set again. If I2SR_IIF is set in temp you ack this irq without handling it. (Which might happen if atomic is set and irqs are off?!) I see this idiom is used in a few more places in the driver already, I didn't check but these might have the same problem maybe? Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --hsjb7ttwvxthj4ux Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAl9jbHgACgkQwfwUeK3K 7AnqUggAgYDa1nLQExNfvQp94aJ/t79An/B/XcB5UDUqZ72sqiC6zOQnyYIFJui9 a9JZvsTefCEy2BCl88oV1HTpF6BybDDTEFOukk1z7PhDIK9tvfMxbuXZ+ZUdLzOn fC0QHdwgfAzVm+hCTYUNIP6fyNnjsZb8TAVU4IHZnttKdVN7Yz6qAcMYWEWSCFL6 Tj/fheKBHs7/uwzOgjZk7D1IwM1GtjMn7O3jwOMioQs1uum092iiFFjeZX7ma/mE G9wmBXniFtxWoxmWJmzxNE8QKA0ATuWV4GmKzpFzf0BuaypM8RfGHcSlbxvJnn8q XanIVZM4uKj/je+xNideXjFmp7BU3A== =eJd3 -----END PGP SIGNATURE----- --hsjb7ttwvxthj4ux--