From nobody Tue Feb 10 20:48:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.42 as permitted sender) client-ip=209.85.128.42; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f42.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.42 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1623879811; cv=none; d=zohomail.com; s=zohoarc; b=hwG0TiwoXwqUAvW4JDnXZV73gbsUcytXTyyYyJ1gn/bz+KqSM2Aat/Oh/7S7F/OyJA90F25OTXSRbTwdOH1yucBly1rUB8PVKBa6LOKJPI92FCYHcVXk54JprIxSgcpT6KICizawKm0q9cEoD9muX8aL0ECTXdZnbPvDB/zHfvE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623879811; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WmyHaJHcvUKLEVm6aSpmTart9qZchQ/2Um+oWz7mMdA=; b=iSQlZrYcOGpoKuihsK6dpSLltHC+0/2X88gq9QttDFtmsB2Ugraa4R/e5vJMHpudrmolGYRqn0juPyUGfQcgurhyUi82X9JWqNNp544L4iQ5YXOT5SGz5gIHz8wKikWYXE8tGtQv1i7+zMdJlXF3HCMdbXatV6gzxYfnOVctdfA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.42 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by mx.zohomail.com with SMTPS id 1623879811823953.4171990835871; Wed, 16 Jun 2021 14:43:31 -0700 (PDT) Received: by mail-wm1-f42.google.com with SMTP id o39-20020a05600c5127b02901d23584fd9bso2188439wms.0 for ; Wed, 16 Jun 2021 14:43:31 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id m65sm2796646wmm.19.2021.06.16.14.43.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 14:43:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WmyHaJHcvUKLEVm6aSpmTart9qZchQ/2Um+oWz7mMdA=; b=gSI59bBqHbKcJKwzyvgmBKRH5hvXTSABasX41TFH0De/0Ui4pY4hIG+zBJDeqUbSnC AU9C0rAUllPQMS1RoWs8fBMLcNvLJZ0TpfB6Py1dX3YMzI6Z1P6vYxfOhdqbOwqQtMI0 1jb9RSyzBw+QTY3cbEjP1dWgJm1qFfjjQ33uMbnPvrjFqt8yUmlyDXDx9r6kFglH27AO 67bXjcDjEIcWlX2B3qfEvr+5RAhNehJ06q2u5sCD78bjhGHs5uIp8+5ZhCRz3bBOr15n 8WwoonqxtHQJDib8Lez0oT7RO75UtBh+xQppFshNYBZg/tClz9hWJsJj6o7YGia7pbae jFGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=WmyHaJHcvUKLEVm6aSpmTart9qZchQ/2Um+oWz7mMdA=; b=UucTMcYbIPTRtoCCqTAgH1LlxUNdUTU4PTf5oOUddJk3P4SyTz+45ZjIFrN1Q52Zwr 09fTBrxel+SyQxyODgJ99tYRIfu5rdy4OqXhHUN4HFRpBzA8+ybUknfAvBIZuJf2fXtz lPOWfVf8rZCcxyZUefE958jDOX1i+PWO90o/+j1PWVjtV6f7s0JBzefZhHgmC0KLCGbY /2vdCH3Db5EPJ+vaBAvDhQjoVeX+XxPhPqKE1uBu/v1VK61NomlzY8lA9eb6aya2qdz7 Thou9GHJmqTPTX2mucxux7R++YCdi30MvycTFOYaFnl65U4lwQL3/JwlBiplC99ededg KaRQ== X-Gm-Message-State: AOAM532qZE0E38+ytJmMfk+IH12EeN1sV+OoPrUSg9Y/cBW24CiK76YJ Ki/ZO3mGBggcF6Gr0ULZck8= X-Google-Smtp-Source: ABdhPJzyOnHL/3rjKttzyhAZVqXsPCbeOclDkPiCFEC4/znyX8cGpgc3MpnVNXBnjimOhHz5PakZ0w== X-Received: by 2002:a05:600c:1ca6:: with SMTP id k38mr1147060wms.49.1623879810085; Wed, 16 Jun 2021 14:43:30 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Corey Minyard , qemu-ppc@nongnu.org, BALATON Zoltan , qemu-arm@nongnu.org, KONRAD Frederic , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v4 06/15] hw/i2c/ppc4xx_i2c: Replace i2c_send_recv() by i2c_recv() & i2c_send() Date: Wed, 16 Jun 2021 23:42:45 +0200 Message-Id: <20210616214254.2647796-7-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210616214254.2647796-1-f4bug@amsat.org> References: <20210616214254.2647796-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Instead of using the confuse i2c_send_recv(), rewrite to directly call i2c_recv() & i2c_send(), resulting in code easier to review. Reviewed-by: Richard Henderson Acked-by: Corey Minyard Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i2c/ppc4xx_i2c.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/i2c/ppc4xx_i2c.c b/hw/i2c/ppc4xx_i2c.c index f4c5bc12d36..75d50f15158 100644 --- a/hw/i2c/ppc4xx_i2c.c +++ b/hw/i2c/ppc4xx_i2c.c @@ -240,11 +240,14 @@ static void ppc4xx_i2c_writeb(void *opaque, hwaddr ad= dr, uint64_t value, i2c->sts &=3D ~IIC_STS_ERR; } } - if (!(i2c->sts & IIC_STS_ERR) && - i2c_send_recv(i2c->bus, &i2c->mdata[i], !recv)) { - i2c->sts |=3D IIC_STS_ERR; - i2c->extsts |=3D IIC_EXTSTS_XFRA; - break; + if (!(i2c->sts & IIC_STS_ERR)) { + if (recv) { + i2c->mdata[i] =3D i2c_recv(i2c->bus); + } else if (i2c_send(i2c->bus, i2c->mdata[i]) < 0) { + i2c->sts |=3D IIC_STS_ERR; + i2c->extsts |=3D IIC_EXTSTS_XFRA; + break; + } } if (value & IIC_CNTL_RPST || !(value & IIC_CNTL_CHT)) { i2c_end_transfer(i2c->bus); --=20 2.31.1