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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7C7AC77B6C for ; Thu, 13 Apr 2023 09:58:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229636AbjDMJ6e (ORCPT ); Thu, 13 Apr 2023 05:58:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229593AbjDMJ6d (ORCPT ); Thu, 13 Apr 2023 05:58:33 -0400 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 764D765BC; Thu, 13 Apr 2023 02:58:31 -0700 (PDT) Received: (Authenticated sender: peter@korsgaard.com) by mail.gandi.net (Postfix) with ESMTPSA id A67FA1BF207; Thu, 13 Apr 2023 09:58:27 +0000 (UTC) Received: from peko by dell.be.48ers.dk with local (Exim 4.94.2) (envelope-from ) id 1pmtik-0081YI-BY; Thu, 13 Apr 2023 11:58:26 +0200 From: Peter Korsgaard To: Matthias Schiffer Cc: Andrew Lunn , Federico Vaga , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux@ew.tq-group.com, Gregor Herburger Subject: Re: [PATCH v2] i2c: ocores: generate stop condition after timeout in polling mode References: <20230413093737.15303-1-matthias.schiffer@ew.tq-group.com> Date: Thu, 13 Apr 2023 11:58:26 +0200 In-Reply-To: <20230413093737.15303-1-matthias.schiffer@ew.tq-group.com> (Matthias Schiffer's message of "Thu, 13 Apr 2023 11:37:37 +0200") Message-ID: <87ile0qf25.fsf@dell.be.48ers.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org >>>>> "Matthias" == Matthias Schiffer writes: > From: Gregor Herburger > In polling mode, no stop condition is generated after a timeout. This > causes SCL to remain low and thereby block the bus. If this happens > during a transfer it can cause slaves to misinterpret the subsequent > transfer and return wrong values. > To solve this, pass the ETIMEDOUT error up from ocores_process_polling() > instead of setting STATE_ERROR directly. The caller is adjusted to call > ocores_process_timeout() on error both in polling and in IRQ mode, which > will set STATE_ERROR and generate a stop condition. > Fixes: 69c8c0c0efa8 ("i2c: ocores: add polling interface") > Signed-off-by: Gregor Herburger > Signed-off-by: Matthias Schiffer > --- > v2: style improvements based on feedback from Federico and Andrew. I went > with a slightly different solution than Andrew suggested to avoid using > the ret variable for two different kinds of returns. Acked-by: Peter Korsgaard -- Bye, Peter Korsgaard