Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2187701rwl; Thu, 13 Apr 2023 02:59:11 -0700 (PDT) X-Google-Smtp-Source: AKy350btBFhdAiWLWVZj8tdqPaxlE/DusWKw6SOtdhVMbzZv9pUGKkUbhDXAfYwVq7FzFdCyIh/A X-Received: by 2002:a05:6a20:8b0a:b0:e8:d62c:4aa9 with SMTP id l10-20020a056a208b0a00b000e8d62c4aa9mr1691045pzh.24.1681379951544; Thu, 13 Apr 2023 02:59:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681379951; cv=none; d=google.com; s=arc-20160816; b=ThkL+WQ2zUGqg9IVzDaXEcrFunfZ1TD+EXtJmCnYYKWZu7ZREogKXmcK6dlNzFIyoL eQvj8c42TxYBA8cyp7qSRPNdYdlocN1M819B8KgreuYKG5/sBzNlnENir3jsr5G5YmSk zwGTh7WcZdPqllFKZoQiu5cuW+EreaAKJIs5TVeGFhfSDWsucB6uvUO4avgN0GApXWKT xYKLuoTLFQM2fHVZMZTzICuRRZitP6zwT/99mywSogP7AqS/lWzzhGUdiWBCiBhHv+2M YH1m0CASw5sDis+qDTmreHzuYQjBhQ8W3lMeZgDmJCU/TWDbnqYqwjPQBdYIPh2LKTf7 TZ1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from; bh=7jpJvNt/wMEeMeaJDrh2jVlxoNH0NO/A/NDKxtRAHT0=; b=fHwi81/0H2cMHzMF6KtjXp0IvC5pRcsQ2hFfWRvDGfWUatBSw2U08nhRQe5QIEenFh udNIXArj+P+WvOep+bWCCG0bE8k+uJaXJCpYuP+MrrIcgCxXWkI1v2AC8kFnmtFR3JtQ /BrKA/8RNQbMtaRG3sPdvfXjGp7i27pmfuEY+1UZZfSPQwiG0Uo6qt7X/dhyZ300JKHe w7pYzuDFsw+25XokowUVL31Eq/YgvLVIrSnF2vZKyYdisQZS8c/CGENfqk/P8fuCiCWU yxPaZRTtHzgSz39TfjGEMW3gw72IeAetCf3VzGbbIMKtToLox+9b0V+ak+b73TXPae00 qwIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e12-20020a170902ed8c00b001a525365561si1543812plj.650.2023.04.13.02.59.00; Thu, 13 Apr 2023 02:59:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229958AbjDMJ6f (ORCPT + 99 others); Thu, 13 Apr 2023 05:58:35 -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 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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