From nobody Tue Feb 10 03:39:48 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.41 as permitted sender) client-ip=209.85.221.41; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f41.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.41 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1623930860; cv=none; d=zohomail.com; s=zohoarc; b=QIkyi58XVrIte2eVBzzApGWtBa0J3a4Jts5cFYsOutVSC3fAHg2nCeCYYtsbfW5olqn6/2okz5xPtZGmDDgI22V+It1PT6soyMX2cPuwHzbw3Sj2q3UCt0Si1umsw3N5tJoEIK48duB025dSzyIDzI2idXwhpzFwG0S5dOG2V6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623930860; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TAZ5Nd2Zr4AEdYczPbEyYCejydYTPBGPwGnfyFJKBD8=; b=hnf+Q27eLubYCgy+2xMEdHZBeMHZ72OmsAYbCp5VCOIwu7bpszLLgedCoh9drFq1X1zNdA9jSpbTP5oduTbPKKP/sPO/NkRU+a/RgCw5xGYPJp12k+7pxPy06NOBv4XD7hCE+QMwO84juJZFburf/G1uQz+BaI65JK7gI7Zn1OQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.41 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail header.from= (p=none dis=none) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by mx.zohomail.com with SMTPS id 1623930860425786.6152794067228; Thu, 17 Jun 2021 04:54:20 -0700 (PDT) Received: by mail-wr1-f41.google.com with SMTP id n7so6473289wri.3 for ; Thu, 17 Jun 2021 04:54:19 -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 t19sm1450841wmh.20.2021.06.17.04.54.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 04:54:18 -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=TAZ5Nd2Zr4AEdYczPbEyYCejydYTPBGPwGnfyFJKBD8=; b=CwTjhLWsQZYAVq13+e3HDpBuLgpQwdDkTcKDY3pMYtxj/PYPV4rLubz30QEJ7zFdgH 4epbLJTm9YI3zqnYkAs11TTdL0x9dghf0/KHHVAxc45BVxxWazsna1w5AYkAGQm09GCB wbEiTo47rULP8x1Hdh14dXRBcO8n8MbpPoCaSLBwcYF7uy667E2MVj0ZCT1y/qU2IQal nrzsWHHpgLgJiZn6DJ4iN99zpMiWtzCdv/GW3vutocDXeUpFJwSWR7RintG+1Kdz/ghz LVlu9iNxsoMBVksaI0XIBMqwGdFj5DrvgkgxCKGTXR6TPiwtfm0HQNVOOjY2e+uvotQN YYLQ== 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=TAZ5Nd2Zr4AEdYczPbEyYCejydYTPBGPwGnfyFJKBD8=; b=XKhh00RPvsPR3ODqzX7zfFhTSi2MmOKxMOZVeVPvcjM7YvWrkEZMfgpwERnXqBD/zQ XPS/exLwKbixsn288kD0oCLyfafTjlpfC4HphdVkugmXJgcFMkvXK+rzMjj6L5ViVSzZ siCOvRQir65JQl6EFotHhDgWfew3c/ETLA4Lf+eBss8j9q2BRU1WDUi2tOlC0jJJIaqb IDWv/zsZyoQ3B221tNh3iAYLCfipqFHy/N26gjgElRO//8M9Idl4/rQ31K1naiSHt+jp mGCaCsNifytNSJc1vGnTPTlRgJ3EBANMu+CmnAaEG5JOmVNUGUBb3c2RqKgElBOe8jap DvuA== X-Gm-Message-State: AOAM5330jkZdOFAm1WHMrtB662F0Yx0/lKrKB849S9gn+uK2NBgDlKsy L53so46JWyTWlcH0kKmpaO7125cSYr4zqA== X-Google-Smtp-Source: ABdhPJxH1I0glMxCfk3dHYTGBCn/ILGSaLP2IV0PLb7Hh7tBLUtkTKcKQqTzKT3+uBcqoNdQ8EzlzQ== X-Received: by 2002:adf:bd88:: with SMTP id l8mr5204015wrh.90.1623930858568; Thu, 17 Jun 2021 04:54:18 -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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v5 09/15] hw/misc/auxbus: Replace 'is_write' boolean by its value Date: Thu, 17 Jun 2021 13:53:28 +0200 Message-Id: <20210617115334.2761573-10-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617115334.2761573-1-f4bug@amsat.org> References: <20210617115334.2761573-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) Remove the 'is_write' boolean by directly using its value in place. Reviewed-by: Richard Henderson Acked-by: Corey Minyard Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/misc/auxbus.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/hw/misc/auxbus.c b/hw/misc/auxbus.c index 9cc9cf3be32..d96219aef88 100644 --- a/hw/misc/auxbus.c +++ b/hw/misc/auxbus.c @@ -106,7 +106,6 @@ AUXReply aux_request(AUXBus *bus, AUXCommand cmd, uint3= 2_t address, AUXReply ret =3D AUX_NACK; I2CBus *i2c_bus =3D aux_get_i2c_bus(bus); size_t i; - bool is_write =3D false; =20 DPRINTF("request at address 0x%" PRIX32 ", command %u, len %u\n", addr= ess, cmd, len); @@ -117,11 +116,10 @@ AUXReply aux_request(AUXBus *bus, AUXCommand cmd, uin= t32_t address, */ case WRITE_AUX: case READ_AUX: - is_write =3D cmd =3D=3D READ_AUX ? false : true; for (i =3D 0; i < len; i++) { if (!address_space_rw(&bus->aux_addr_space, address++, MEMTXATTRS_UNSPECIFIED, data++, 1, - is_write)) { + cmd =3D=3D WRITE_AUX)) { ret =3D AUX_I2C_ACK; } else { ret =3D AUX_NACK; @@ -133,19 +131,18 @@ AUXReply aux_request(AUXBus *bus, AUXCommand cmd, uin= t32_t address, * Classic I2C transactions.. */ case READ_I2C: - is_write =3D cmd =3D=3D READ_I2C ? false : true; if (i2c_bus_busy(i2c_bus)) { i2c_end_transfer(i2c_bus); } =20 - if (i2c_start_transfer(i2c_bus, address, !is_write)) { + if (i2c_start_transfer(i2c_bus, address, true)) { ret =3D AUX_I2C_NACK; break; } =20 ret =3D AUX_I2C_ACK; while (len > 0) { - if (i2c_send_recv(i2c_bus, data++, is_write) < 0) { + if (i2c_send_recv(i2c_bus, data++, false) < 0) { ret =3D AUX_I2C_NACK; break; } @@ -154,19 +151,18 @@ AUXReply aux_request(AUXBus *bus, AUXCommand cmd, uin= t32_t address, i2c_end_transfer(i2c_bus); break; case WRITE_I2C: - is_write =3D cmd =3D=3D READ_I2C ? false : true; if (i2c_bus_busy(i2c_bus)) { i2c_end_transfer(i2c_bus); } =20 - if (i2c_start_transfer(i2c_bus, address, !is_write)) { + if (i2c_start_transfer(i2c_bus, address, false)) { ret =3D AUX_I2C_NACK; break; } =20 ret =3D AUX_I2C_ACK; while (len > 0) { - if (i2c_send_recv(i2c_bus, data++, is_write) < 0) { + if (i2c_send_recv(i2c_bus, data++, true) < 0) { ret =3D AUX_I2C_NACK; break; } @@ -183,13 +179,12 @@ AUXReply aux_request(AUXBus *bus, AUXCommand cmd, uin= t32_t address, * - We changed the address. */ case WRITE_I2C_MOT: - is_write =3D cmd =3D=3D READ_I2C_MOT ? false : true; ret =3D AUX_I2C_NACK; if (!i2c_bus_busy(i2c_bus)) { /* * No transactions started.. */ - if (i2c_start_transfer(i2c_bus, address, !is_write)) { + if (i2c_start_transfer(i2c_bus, address, false)) { break; } } else if ((address !=3D bus->last_i2c_address) || @@ -198,7 +193,7 @@ AUXReply aux_request(AUXBus *bus, AUXCommand cmd, uint3= 2_t address, * Transaction started but we need to restart.. */ i2c_end_transfer(i2c_bus); - if (i2c_start_transfer(i2c_bus, address, !is_write)) { + if (i2c_start_transfer(i2c_bus, address, false)) { break; } } @@ -206,7 +201,7 @@ AUXReply aux_request(AUXBus *bus, AUXCommand cmd, uint3= 2_t address, bus->last_transaction =3D cmd; bus->last_i2c_address =3D address; while (len > 0) { - if (i2c_send_recv(i2c_bus, data++, is_write) < 0) { + if (i2c_send_recv(i2c_bus, data++, true) < 0) { i2c_end_transfer(i2c_bus); break; } @@ -217,13 +212,12 @@ AUXReply aux_request(AUXBus *bus, AUXCommand cmd, uin= t32_t address, } break; case READ_I2C_MOT: - is_write =3D cmd =3D=3D READ_I2C_MOT ? false : true; ret =3D AUX_I2C_NACK; if (!i2c_bus_busy(i2c_bus)) { /* * No transactions started.. */ - if (i2c_start_transfer(i2c_bus, address, !is_write)) { + if (i2c_start_transfer(i2c_bus, address, true)) { break; } } else if ((address !=3D bus->last_i2c_address) || @@ -232,7 +226,7 @@ AUXReply aux_request(AUXBus *bus, AUXCommand cmd, uint3= 2_t address, * Transaction started but we need to restart.. */ i2c_end_transfer(i2c_bus); - if (i2c_start_transfer(i2c_bus, address, !is_write)) { + if (i2c_start_transfer(i2c_bus, address, true)) { break; } } @@ -240,7 +234,7 @@ AUXReply aux_request(AUXBus *bus, AUXCommand cmd, uint3= 2_t address, bus->last_transaction =3D cmd; bus->last_i2c_address =3D address; while (len > 0) { - if (i2c_send_recv(i2c_bus, data++, is_write) < 0) { + if (i2c_send_recv(i2c_bus, data++, false) < 0) { i2c_end_transfer(i2c_bus); break; } --=20 2.31.1