From nobody Tue Feb 10 06:43:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.47 as permitted sender) client-ip=209.85.221.47; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f47.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.47 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1623860105; cv=none; d=zohomail.com; s=zohoarc; b=mzvG4Pm/ieNZu7zNr5yAk2hzYFdeZYbb2FPLgr/iVbobZuWew7wtlW9AC9XDyikKvj8wMb4DdHmYt67V6nuGKBQkdUcopJSfNUcjSwvluVjsSX7j0UnUQDwXTxnJXjoA7iEocnPYhQKHzbEIQh83c4k/ND3J0S3oboBkrT9Uzj8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623860105; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1d4OoqsJ8FMcOnJf0dKzbcD5w9xCZwknQ2w/kjLbVKs=; b=cEsKJ7MSu/rfIE6AqOCnoRBk1ewZ0hmGshM9VtWI1hJV//r9MT0K5DPOLNMR/+RTdxWMVm+z8ld3iWzoxfr7ZDVTFQxEpGxGOZr/Bm93XsfnxulaGrXZaNAQdTvbFZ/MG7Lh3KO2WBdV+XaAAsU9Bmw3COOziwbG72AgNldWioI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.47 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by mx.zohomail.com with SMTPS id 162386010546699.03877196441044; Wed, 16 Jun 2021 09:15:05 -0700 (PDT) Received: by mail-wr1-f47.google.com with SMTP id a11so3298784wrt.13 for ; Wed, 16 Jun 2021 09:15:04 -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 n13sm3047802wrg.75.2021.06.16.09.15.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 09:15:03 -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=1d4OoqsJ8FMcOnJf0dKzbcD5w9xCZwknQ2w/kjLbVKs=; b=i+H/5yu7f69GuWpwop0RrbGr412l43TvPtu09sgrDzSzWSwnq3vbxtu0rUchVqpMms eF9cugj9zQtt/1O+PDDHkhWu9p4G48HWHsR/3VDXwl4R6xQefI4/cWAIuqf4+jDfxXQR O+V1ozowgKTbIcGdoAtkTRnOSIMXlWYVKEs/EATn+rxNGX0rSnGteVtV+Jg1+bE9OFYq BuAgmCMlVN6qPZpYJcMYA+d9lBDUOPrrwvj8BUS8friPMWVfbKydPhwYGwTMtcZ5HtoA D7TDnLvPQ4u8zujqvL/oGKLTSKNfCvqhfCqu62p2PNqc+HIg6sA9GnKxV7ntJ+/G7vOx F4GQ== 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=1d4OoqsJ8FMcOnJf0dKzbcD5w9xCZwknQ2w/kjLbVKs=; b=n6kNL7kzgY9DafPyWgZjoGTpmYou9YMzwWGsEJ9E0L6U8uRWwNu3Sq4ZtL9+ZDiLcU WBC8cpAI39ICty3JPdE6BvfL7dOyKAHA4/XRX9+vdyN4hjQ95fl4KLmFTnR+CzLokrul hiOcWpdFbF/JlfgAnh1LuVucS6KseKcIv0iTp0vT4SPVNiBgqAJ5On/dDvdegrhSJeS8 UUTdv/kM0eV2EDQ5hPlm8YbmVSJ601hir6ezsTzwGBNtL2GAYmS10qh7t56O5mReJCJK FTxSQtOtIFxce+aMLRky6zLO2qjO66IqthgMc2DHmR7M5gOLzUxppF5lCYyImpjQm5l9 qa2w== X-Gm-Message-State: AOAM532PC0Inlwa3iZ3H34l231oXQZIB1f41g0MkseWvIZ0rvk64LiPa GM/x7a6IHJG50mIeuJInwhI= X-Google-Smtp-Source: ABdhPJzFohbkMpY1xOxE3ngC98JZOaw404H0elLpFjjqD5J60cJIi2ZKJo4PCdJ7tOjzV/T/cef2Yw== X-Received: by 2002:a05:6000:128b:: with SMTP id f11mr203265wrx.171.1623860103704; Wed, 16 Jun 2021 09:15:03 -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: qemu-arm@nongnu.org, Corey Minyard , qemu-ppc@nongnu.org, "Signed-off-by : Frederic Konrad" , BALATON Zoltan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 09/13] hw/misc/auxbus: Replace 'is_write' boolean by its value Date: Wed, 16 Jun 2021 18:14:14 +0200 Message-Id: <20210616161418.2514095-10-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210616161418.2514095-1-f4bug@amsat.org> References: <20210616161418.2514095-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. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- 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