From patchwork Thu Sep 12 06:52:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13801496 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B1544EE6452 for ; Thu, 12 Sep 2024 06:52:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sodh5-0003xL-U7; Thu, 12 Sep 2024 02:52:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sodh3-0003rw-Oy for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:52:41 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sodh1-0003Ow-SW for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:52:41 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42cba6cdf32so4614775e9.1 for ; Wed, 11 Sep 2024 23:52:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726123958; x=1726728758; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=930EOxitUPSbWDmKCRCTZhjU+xHgrO7ejJVauC14yVw=; b=NOxrXpFgxqcO2+LzMprcOOts1kj2pJwsJRrp9QdOOGq8rBHE9FMbfwBSMeX/HQ7EIk HdD40ILENyvmHpS8FCwMr5MN46JG4Bt2ZaxPsJ1sCoOIegSKSyrp5dd7LGCoFvUCL5Lu e09yAuNgTc8VtwWn8Dl9WbQtR+O5bSgk9Li/SsHpubSl9J4O0syab/c+BIKLv8tG5qIC tpBUWAjnf4I+Ey2TKlMUCP1kuzafMcCgesG55ueSP6HIWr8GKJzx+ijGc/+zoPzJMLBA ZM6vr0q5aVzEJEvcjJ2Yi4HyD+/Dzhb+UxtVXLYhoXsPcK/C+u8kwSU8imBvdH6MhmoS kLQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726123958; x=1726728758; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=930EOxitUPSbWDmKCRCTZhjU+xHgrO7ejJVauC14yVw=; b=CmbF1ZioOScJ4EFUbL2nhlev5ko2IENOc7VhWr7Z6u8ftutstLvGhtnnNSXv2DTlNN iFeCEA71uL/p0tjUzQsV9tkKJwCjd6p3L1p7n8AOZjMq3jps0Uq8I/AxZ45L0KJXyjlU q55v6HHHmMyYipBx3z8nMDh4efSPtIE+DzvfziNvTTuupTd7Xlqk9bJe5lvm6gj0kxFG zA2XdifyU/NnQ4ui65rmE2uM4w9hFk/rELoENWamhl/lALrV0bEAAQcKfVwLh1yGTii6 mDGWGN8CbRy+e+02ToHUPIEjthyRJKqraZNsRRpadI/Zz3PKdG9P7ojDmmtBLKPPLzTg 20OQ== X-Gm-Message-State: AOJu0Yze5k3XOpbaL+cKk7by2xSD8GC0tINOWaEDpmUiv8kfRMvMvYE7 mzd+rIa8butjzQs64oRmNf/OEpkURqmPTWQWPpfIBDcUiKHFihGS+n/001y/QrzlAoUN3O4sQPw I X-Google-Smtp-Source: AGHT+IGlEsJl//RNO9vTLfGC+zCJkX2ckS27xeQhcxOJunfM7jABBGS3H3qEwUWbuwGRrVFLoYecWQ== X-Received: by 2002:a05:600c:1c04:b0:42c:bd5a:9479 with SMTP id 5b1f17b1804b1-42cdb54cf2amr14877375e9.18.1726123957154; Wed, 11 Sep 2024 23:52:37 -0700 (PDT) Received: from m1x-phil.lan (mic92-h03-176-184-33-210.dsl.sta.abo.bbox.fr. [176.184.33.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37895675b7esm13427501f8f.50.2024.09.11.23.52.36 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Sep 2024 23:52:36 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL v2 44/61] hw/sensor/tmp105: Coding style fixes Date: Thu, 12 Sep 2024 08:52:15 +0200 Message-ID: <20240912065227.67848-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240912065227.67848-1-philmd@linaro.org> References: <20240912065227.67848-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guenter Roeck Coding style asks for no space between variable and "++". The next patch in this series will change one of those assignments. Instead of changing just one with that patch, change all of them for consistency. While at it, also fix other coding style problems reported by checkpatch. Signed-off-by: Guenter Roeck Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Message-Id: <20240906154911.86803-2-philmd@linaro.org> --- hw/sensor/tmp105.c | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index a8730d0b7f..ad97c9684c 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -29,16 +29,17 @@ static void tmp105_interrupt_update(TMP105State *s) { - qemu_set_irq(s->pin, s->alarm ^ ((~s->config >> 2) & 1)); /* POL */ + qemu_set_irq(s->pin, s->alarm ^ ((~s->config >> 2) & 1)); /* POL */ } static void tmp105_alarm_update(TMP105State *s) { - if ((s->config >> 0) & 1) { /* SD */ - if ((s->config >> 7) & 1) /* OS */ - s->config &= ~(1 << 7); /* OS */ - else + if ((s->config >> 0) & 1) { /* SD */ + if ((s->config >> 7) & 1) { /* OS */ + s->config &= ~(1 << 7); /* OS */ + } else { return; + } } if (s->config >> 1 & 1) { @@ -89,7 +90,8 @@ static void tmp105_get_temperature(Object *obj, Visitor *v, const char *name, visit_type_int(v, name, &value, errp); } -/* Units are 0.001 centigrades relative to 0 C. s->temperature is 8.8 +/* + * Units are 0.001 centigrades relative to 0 C. s->temperature is 8.8 * fixed point, so units are 1/256 centigrades. A simple ratio will do. */ static void tmp105_set_temperature(Object *obj, Visitor *v, const char *name, @@ -118,30 +120,30 @@ static void tmp105_read(TMP105State *s) { s->len = 0; - if ((s->config >> 1) & 1) { /* TM */ + if ((s->config >> 1) & 1) { /* TM */ s->alarm = 0; tmp105_interrupt_update(s); } switch (s->pointer & 3) { case TMP105_REG_TEMPERATURE: - s->buf[s->len ++] = (((uint16_t) s->temperature) >> 8); - s->buf[s->len ++] = (((uint16_t) s->temperature) >> 0) & - (0xf0 << ((~s->config >> 5) & 3)); /* R */ + s->buf[s->len++] = (((uint16_t) s->temperature) >> 8); + s->buf[s->len++] = (((uint16_t) s->temperature) >> 0) & + (0xf0 << ((~s->config >> 5) & 3)); /* R */ break; case TMP105_REG_CONFIG: - s->buf[s->len ++] = s->config; + s->buf[s->len++] = s->config; break; case TMP105_REG_T_LOW: - s->buf[s->len ++] = ((uint16_t) s->limit[0]) >> 8; - s->buf[s->len ++] = ((uint16_t) s->limit[0]) >> 0; + s->buf[s->len++] = ((uint16_t) s->limit[0]) >> 8; + s->buf[s->len++] = ((uint16_t) s->limit[0]) >> 0; break; case TMP105_REG_T_HIGH: - s->buf[s->len ++] = ((uint16_t) s->limit[1]) >> 8; - s->buf[s->len ++] = ((uint16_t) s->limit[1]) >> 0; + s->buf[s->len++] = ((uint16_t) s->limit[1]) >> 8; + s->buf[s->len++] = ((uint16_t) s->limit[1]) >> 0; break; } } @@ -153,18 +155,20 @@ static void tmp105_write(TMP105State *s) break; case TMP105_REG_CONFIG: - if (s->buf[0] & ~s->config & (1 << 0)) /* SD */ + if (s->buf[0] & ~s->config & (1 << 0)) { /* SD */ printf("%s: TMP105 shutdown\n", __func__); + } s->config = s->buf[0]; - s->faults = tmp105_faultq[(s->config >> 3) & 3]; /* F */ + s->faults = tmp105_faultq[(s->config >> 3) & 3]; /* F */ tmp105_alarm_update(s); break; case TMP105_REG_T_LOW: case TMP105_REG_T_HIGH: - if (s->len >= 3) + if (s->len >= 3) { s->limit[s->pointer & 1] = (int16_t) ((((uint16_t) s->buf[0]) << 8) | s->buf[1]); + } tmp105_alarm_update(s); break; } @@ -175,7 +179,7 @@ static uint8_t tmp105_rx(I2CSlave *i2c) TMP105State *s = TMP105(i2c); if (s->len < 2) { - return s->buf[s->len ++]; + return s->buf[s->len++]; } else { return 0xff; } @@ -215,7 +219,7 @@ static int tmp105_post_load(void *opaque, int version_id) { TMP105State *s = opaque; - s->faults = tmp105_faultq[(s->config >> 3) & 3]; /* F */ + s->faults = tmp105_faultq[(s->config >> 3) & 3]; /* F */ tmp105_interrupt_update(s); return 0; From patchwork Thu Sep 12 06:52:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13801498 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0EE89EE6451 for ; Thu, 12 Sep 2024 06:53:10 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sodhA-00047S-M3; Thu, 12 Sep 2024 02:52:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sodh8-00046Z-Uc for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:52:47 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sodh6-0003Pz-J3 for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:52:46 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-42cb0f28bfbso4675265e9.1 for ; Wed, 11 Sep 2024 23:52:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726123963; x=1726728763; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Botq1S9eMbImFvY+BTnSLblpWc6KEMCJ0flPbOePxcU=; b=ITyET9NG1v9LS/5ZY7GOKpj7YqwZoB9F+ijElH/w3l9vtJDT4fn8Veg3p2A6B0fBqI 9MFvQgZ1DPFuuY99QscwjYwjy1oc7JH4FY5cbTgc6ykSWAjBVVGlU63YvW3byrFb9lo1 WTyabpuIsufL7pzSYLRaqHRXQwu0oP3f9RjH6LspV7tSPrnIReLuADzZ+f/mvKSeB5Ig /5+F5g9NTHDiEiWLMM19Gkc8x9YL1Pn/ERHtxLxY5d1ohqLeWSnDWUJtXCd6bNzElRDY U5dE3fj+XUTuqOdKyQz4bJ+vwLb8YZWu4rqd60ll3ft9t41Lo8KyQeg+KCSjp4l22XTb r5Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726123963; x=1726728763; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Botq1S9eMbImFvY+BTnSLblpWc6KEMCJ0flPbOePxcU=; b=oEmrAvWzy0NawNYMwrpiS9u+PdC9SA/z9u0Ryf3rv3BUIsNr7z5JEPbzPxnp9w/ete BjGKQveAGA6Evj/jKEbDFpkxCiPV/r3/EhzP+CUWnUh5c/WKGOjvGXuYGGhfVsnA185q LT0O5YiGkkCAd1Lo0cPl3N9/G5O6qB857vSolzUk7hkq6PocniwK/hMLFOQfBUmy1vt4 iC/+3gHFGgqqilBSArD1jmEo3g4M1N7BlFJ/cQ/xAswwKIqcOAmlGj7oYpsvsGQzGF9N 00Y5H5eq044KaZmB+q5ER+ldPpGX5HV/bR6LA4cI6rJvEq+ehyKqrKVcn9dBtSeNxzms OE2A== X-Gm-Message-State: AOJu0YwU7SB16plYLhOF5K9zjf1N+UVN+hNi1BlwtYGZehJ23aU4Lh18 y/5L0fj+tzcJGVmWpXYtmc/C2duPVdywCM66c8aIOsz6BrA/K9lhKtB99ylzpbSPT3yP/CS311Q c X-Google-Smtp-Source: AGHT+IHRQwKC2UekPFyHaijhqQBIk/3zbj2uJ4HN28LWHW4ZhKqw2CfX1qJEisa4O6F2p1XWtY96Ag== X-Received: by 2002:a05:600c:4e10:b0:42b:a9b4:3f59 with SMTP id 5b1f17b1804b1-42cdb529b15mr13640265e9.14.1726123962664; Wed, 11 Sep 2024 23:52:42 -0700 (PDT) Received: from m1x-phil.lan (mic92-h03-176-184-33-210.dsl.sta.abo.bbox.fr. [176.184.33.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378956d363asm13523896f8f.72.2024.09.11.23.52.41 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Sep 2024 23:52:42 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL v2 45/61] hw/sensor/tmp105: Use registerfields API Date: Thu, 12 Sep 2024 08:52:16 +0200 Message-ID: <20240912065227.67848-3-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240912065227.67848-1-philmd@linaro.org> References: <20240912065227.67848-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org To improve readability, use the registerfields API. Define the register bits with FIELD(), and use the FIELD_EX8() and FIELD_DP8() macros. Remove the abbreviations in comments. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Guenter Roeck Message-Id: <20240906154911.86803-3-philmd@linaro.org> --- hw/sensor/tmp105.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index ad97c9684c..150d09b278 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -26,23 +26,31 @@ #include "qapi/error.h" #include "qapi/visitor.h" #include "qemu/module.h" +#include "hw/registerfields.h" + +FIELD(CONFIG, SHUTDOWN_MODE, 0, 1) +FIELD(CONFIG, THERMOSTAT_MODE, 1, 1) +FIELD(CONFIG, POLARITY, 2, 1) +FIELD(CONFIG, FAULT_QUEUE, 3, 2) +FIELD(CONFIG, CONVERTER_RESOLUTION, 5, 2) +FIELD(CONFIG, ONE_SHOT, 7, 1) static void tmp105_interrupt_update(TMP105State *s) { - qemu_set_irq(s->pin, s->alarm ^ ((~s->config >> 2) & 1)); /* POL */ + qemu_set_irq(s->pin, s->alarm ^ FIELD_EX8(~s->config, CONFIG, POLARITY)); } static void tmp105_alarm_update(TMP105State *s) { - if ((s->config >> 0) & 1) { /* SD */ - if ((s->config >> 7) & 1) { /* OS */ - s->config &= ~(1 << 7); /* OS */ + if (FIELD_EX8(s->config, CONFIG, SHUTDOWN_MODE)) { + if (FIELD_EX8(s->config, CONFIG, ONE_SHOT)) { + s->config = FIELD_DP8(s->config, CONFIG, ONE_SHOT, 0); } else { return; } } - if (s->config >> 1 & 1) { + if (FIELD_EX8(s->config, CONFIG, THERMOSTAT_MODE)) { /* * TM == 1 : Interrupt mode. We signal Alert when the * temperature rises above T_high, and expect the guest to clear @@ -120,7 +128,7 @@ static void tmp105_read(TMP105State *s) { s->len = 0; - if ((s->config >> 1) & 1) { /* TM */ + if (FIELD_EX8(s->config, CONFIG, THERMOSTAT_MODE)) { s->alarm = 0; tmp105_interrupt_update(s); } @@ -129,7 +137,7 @@ static void tmp105_read(TMP105State *s) case TMP105_REG_TEMPERATURE: s->buf[s->len++] = (((uint16_t) s->temperature) >> 8); s->buf[s->len++] = (((uint16_t) s->temperature) >> 0) & - (0xf0 << ((~s->config >> 5) & 3)); /* R */ + (0xf0 << (FIELD_EX8(~s->config, CONFIG, CONVERTER_RESOLUTION))); break; case TMP105_REG_CONFIG: @@ -155,11 +163,11 @@ static void tmp105_write(TMP105State *s) break; case TMP105_REG_CONFIG: - if (s->buf[0] & ~s->config & (1 << 0)) { /* SD */ + if (FIELD_EX8(s->buf[0] & ~s->config, CONFIG, SHUTDOWN_MODE)) { printf("%s: TMP105 shutdown\n", __func__); } s->config = s->buf[0]; - s->faults = tmp105_faultq[(s->config >> 3) & 3]; /* F */ + s->faults = tmp105_faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)]; tmp105_alarm_update(s); break; @@ -219,7 +227,7 @@ static int tmp105_post_load(void *opaque, int version_id) { TMP105State *s = opaque; - s->faults = tmp105_faultq[(s->config >> 3) & 3]; /* F */ + s->faults = tmp105_faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)]; tmp105_interrupt_update(s); return 0; @@ -277,7 +285,7 @@ static void tmp105_reset(I2CSlave *i2c) s->temperature = 0; s->pointer = 0; s->config = 0; - s->faults = tmp105_faultq[(s->config >> 3) & 3]; + s->faults = tmp105_faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)]; s->alarm = 0; s->detect_falling = false; From patchwork Thu Sep 12 06:52:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13801497 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB3F5EE6452 for ; Thu, 12 Sep 2024 06:52:58 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sodhG-0004VY-8N; Thu, 12 Sep 2024 02:52:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sodhE-0004Py-S4 for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:52:52 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sodhC-0003R3-IH for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:52:52 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-42cb6f3a5bcso6203995e9.2 for ; Wed, 11 Sep 2024 23:52:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726123968; x=1726728768; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=V5BN+QwDDBigOpVAkHKfRD9kl52tOEsyOrGfIU6uf3I=; b=fgD/Ppqm2kWBOy2kW376Ib9pzFf5aj5jWbob5uuZ8Ec5tvcsznAD0ahaz81yC8FO3i zbKME9gB46Vq1rridUA7sov3OxkdIdJVRZGAcXOtpqU+rFX3mNRzXdk5iOJBdrZdXOJM UBdSmzzSiUDCYQunwLGmlU6Rsw1ek16bMd2SKURpj/ygOyaU6qtS54pk+AoDC2jfCC7Q TkPnWTuHgp6jYMTWQp67T1exkGJM+VexWFkBHaZUc38jN2A+7WWYNyTXKMFUcWaYkdsg UuYbmh7NtqwySYoG8nKfmOAQgLXnbcVseM1uoxQapCShMzV0g5vHHOsNSuu0nIqalQXC AuJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726123968; x=1726728768; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V5BN+QwDDBigOpVAkHKfRD9kl52tOEsyOrGfIU6uf3I=; b=o3ht71DMfeDzxf3Cmd8w9fzgm8r7vrrKK2n8/MXY5qzjnToHZEPWyR6ko5SppjvPRJ 1JYaxFNk2cG4FVw5YVPlKwSEvp9Eqn7HyFoFk5bRWXqVj64hspnoUDC4Vn45e7z6untR KzpzFs9QeY10EvM4sWt+qYVxxDZpyM12q0F8RsBEgUU0nAWAUxafzCPVKn/TDAq7cU/x VSVjsJV5Rx5WDrS/uaGoBCZacgnkPpp64fOduaflA3+2mMPlhmopwetio+C9MUM4it24 L1vrn/8rMW5oHg2vowYYLX0O7MZy3YdiQicc4AQT9HTcxsxnXCiy1I/tS5JbzkJmWA6t oraw== X-Gm-Message-State: AOJu0Yyb6tfY4msLmMR3KxbCEvUKX0vljY1VZDWjaYUqUg3Gt2yeVaxa ZZsFTBjmkWByrbrMXtxX+yKssXbxYgg760VpDaJEZUNdRFaP5UN8sDHRIEWxknXTzgFc2psEtcF w X-Google-Smtp-Source: AGHT+IFAYZkWItKLEkRJuLBGZ/s8Cuq1yzDXlSLDwb8p1b6IWNT64I+33xzSu/y+U/0NJv609FqhcA== X-Received: by 2002:a05:600c:154c:b0:42c:b950:6821 with SMTP id 5b1f17b1804b1-42cdb5495e8mr13462905e9.19.1726123968162; Wed, 11 Sep 2024 23:52:48 -0700 (PDT) Received: from m1x-phil.lan (mic92-h03-176-184-33-210.dsl.sta.abo.bbox.fr. [176.184.33.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378956e8700sm13401232f8f.116.2024.09.11.23.52.47 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Sep 2024 23:52:47 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL v2 46/61] hw/sensor/tmp105: Pass 'oneshot' argument to tmp105_alarm_update() Date: Thu, 12 Sep 2024 08:52:17 +0200 Message-ID: <20240912065227.67848-4-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240912065227.67848-1-philmd@linaro.org> References: <20240912065227.67848-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The next commit will clear the ONE_SHOT bit in the WRITE path (to keep the READ path trivial). As a preliminary step, pass the 'oneshot' value as argument to tmp105_alarm_update(). No logical change intended. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Guenter Roeck Message-Id: <20240906154911.86803-4-philmd@linaro.org> --- hw/sensor/tmp105.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index 150d09b278..6740200aea 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -40,10 +40,10 @@ static void tmp105_interrupt_update(TMP105State *s) qemu_set_irq(s->pin, s->alarm ^ FIELD_EX8(~s->config, CONFIG, POLARITY)); } -static void tmp105_alarm_update(TMP105State *s) +static void tmp105_alarm_update(TMP105State *s, bool one_shot) { if (FIELD_EX8(s->config, CONFIG, SHUTDOWN_MODE)) { - if (FIELD_EX8(s->config, CONFIG, ONE_SHOT)) { + if (one_shot) { s->config = FIELD_DP8(s->config, CONFIG, ONE_SHOT, 0); } else { return; @@ -119,7 +119,7 @@ static void tmp105_set_temperature(Object *obj, Visitor *v, const char *name, s->temperature = (int16_t) (temp * 256 / 1000); - tmp105_alarm_update(s); + tmp105_alarm_update(s, false); } static const int tmp105_faultq[4] = { 1, 2, 4, 6 }; @@ -168,7 +168,7 @@ static void tmp105_write(TMP105State *s) } s->config = s->buf[0]; s->faults = tmp105_faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)]; - tmp105_alarm_update(s); + tmp105_alarm_update(s, FIELD_EX8(s->buf[0], CONFIG, ONE_SHOT)); break; case TMP105_REG_T_LOW: @@ -177,7 +177,7 @@ static void tmp105_write(TMP105State *s) s->limit[s->pointer & 1] = (int16_t) ((((uint16_t) s->buf[0]) << 8) | s->buf[1]); } - tmp105_alarm_update(s); + tmp105_alarm_update(s, false); break; } } From patchwork Thu Sep 12 06:52:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13801507 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A4BBAEE6454 for ; Thu, 12 Sep 2024 06:54:51 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sodhK-0004pf-52; Thu, 12 Sep 2024 02:52:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sodhJ-0004lu-6F for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:52:57 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sodhH-0003RH-L7 for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:52:56 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-42cc43454d5so4409255e9.3 for ; Wed, 11 Sep 2024 23:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726123974; x=1726728774; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=LFdQQyV2bmEsjuWxwcR0v9/S6TIwatMWxB854Zl8gYU=; b=QDrSJhFYYzRN/r++sEcuVCDm87wrU6I21xjiuoddNraTrx34+96RBt/2xjjiMBGqaw q5g+Q/D3hT4lph7Yb/+lB4wAeT1fdxWgVKPyfCoy7ghJf0iNmunfs+s3UQYZdikVXejh Sdf/kWcSew3Q6bO5zBQqtWf9j89t5pv0tCDfTyA/TSd2iyqJ7FL89CR9zOQrxrLckxMa 7Lws9WKtEJPJ6WuseD0LOgMxnZpR5hqz1jy+Rz0Aft7pi4YrK4wXoZsWDYrNoPsJYzbB ussXI+UM1e4jioGM+/Z83YQ7ZsIKvnAXknHpJgdI4W+z2bpOAv4KFDZzlvijNSFEqI/J rGVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726123974; x=1726728774; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LFdQQyV2bmEsjuWxwcR0v9/S6TIwatMWxB854Zl8gYU=; b=tnHAGb9z0UT2qUjTdwA2Wkf0+YvacxLZM89MJ0BWzRKq0whisuma2MA3+yupMxE1Hc B3ulm5HAPI4nSAC1nORWEr/n9IGGtx6IGBZtTe1EBXicRw1PPWcOQMx9mx1Ayqdl19UA Y0YgK5JTbSYvR1FXvxH46mbhSIgsuRjPCiOIzCkuxsE/EAVOcU2LmJ47jrkEPh6+tH/x b5GEyZpIzkof9GPqj07P+4YgbJTxn193996fMUwkVbG06Rv7gnEStFPSs5qvj+lS/uCY keJ1quZ2CqDdeJmOBjv5E/kn3UWCqPHap8E7ud/lWSVgIHuJh15CPk+71y4LVNC4aDEV kD8Q== X-Gm-Message-State: AOJu0YwAhh1Zx6Mqt4XVTnDUDKqZBjQmb3S0S6h5QxGVefZ3MWR7joXo ZBAZIE6BilC4qKIjE9A0uU4gtODB4Zgx+FkUzscIpp/VAx8SlcqhXHkAURVj8if7js6fowRCjVa 1 X-Google-Smtp-Source: AGHT+IFV/adnIakW2Nl/d3TbR3dDLAbN8ZvxpXZjLQwBMBDsZJs4ottJA0AUAxbdMxyCmO+g1SRcuQ== X-Received: by 2002:a05:600c:3b14:b0:426:6edf:6597 with SMTP id 5b1f17b1804b1-42cdb547d4emr9707885e9.19.1726123973680; Wed, 11 Sep 2024 23:52:53 -0700 (PDT) Received: from m1x-phil.lan (mic92-h03-176-184-33-210.dsl.sta.abo.bbox.fr. [176.184.33.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb73ab096sm125266255e9.22.2024.09.11.23.52.52 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Sep 2024 23:52:53 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL v2 47/61] hw/sensor/tmp105: OS (one-shot) bit in config register always returns 0 Date: Thu, 12 Sep 2024 08:52:18 +0200 Message-ID: <20240912065227.67848-5-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240912065227.67848-1-philmd@linaro.org> References: <20240912065227.67848-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Per datasheet, "ONE-SHOT (OS)", the OS bit always returns 0 when reading the configuration register. Clear the ONE_SHOT bit in the WRITE path. Now than the READ path is simpler, we can also simplify tmp105_alarm_update(). Signed-off-by: Guenter Roeck Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Message-Id: <20240906154911.86803-5-philmd@linaro.org> --- hw/sensor/tmp105.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index 6740200aea..f5101af919 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -42,12 +42,8 @@ static void tmp105_interrupt_update(TMP105State *s) static void tmp105_alarm_update(TMP105State *s, bool one_shot) { - if (FIELD_EX8(s->config, CONFIG, SHUTDOWN_MODE)) { - if (one_shot) { - s->config = FIELD_DP8(s->config, CONFIG, ONE_SHOT, 0); - } else { - return; - } + if (FIELD_EX8(s->config, CONFIG, SHUTDOWN_MODE) && !one_shot) { + return; } if (FIELD_EX8(s->config, CONFIG, THERMOSTAT_MODE)) { @@ -166,7 +162,7 @@ static void tmp105_write(TMP105State *s) if (FIELD_EX8(s->buf[0] & ~s->config, CONFIG, SHUTDOWN_MODE)) { printf("%s: TMP105 shutdown\n", __func__); } - s->config = s->buf[0]; + s->config = FIELD_DP8(s->buf[0], CONFIG, ONE_SHOT, 0); s->faults = tmp105_faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)]; tmp105_alarm_update(s, FIELD_EX8(s->buf[0], CONFIG, ONE_SHOT)); break; From patchwork Thu Sep 12 06:52:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13801499 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4E490EE6451 for ; Thu, 12 Sep 2024 06:53:16 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sodhQ-0005VD-D3; Thu, 12 Sep 2024 02:53:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sodhO-0005ME-Iv for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:02 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sodhM-0003RX-Td for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:02 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-428e1915e18so4373065e9.1 for ; Wed, 11 Sep 2024 23:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726123979; x=1726728779; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=vlRmpnbCbgSErzwwLA97yhTv9fMzKif0TAzO/KO/JOk=; b=WtR5X7Kr61e7FTeTtdt7RHjLuhvm9ZcmZAHx8w4m6CU6T3DFKZILu1/6UqxxC1Yuua d/+lnh1TXhcIOCYNaho7D2YMvbKoxYUVfXkAkhpudVuyl+Ag7LAohwfQrU59ivFnKwp8 GgsgIaVL5InyxlcNsXp5NitxHdAFnjAAq3E3ujGLUtkSqKtXe4I+sdPq1VG4XJ5vT9ky NU/zhc33vfvNtg+YmBr3SbBGi1C5lEY0j37LlBRMwHUvgRGLRmW72I59tLbHjdEkxRWD UYaoAxla3/FdDKSfIHf/8w4X+nQ8VUBXNjwGFuAGyiKeO5S9REujHpGuWjCJ0YsvG6Cg tXdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726123979; x=1726728779; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vlRmpnbCbgSErzwwLA97yhTv9fMzKif0TAzO/KO/JOk=; b=sCkJZkxp7qQeFecb0R7g98aftutTAxL20Cb0nDpyy5XlEsWmunYEIK1VytQ2QTYqel xgAkd8nCP5jsBzbgK/MABAOOXTvSBW99mXHhswVCxiQIELrbfSR0j5KS0PSV9jMrxUSn 8NGOCQAzdUDLFtdElklKJoID8odJpEDLTkIAICW6zOzGxMclzMwGGEE7AUlhvEX3wgj4 TYRN0QOvMHYlqlkQPP7HbhRMSdAKXw25f8yc0blkl5RDajsQK7G6fITCI4VYsueWLTOy TXiSP/+LeAjGX9bQqoSFM6nRUeK1tBFzSyeBefR9Ky1eD4U/EAQUOhR7ZIemURflIpAd O4ng== X-Gm-Message-State: AOJu0YzyBCoNl8mTtZhUiysH7fC8BLEKiYOp0bgis3XlhqaO0v6ldCJu K0faU51rqrArw4bmtrIe+IfCjEnKpAdf5dzwj7dJGh4HYvbfkgyF/rWPsihzw+5/98Fr253tdqi 4 X-Google-Smtp-Source: AGHT+IGGtZ/zMnYkWwPixxjcn4uYI/2wK63nJJqTbjum7r4iqYgemDIaPQUyc/MzYToGLQaGuaHcPg== X-Received: by 2002:a05:600c:1c1f:b0:42c:b6e4:e3ac with SMTP id 5b1f17b1804b1-42cdb531d35mr12560495e9.3.1726123978958; Wed, 11 Sep 2024 23:52:58 -0700 (PDT) Received: from m1x-phil.lan (mic92-h03-176-184-33-210.dsl.sta.abo.bbox.fr. [176.184.33.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42caeb444b0sm163333205e9.21.2024.09.11.23.52.58 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Sep 2024 23:52:58 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL v2 48/61] hw/sensor/tmp105: Lower 4 bit of limit registers are always 0 Date: Thu, 12 Sep 2024 08:52:19 +0200 Message-ID: <20240912065227.67848-6-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240912065227.67848-1-philmd@linaro.org> References: <20240912065227.67848-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guenter Roeck Per datasheet, "HIGH AND LOW LIMIT REGISTERS", the lower 4 bit of the limit registers are unused and always report 0. The lower 4 bit should not be used for temperature comparisons, so mask the unused bits before storing the limits. Signed-off-by: Guenter Roeck Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Message-Id: <20240906154911.86803-6-philmd@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- hw/sensor/tmp105.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c index f5101af919..9d7b911f59 100644 --- a/hw/sensor/tmp105.c +++ b/hw/sensor/tmp105.c @@ -171,7 +171,7 @@ static void tmp105_write(TMP105State *s) case TMP105_REG_T_HIGH: if (s->len >= 3) { s->limit[s->pointer & 1] = (int16_t) - ((((uint16_t) s->buf[0]) << 8) | s->buf[1]); + ((((uint16_t) s->buf[0]) << 8) | (s->buf[1] & 0xf0)); } tmp105_alarm_update(s, false); break; From patchwork Thu Sep 12 06:52:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13801500 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6BD27EE6452 for ; Thu, 12 Sep 2024 06:53:29 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sodhW-00068g-Tv; Thu, 12 Sep 2024 02:53:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sodhU-0005qx-RX for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:08 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sodhS-0003SY-S6 for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:08 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-42cde6b5094so3336545e9.3 for ; Wed, 11 Sep 2024 23:53:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726123984; x=1726728784; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=eioWWeRgyOaY5sg2V+9HU3V0/ONJkXh1P/1QORE0Zbo=; b=BLBofvVcZdlCbH+iihUUPlP7+Xv5cUkvHl+uwPx2tiIpHgXIk4K86NgkzbkjsHTsx3 QKmBDhUeyb+ski4bjS739QZMQ13MY0/wveoDErXtwtSSq3c5MFQSH2cSoKzGMNUTjbjK mNLp+87yEgHrism6U0ZMxlFSdqDmVDFwiu/K5S78Qoh72NjaGDsUeFMpxiwAMlSadb+y v4W2kPDo+XhsVJON8lTStWxXEVSGmCd8gQK9EmNlD+Y+8cHsm0ofRNkK96x1Bczs14Pu NQfEcgsooBzdsayWvlc9elSlvXqjjIhGlfOUe9V2o7cdyQdw3JeT7hfLHuut6QhysaKA DWlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726123984; x=1726728784; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eioWWeRgyOaY5sg2V+9HU3V0/ONJkXh1P/1QORE0Zbo=; b=B8KHIKqveLlaXrnVTRqcpfoUfvkHUqllDFOipmn/LxUNIk/MNNkYGt9zm9JDy2a5eI a58jo6rvtbpXw6LnVf17jtfFG6fogQHccN509RSg4lAQByopnUWfHiGXyPDcVDSEw+o4 WxwqWtKVdnHzJ7j0lMAZz2yaJNQv7Qj/CypGTpQlxvtJRz2Zi4a1tBlyw+cSuHs92F0o IyQYj4VnN66372SEWJE1IbkVaOvgLsFkOkcmXQwcswoY2BrfQQxiB2UD2xDREqJ5IwbK /PxTL2QmWXWK546QitlTcbgauSeR4oSbOO6mhwBvmB7rYECpYuxw2tb81gMlNhammP7L OeBw== X-Gm-Message-State: AOJu0Yw04lCnelxoHKq7fAMp6n4jlqRgcWne33PvrTmwVt8hqniHI4o1 JrNY8A8geO5XCNNsfchAtjdawOJdakgZ78r/usMbnjGCPY5e81x6khERtCCj7FQcQhH2z/ksvir b X-Google-Smtp-Source: AGHT+IHBZ3PKFWiZq9ZfWFSaoYJHdU6azIGsxv62XiZT0oOGNJtbGXli8k8VAFsCGgRYwjh240dnHA== X-Received: by 2002:a05:600c:4ed1:b0:42c:aeaa:6aff with SMTP id 5b1f17b1804b1-42cdb54078dmr13652955e9.10.1726123984467; Wed, 11 Sep 2024 23:53:04 -0700 (PDT) Received: from m1x-phil.lan (mic92-h03-176-184-33-210.dsl.sta.abo.bbox.fr. [176.184.33.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ca87acf26sm181419795e9.10.2024.09.11.23.53.03 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Sep 2024 23:53:04 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL v2 51/61] hw/char: replace assert(0) with g_assert_not_reached() Date: Thu, 12 Sep 2024 08:52:20 +0200 Message-ID: <20240912065227.67848-7-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240912065227.67848-1-philmd@linaro.org> References: <20240912065227.67848-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Pierrick Bouvier Use of assert(false) can trip spurious control flow warnings from some versions of GCC (i.e. using -fsanitize=thread with gcc-12): error: control reaches end of non-void function [-Werror=return-type] default: assert(0); | } | ^ Solve that by unifying the code base on g_assert_not_reached() instead. Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240910221606.1817478-5-pierrick.bouvier@linaro.org> [PMD: Add description suggested by Eric Blake] Signed-off-by: Philippe Mathieu-Daudé --- hw/char/avr_usart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/char/avr_usart.c b/hw/char/avr_usart.c index 5bcf9db0b7..e738a2ca97 100644 --- a/hw/char/avr_usart.c +++ b/hw/char/avr_usart.c @@ -86,7 +86,7 @@ static void update_char_mask(AVRUsartState *usart) usart->char_mask = 0b11111111; break; default: - assert(0); + g_assert_not_reached(); } } From patchwork Thu Sep 12 06:52:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13801505 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 40289EE6452 for ; Thu, 12 Sep 2024 06:54:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sodhb-0006dH-2B; Thu, 12 Sep 2024 02:53:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sodhZ-0006Si-Nf for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:13 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sodhX-0003TO-Rb for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:13 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42cb1e623d1so5433045e9.0 for ; Wed, 11 Sep 2024 23:53:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726123990; x=1726728790; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=OsmhMkPXAJPNIk8exjedFxVnBkDRePms2WrWvHvrW1E=; b=RFlLChLM1SqMcMCg/U2GxVSUdkZc8dXMChWZwGxjCBzv3R/VCUJ2ZzEjuNj7NJ8vsf QFtlXjgtBgYeGJSrkwi7XZnUqqCT/9wapL8bddhOqMry2ts/NQKnKVKNfFWXKQzdFiNl PwFTQmss2oaqYxLnKuFdvGMTLjKDe7T0Q3pOpIFmhJrdoXI6OWneIPCT2qJGXoZqwJ0v ciswLyGylaUwoZKS0wQleqMMwG6qgMtygX0/9Y5/fDA9CE6a0vEhZ03nVaXxZFAFqUHq IHnAHGxQSsZRKx3UXdHVFvP3lCTPDp8uxQJWx3AqOOxA1DsVls0a5wzeWGTiXtiLUewf ATgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726123990; x=1726728790; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OsmhMkPXAJPNIk8exjedFxVnBkDRePms2WrWvHvrW1E=; b=RdN33qyeVNHdCV38BRwqVL0bEg0OcJlJHiUfNm/NrkWNtEPwtQoNm+zpmR5BKKPSnQ fm/JKJQcUje9OqSuitpxP7xokhDLR58wMvPKxlpX58DFj0QfA3mJR+1SEMdLwQSy3tO0 IUp9TLZNA7WSV4Y9dg/sz+vae3KKGuNMIgMFMWVMx3kXvsActprG9bWvDx9oTjilSeP4 Ag4eTwIJznBUIXx2JuKoIji3CVXHKL4brPaERlEn2BOBR1FZL5yH50YAIJFQo02rsKFF 6CYoKITAtl7u3xcTcf7hkIJQRRdhzClzM6sKzA38LkyZu2lz66zf9U2slNbAeAQlNHWd R08g== X-Gm-Message-State: AOJu0Yyfumc+MN4/6fH8P4dLq5KlmPoLZx2LAyhUDpzHnnq1FGSZ/lVj yWO/7QmHkoVnhn/VrD85iIUovO6WhGvcyFApoeT1G277cU9HPlfbmEBQcg7ZghV7C+L23Fv60tz e X-Google-Smtp-Source: AGHT+IG+GgG5Dp90BeiTrS1D5gDaesTq5qLfw5APnrgUYXJeNGlJEM0c3EJz1IiAybN963MnPmDOfA== X-Received: by 2002:a05:6000:cd2:b0:371:8f32:557e with SMTP id ffacd0b85a97d-378c2d4cab5mr908312f8f.39.1726123989897; Wed, 11 Sep 2024 23:53:09 -0700 (PDT) Received: from m1x-phil.lan (mic92-h03-176-184-33-210.dsl.sta.abo.bbox.fr. [176.184.33.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378956654f4sm13450031f8f.43.2024.09.11.23.53.08 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Sep 2024 23:53:09 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL v2 52/61] hw/core: replace assert(0) with g_assert_not_reached() Date: Thu, 12 Sep 2024 08:52:21 +0200 Message-ID: <20240912065227.67848-8-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240912065227.67848-1-philmd@linaro.org> References: <20240912065227.67848-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Pierrick Bouvier Use of assert(false) can trip spurious control flow warnings from some versions of GCC (i.e. using -fsanitize=thread with gcc-12): error: control reaches end of non-void function [-Werror=return-type] default: assert(0); | } | ^ Solve that by unifying the code base on g_assert_not_reached() instead. Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240910221606.1817478-6-pierrick.bouvier@linaro.org> [PMD: Add description suggested by Eric Blake] Signed-off-by: Philippe Mathieu-Daudé --- hw/core/numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/core/numa.c b/hw/core/numa.c index fb81c1ed51..1b5f44baea 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -380,7 +380,7 @@ void parse_numa_hmat_lb(NumaState *numa_state, NumaHmatLBOptions *node, } lb_data.data = node->bandwidth; } else { - assert(0); + g_assert_not_reached(); } g_array_append_val(hmat_lb->list, lb_data); From patchwork Thu Sep 12 06:52:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13801501 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56499EE6451 for ; Thu, 12 Sep 2024 06:53:30 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sodhk-0007X2-Qg; Thu, 12 Sep 2024 02:53:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sodhe-00078h-Ot for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:19 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sodhd-0003Tl-51 for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:18 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-42cde6b5094so3337575e9.3 for ; Wed, 11 Sep 2024 23:53:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726123995; x=1726728795; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=CgFUNHEs52jLsHHSU5YLFjyTmIMNSfp3u0OOxY3dyBs=; b=iFHcYUeFWMfxm8Lrvr83A9DQOl4TIW1jzGERRCNxE3or2PV7L675SYnnrWN+lpM5oy ZvcvugUSEJgFzBmRofubOQZ+NxaR34PtGAQnrgEb7tfAGQu+ohME34PJ3ojuNhVMGp3o HSOzVInmMW3zPkfKrl8jQgicpuDVJiC58Fkgp5FIz7j7UAJUpQgHHPmUKpW7bEJyTlrP Lymf3qpAqCMlX4noJIi/ClAHF//RxWSxL2ftdcTPgy4SdLEN82+9jxgEpKEzPXDBZUXH NIFpqH0qYe+S9c3ieRMNz1ZulxZIF+QixlUs2oMcY1ygrDE2rw0051VPAS4zmkugTfO8 sq3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726123995; x=1726728795; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CgFUNHEs52jLsHHSU5YLFjyTmIMNSfp3u0OOxY3dyBs=; b=LdpceVzOyNt9FaSXgLYIsOkGe1ksQBVSvS4jg5EQJmUYtEk0YoYQeSIzus4NssAqSS oQjUiLJ2gdbWrLER8NVSmxg+mtc9icYTl+S1E+zOakl0G7g9a4eerIutH9vaNt7hyQTo 4SeYdHudG9RIcckMa53tNaaXiQ21N/PocynmnF3aYkWVxc8BefdDdgyTo3wRQFQ8M8Ll 59M89tjy0jAi6ACTJlHLQ3bHRbKZqbDKS1DnElJ9XN8TcQk9vxSxVIV4L0hv8Z3bK4J/ lpVMFHRD6nBGxytEBQP2kmf6Wl9SVZbZWKl0w4kNsoa+ALRTKsn8UEa3PhZBQQWYBENC UH+A== X-Gm-Message-State: AOJu0YxLdm5yzveRSh7SEWTTaZ3mwQXaF46uJnfmA1LgcdqwT/lEti52 0nmXabjr+TrlIoHwK0UgH7pACZsU56M0ab/XhhcuKXxHmWMtzcRCDzB9AQoUNX04VEchSQnCr1k i X-Google-Smtp-Source: AGHT+IG6KFnpvcmHCUORhHVyEP+YT/oUOjOwMrAxNQEYpzPT0LGJEcx7hPolPmZ6xp/TZ/bfFFJeGw== X-Received: by 2002:a05:600c:45cf:b0:42c:bdb0:c61e with SMTP id 5b1f17b1804b1-42cdb547f05mr13201675e9.13.1726123995352; Wed, 11 Sep 2024 23:53:15 -0700 (PDT) Received: from m1x-phil.lan (mic92-h03-176-184-33-210.dsl.sta.abo.bbox.fr. [176.184.33.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42caeb21cdfsm161707405e9.10.2024.09.11.23.53.14 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Sep 2024 23:53:14 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL v2 53/61] hw/watchdog: replace assert(0) with g_assert_not_reached() Date: Thu, 12 Sep 2024 08:52:22 +0200 Message-ID: <20240912065227.67848-9-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240912065227.67848-1-philmd@linaro.org> References: <20240912065227.67848-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Pierrick Bouvier Use of assert(false) can trip spurious control flow warnings from some versions of GCC (i.e. using -fsanitize=thread with gcc-12): error: control reaches end of non-void function [-Werror=return-type] default: assert(0); | } | ^ Solve that by unifying the code base on g_assert_not_reached() instead. Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard W.M. Jones Message-ID: <20240910221606.1817478-8-pierrick.bouvier@linaro.org> [PMD: Add description suggested by Eric Blake] Signed-off-by: Philippe Mathieu-Daudé --- hw/watchdog/watchdog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/watchdog/watchdog.c b/hw/watchdog/watchdog.c index 955046161b..d0ce3c4ac5 100644 --- a/hw/watchdog/watchdog.c +++ b/hw/watchdog/watchdog.c @@ -85,7 +85,7 @@ void watchdog_perform_action(void) break; default: - assert(0); + g_assert_not_reached(); } } From patchwork Thu Sep 12 06:52:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13801509 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3FE8DEE6451 for ; Thu, 12 Sep 2024 06:56:09 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sodhs-0008GE-6z; Thu, 12 Sep 2024 02:53:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sodhm-0007my-65 for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:28 -0400 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sodhk-0003U2-0W for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:25 -0400 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-5365aec6fc1so649599e87.3 for ; Wed, 11 Sep 2024 23:53:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726124001; x=1726728801; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=5FoqK1kIA8mj7Qd/lvT8K/kPhvh2nZqcUgQPUn/2U+o=; b=XTNUFyTu2lmpzZsAWtv4mo0RQoaEe73o3W79l6tiGW87w4Hyeh2w5Dxh8GaUHpncsr yYRlXQSFFMKlrzZ9Aqwkl7+RyekhMQs13vG8d6BtLLBUrV1rLdm9KmgDob4TdgUohpMZ 5s/hCNRNfW8eyftk2Q8CblTZrRzKW27sASEXZRaDI7z3g6a+mjJcHFDi1cnEi28mdhiV KZSPzyIRynZqX1R6zsqTCCCJs3YmZZqcINXT0kk4TNKka2hhJzSf8VN3Qc8kyRvoxwsa jy7PpFrQjsBwON9QYzrEF08xu9ODcizc5htKwZ4+nXBVNLm59gZi8CJN6W+Fj8Uf/rZt /HUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726124001; x=1726728801; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5FoqK1kIA8mj7Qd/lvT8K/kPhvh2nZqcUgQPUn/2U+o=; b=QXukNxIxYcmSk+XrOzuT+TNvdXgpQr+l8QMI5nLzIv5oORJQKyUWctvZHsytZ151vF 54GW3u/wZqV5vsB5xbFhWjxthEvBH4+aNmVXLZTGzwAXjpwkWfWBFN8YNS4KeQZzqC9c CWPGHdmAYU64BjPsWKbxJ2cplU7IMWxIg05ohz6XVOVEUqzuYYUMJoRJ26BrTZqtQ4Om yVmD/Fiklz3QBHyHBq8fiEJA5Or1ko1jvDXJVsWOTAbb4nS0N6ETTfg4mQl1DzBHt1Ng z7ccJBvygkJhB3Wqazt8xv0vCMrPiWqrYpSItVl4AUPriOKllsJseKjJXX6GC1n99NWJ KHFA== X-Gm-Message-State: AOJu0YxX5W3AAUr63Lt2J/1zIKDzgiMmjorxiDM8oQehADgAqdQXw4Kr mHm7VjC9KPOVTA6ET/xxLgkcWGKg9zSKxtRnR6mR59gTQYMa0MgTxGjwnHrAJoLUwdYLsWT5Glt A X-Google-Smtp-Source: AGHT+IGTZz+aE0ePcdX6QJ6/iPOF2WktjT1byifudGhS+2Npuc2quXQnM14oA4oRs2REobN6uHhvDA== X-Received: by 2002:a05:6512:4019:b0:52e:fc7b:39cb with SMTP id 2adb3069b0e04-53678fce759mr917978e87.26.1726124000681; Wed, 11 Sep 2024 23:53:20 -0700 (PDT) Received: from m1x-phil.lan (mic92-h03-176-184-33-210.dsl.sta.abo.bbox.fr. [176.184.33.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42caf016a08sm161947705e9.16.2024.09.11.23.53.19 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Sep 2024 23:53:20 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL v2 54/61] hw/gpio: remove break after g_assert_not_reached() Date: Thu, 12 Sep 2024 08:52:23 +0200 Message-ID: <20240912065227.67848-10-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240912065227.67848-1-philmd@linaro.org> References: <20240912065227.67848-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12c; envelope-from=philmd@linaro.org; helo=mail-lf1-x12c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Pierrick Bouvier Use of assert(false) can trip spurious control flow warnings from some versions of GCC (i.e. using -fsanitize=thread with gcc-12): error: control reaches end of non-void function [-Werror=return-type] default: g_assert_not_reached(); break; | ^^^^^ Solve that by removing the unreachable 'break' statement, unifying the code base on g_assert_not_reached() instead. Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240910221606.1817478-28-pierrick.bouvier@linaro.org> [PMD: Add description suggested by Eric Blake] Signed-off-by: Philippe Mathieu-Daudé --- hw/gpio/nrf51_gpio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/gpio/nrf51_gpio.c b/hw/gpio/nrf51_gpio.c index ffc7dff796..f259be651e 100644 --- a/hw/gpio/nrf51_gpio.c +++ b/hw/gpio/nrf51_gpio.c @@ -40,7 +40,6 @@ static bool is_connected(uint32_t config, uint32_t level) break; default: g_assert_not_reached(); - break; } return state; From patchwork Thu Sep 12 06:52:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13801504 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8AE10EE6452 for ; Thu, 12 Sep 2024 06:54:27 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sodhw-0000BL-5y; Thu, 12 Sep 2024 02:53:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sodhp-00081c-HM for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:29 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sodhn-0003Uo-RP for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:29 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4280ca0791bso5187445e9.1 for ; Wed, 11 Sep 2024 23:53:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726124006; x=1726728806; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=t/ZEidfxNqICq7WM8b0XlnmkWjSILpdbASTELUMU3dY=; b=l3HdcZPozICfqf1Mr53aNrvyK+Y4gwzGmDhFdEzcFjqGiU6SPwv8DTTvjz+kQ1a3g9 vvvZO39u+ApqPnP2zzOLBGeF8KuCaj+Uhl3KyvUfSy/cVtsFAwRRT/bg0ah1BLK9OeK+ DAcJ81omqxl611Gn4mP05nnWf6LLWXfYQEv0eGH5ZBAwSY/10h50WHbUewwzCklVzhWj 5dNcyZWTAFQfNFCnIM0fb+dQRdilXLQjPFGmz16l15Og8+lpCGSRe2HbXcThus/ko0tn yNSjsPcvdy6aUjMSalnn2pzi9zhqBvwtZYd4tIPfUXht22ew+70iUM3iExWbstmFVuym aHyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726124006; x=1726728806; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t/ZEidfxNqICq7WM8b0XlnmkWjSILpdbASTELUMU3dY=; b=M/1CvG9i9kuQfg6Yq+x2+3ab2MajQ2KNxSbVEr1qJu6gzUdkwsFBXsGwRi3NB8at9R wTdUPf51qJeWx5ijSXXZLIynKHXTS6/Bzv1U1abmf8FTaSJl6tMJsiuTcJ9MBc2mOf/Y zq9uAdvghVgdoHQPXg+GsPzePwjoTWJwBP2f8VIbR5g0hfSNo544MLhlTfdPvDQ4lLhl uGsMsIsWy6FNHJ+Vp2XE5t9FHIJv620YBjDyhS2O3vUvVeKs6D1R0G10EJCD3fHJKTFu sEuD9ytnIq4UjxLdtLDZ4md8dDBrRXZLTWaf0JvcF65Np/6BNYbrfzMJ1DBUVeFbWNz9 +gWw== X-Gm-Message-State: AOJu0YwthuB7QUqcjpcXS/3tZMKDKQEtqYe8PGf5IM/SlrMJ01EwVNzI D4X0uWGjNH7dTPGcCb7EzhDAIs907G7YUS+34jBLjkij2tzvrOvce1HktalFrnJ5RJLmF4x87sh Y X-Google-Smtp-Source: AGHT+IFZUo7enOXoUsmDKR7ocQmuv7sY3P1Lbn7auOyPA9sjmt2xeu2Iz/9yd+CIeDcsrgNJTUHm7w== X-Received: by 2002:a7b:c453:0:b0:42c:de34:34be with SMTP id 5b1f17b1804b1-42cde3436e0mr9697815e9.3.1726124006044; Wed, 11 Sep 2024 23:53:26 -0700 (PDT) Received: from m1x-phil.lan (mic92-h03-176-184-33-210.dsl.sta.abo.bbox.fr. [176.184.33.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42caeb8162dsm162743385e9.29.2024.09.11.23.53.25 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Sep 2024 23:53:25 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL v2 55/61] hw/misc: remove break after g_assert_not_reached() Date: Thu, 12 Sep 2024 08:52:24 +0200 Message-ID: <20240912065227.67848-11-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240912065227.67848-1-philmd@linaro.org> References: <20240912065227.67848-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Pierrick Bouvier Use of assert(false) can trip spurious control flow warnings from some versions of GCC (i.e. using -fsanitize=thread with gcc-12): error: control reaches end of non-void function [-Werror=return-type] default: g_assert_not_reached(); break; | ^^^^^ Solve that by removing the unreachable 'break' statement, unifying the code base on g_assert_not_reached() instead. Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240910221606.1817478-29-pierrick.bouvier@linaro.org> [PMD: Add description suggested by Eric Blake] Signed-off-by: Philippe Mathieu-Daudé --- hw/misc/imx6_ccm.c | 1 - hw/misc/mac_via.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c index b1def7f05b..fd5d7ce482 100644 --- a/hw/misc/imx6_ccm.c +++ b/hw/misc/imx6_ccm.c @@ -301,7 +301,6 @@ static uint64_t imx6_analog_get_periph_clk(IMX6CCMState *dev) default: /* We should never get there */ g_assert_not_reached(); - break; } trace_imx6_analog_get_periph_clk(freq); diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c index 652395b84f..af2b2b1af3 100644 --- a/hw/misc/mac_via.c +++ b/hw/misc/mac_via.c @@ -495,7 +495,6 @@ static void via1_rtc_update(MOS6522Q800VIA1State *v1s) break; default: g_assert_not_reached(); - break; } return; } @@ -556,7 +555,6 @@ static void via1_rtc_update(MOS6522Q800VIA1State *v1s) break; default: g_assert_not_reached(); - break; } return; } From patchwork Thu Sep 12 06:52:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13801502 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7995EEE6451 for ; Thu, 12 Sep 2024 06:53:43 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sodhx-0000Os-HN; Thu, 12 Sep 2024 02:53:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sodhw-0000Cy-1L for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:36 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sodht-0003VJ-S9 for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:35 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-371ba7e46easo518935f8f.0 for ; Wed, 11 Sep 2024 23:53:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726124012; x=1726728812; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=DoSSTd0j6/NNSb1Pb5Q11FBgrZrs0Txd/Ud1jRinqIs=; b=eR8C5yd9t7UnYUYFHfjrJ8HwhqkeZmgJ2EmhX1KKO+KRzNqdqHHXYblrKXZohR6W2x Ne8pGo83IhLWlNJBNa2gd76Q1iAq5+w8cRAdvZu4t3zDoTHCmA9afoO8jmsJAU++Q/2O BUdluaBeQ96RAkGoJDN6gl83NASqmJGqqZ8iq0QmWyOCzFDEuykWziHFFHi6iGUVmwqT 2KloM/M8GXJuINFYraLa6Xg0Bsp4YW8pltF+8rNP0+yPOoA7jLEHjnlnVr+CB4sFNpXb QUMYtvbg1gBTuJTUZcREXMi6c/KCdBigEoDcWHd0YWVrVPP1jWb5isQZfL7ZU4NwhKAN 7o1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726124012; x=1726728812; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DoSSTd0j6/NNSb1Pb5Q11FBgrZrs0Txd/Ud1jRinqIs=; b=a9CmDmuH6GgfHOY+/noe9sq1kmkVx26ONZQMDQMRq6iPKkPFelkWRMI4304MLfESEM 6EyTR3cScFdTn5TEQbvAzngEqHJhylsfK6Q/iEtrdO2OKRSul0leEgGe0os2N4Tf7zyV CVfP/OL91kqUThwpMOZjeNd65qxm7E5hC2xw4zfzFK0sEtJpo7OWVnlb5vmGRy3aOFmv edu8ghasEnGHiHcWr/VTJ3dA9smVcK07BKudl3E/I5ZRcMUAP7YbhbJcoCLVmOngIpmO rGcfMBqFXQG5qAiLaQ7EeZrps/Koe5dnEYZi6Ep7FKCaLZN1t65AvIiGQoSnU0TnYhoB XRAg== X-Gm-Message-State: AOJu0Yx/hPk3Wv0f8e8l3teSSgvL98faJJlMjHCkEHM1kcixVToavwVY W6kdWJ6KghJvA6Wwo91no6Nud9Uzdjd5wq6thl2XfoCKXZj13SNk8hmWIIx5/VwCp5CWS4PIGi8 c X-Google-Smtp-Source: AGHT+IEWvJ+tMYDAKBnqTnZ1YsTh4uaNaVDB9qpbnIblB020NjwZZANuM08Urx3+vB701c2mnHQc0A== X-Received: by 2002:a05:6000:2a8:b0:368:37ac:3f95 with SMTP id ffacd0b85a97d-378c2d032ebmr1378015f8f.31.1726124011715; Wed, 11 Sep 2024 23:53:31 -0700 (PDT) Received: from m1x-phil.lan (mic92-h03-176-184-33-210.dsl.sta.abo.bbox.fr. [176.184.33.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42caeb44473sm162061135e9.26.2024.09.11.23.53.30 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Sep 2024 23:53:31 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL v2 56/61] hw/pci-host: remove break after g_assert_not_reached() Date: Thu, 12 Sep 2024 08:52:25 +0200 Message-ID: <20240912065227.67848-12-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240912065227.67848-1-philmd@linaro.org> References: <20240912065227.67848-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Pierrick Bouvier Use of assert(false) can trip spurious control flow warnings from some versions of GCC (i.e. using -fsanitize=thread with gcc-12): error: control reaches end of non-void function [-Werror=return-type] default: g_assert_not_reached(); break; | ^^^^^ Solve that by removing the unreachable 'break' statement, unifying the code base on g_assert_not_reached() instead. Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240910221606.1817478-31-pierrick.bouvier@linaro.org> [PMD: Add description suggested by Eric Blake] Signed-off-by: Philippe Mathieu-Daudé --- hw/pci-host/gt64120.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/pci-host/gt64120.c b/hw/pci-host/gt64120.c index 33607dfbec..5855741662 100644 --- a/hw/pci-host/gt64120.c +++ b/hw/pci-host/gt64120.c @@ -689,7 +689,6 @@ static void gt64120_writel(void *opaque, hwaddr addr, case GT_PCI0_CFGDATA: /* Mapped via in gt64120_pci_mapping() */ g_assert_not_reached(); - break; /* Interrupts */ case GT_INTRCAUSE: @@ -933,7 +932,6 @@ static uint64_t gt64120_readl(void *opaque, case GT_PCI0_CFGDATA: /* Mapped via in gt64120_pci_mapping() */ g_assert_not_reached(); - break; case GT_PCI0_CMD: case GT_PCI0_TOR: From patchwork Thu Sep 12 06:52:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13801508 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4032BEE6452 for ; Thu, 12 Sep 2024 06:54:58 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sodiC-000197-V9; Thu, 12 Sep 2024 02:53:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sodi1-0000lF-2t for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:41 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sodhz-0003Vl-7p for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:40 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-374c7e64b60so404020f8f.2 for ; Wed, 11 Sep 2024 23:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726124017; x=1726728817; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=jtNJDIJpUDW0bpRhizb3Cf8FodNOF9sdbTjBD++YWOI=; b=OOBjTxjRedfsg000zdCcywmC7wd+EohaoAPOteRVous/V4/87O7p9R9Y1rOP+iEF7/ c+UrWcLX6evU6ft4k5xwe9suskHomuyhqlGsDv85tBueVXSC+yN145a/D0Bqx4nmJReT Jv1HTkw5Tj+qGskA+sK4SbiPCgdif3ljEDwb7QjnQRAzLbKie2rumMALzuV7R/ruV9HZ nQbQ7hofEpnY5tzRou5alk8GJCuPHKkq0g9Nxh1FJ82vZfvFAvSZOeB7Eq7oUJumBA5v B6lwER1gHRc4PHoSWfcr+eCXrH8KA6U3+CImgVLAl623nis6/P/QYIvP+Q3jPX/tul5D pMJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726124017; x=1726728817; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jtNJDIJpUDW0bpRhizb3Cf8FodNOF9sdbTjBD++YWOI=; b=s5QfuWYy2m9Sa3YKW5OX3+4Yik0i1tAqPtzDQdYuUMBAaenb70AruHhuiiQ3DiU6GS mh3v1NcLIWIMy9p1V0CJyjIxhSAcI27+vfllBXpIlo41HTnyw8TbnacJzpu8hGXJYaFs 68VpxxPV1XYsXhnmx0v0SX17o8cy5QYhnGo/d6qwAl06VksrWtUEd++USQ9DgJpBW+Li aBZIAm2iJM5VVRshn0JPXFZqVEnWiyl0Kh2yJbncrPXShqE9RUNXVU4EUBvhbj0MIZup 9KuX7ZnC0fFS4v2DpLOspW7PPrnPnMcWN764K1QUYWNCdKA/nIdZ35lbfsUgyMgLe0NJ tUjg== X-Gm-Message-State: AOJu0YwG8n+ZtrfugcQQKEWgvM0S2MFrmlyfWK4XMAGuIHbgfg0KH2Y3 EErRhkOoi5jVgWqWONHJ9gnwqv09OZ9tZ5xwbeKEliN0bONBk5TGVnCWvIoE9kj3tcmAvKxvsid z X-Google-Smtp-Source: AGHT+IGD98+6TkdrYZ0rUSNXLKOQzXDu2+sfauEnwsSqE7d4Jja2CrdaY3tQCZ3s/uXPo2nNXMDX3w== X-Received: by 2002:a05:6000:ac4:b0:366:ee9b:847 with SMTP id ffacd0b85a97d-378c2d05d7emr900018f8f.14.1726124017186; Wed, 11 Sep 2024 23:53:37 -0700 (PDT) Received: from m1x-phil.lan (mic92-h03-176-184-33-210.dsl.sta.abo.bbox.fr. [176.184.33.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378956653f9sm13440159f8f.31.2024.09.11.23.53.36 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Sep 2024 23:53:36 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL v2 57/61] system: replace assert(0) with g_assert_not_reached() Date: Thu, 12 Sep 2024 08:52:26 +0200 Message-ID: <20240912065227.67848-13-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240912065227.67848-1-philmd@linaro.org> References: <20240912065227.67848-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Pierrick Bouvier Use of assert(false) can trip spurious control flow warnings from some versions of GCC (i.e. using -fsanitize=thread with gcc-12): error: control reaches end of non-void function [-Werror=return-type] default: assert(0); | } | ^ Solve that by unifying the code base on g_assert_not_reached() instead. Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240910221606.1817478-11-pierrick.bouvier@linaro.org> [PMD: Add description suggested by Eric Blake] Signed-off-by: Philippe Mathieu-Daudé --- system/rtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/rtc.c b/system/rtc.c index dc44576686..216d2aee3a 100644 --- a/system/rtc.c +++ b/system/rtc.c @@ -62,7 +62,7 @@ static time_t qemu_ref_timedate(QEMUClockType clock) } break; default: - assert(0); + g_assert_not_reached(); } return value; } From patchwork Thu Sep 12 06:52:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13801506 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D87E0EE6452 for ; Thu, 12 Sep 2024 06:54:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sodie-0003jZ-PY; Thu, 12 Sep 2024 02:54:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sodiA-0001UK-2t for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:52 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sodi6-0003WN-Od for qemu-devel@nongnu.org; Thu, 12 Sep 2024 02:53:48 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-374ca7a10d4so436770f8f.3 for ; Wed, 11 Sep 2024 23:53:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726124025; x=1726728825; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Z8JlX1hTCmbpuUkyTy+jdA1DfHzPSmi+/XVGPIHJ48I=; b=vw3wAXP8YyzANzqGEgQrOwiwgB31HJpXKWjseKvB6y6bIkQBjfb4EK17i7YFtwXodI 9YMwilQxrFaR+RlaPhoguLtZid9DhRgOmRRMOSG3hsm9IH7/44jhNtvEtO00dMOeRQ0p HzioYey86r0hF7TBeU/FzEVKwxUAyxVtR17IrLBm9ED3sW5rWtwCSxi4EmeA2BtZCUJd XD7diH0F16jGv8NGGQ0JSKFtGxJlSRXhn3CG6Um73awRniignheZqDamBYKNKgPNgik9 YTigqKkQvZ1qy0AWiSKluFyq/uX7b+U0A+4nJgTBP2ttKVJw8691y418+LWb9XOLo2mt AFcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726124025; x=1726728825; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z8JlX1hTCmbpuUkyTy+jdA1DfHzPSmi+/XVGPIHJ48I=; b=JkpsLV8WxxnL0TFoPXaOaFP8/zSxzabgcMzKhduBVUDu5jKx/8bUx2wpoDjg0X7Y4U fKORvjX6nyBs5dIWqvRPX0+TBjEpOSlJdJiq2sdMBslrYiZt7YIbPYoXb/HqdYQaNA3U 4sVuFmfHd1OjPWzsvO9hNaMrHN+J1LcSN5xpTT4KYuGofyVxyFWE5/w3U7E92YFvQSnS CnQFxoiPR/3i7VVeE62g6kGMmI1/GvFEyjcfZnUPOvQ/GRRJEuz7ttjNun26N9RLUIyi JAouCq99mdtu7Azy94K2G5Bw5NI//2VCrzFFsDilGg0iyjomSJhCuub4bLs6NJgLr8UA VdjA== X-Gm-Message-State: AOJu0YxZxvGOKXoaVNmauOix934mCOhg+MPm6+WgCjLMAXf/JVPwp0me Q57c7KxcjriY2WmDWTsAPhpb1r3tIXt+TA1QmZ8QizgR1INrT5zDW6Erw/pVyiVib9P3FGWFCWa a X-Google-Smtp-Source: AGHT+IFje1iHjYQRayee5IXKWbieCnQTeMV5uuBMuNTGI4ioXw7aZ7eOs0b0GJZpjngZdOjXPZJnhA== X-Received: by 2002:a05:6000:459f:b0:374:c0c5:3c05 with SMTP id ffacd0b85a97d-378c2d4d802mr923227f8f.42.1726124024412; Wed, 11 Sep 2024 23:53:44 -0700 (PDT) Received: from m1x-phil.lan (mic92-h03-176-184-33-210.dsl.sta.abo.bbox.fr. [176.184.33.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378956650fdsm13521670f8f.25.2024.09.11.23.53.43 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 11 Sep 2024 23:53:44 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL v2 61/61] ui: remove break after g_assert_not_reached() Date: Thu, 12 Sep 2024 08:52:27 +0200 Message-ID: <20240912065227.67848-14-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240912065227.67848-1-philmd@linaro.org> References: <20240912065227.67848-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Pierrick Bouvier Use of assert(false) can trip spurious control flow warnings from some versions of GCC (i.e. using -fsanitize=thread with gcc-12): error: control reaches end of non-void function [-Werror=return-type] default: g_assert_not_reached(); break; | ^^^^^ Solve that by removing the unreachable 'break' statement, unifying the code base on g_assert_not_reached() instead. Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240910221606.1817478-37-pierrick.bouvier@linaro.org> [PMD: Add description suggested by Eric Blake] Signed-off-by: Philippe Mathieu-Daudé --- ui/qemu-pixman.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/qemu-pixman.c b/ui/qemu-pixman.c index 5ca55dd199..6cada8b45e 100644 --- a/ui/qemu-pixman.c +++ b/ui/qemu-pixman.c @@ -49,7 +49,6 @@ PixelFormat qemu_pixelformat_from_pixman(pixman_format_code_t format) break; default: g_assert_not_reached(); - break; } pf.amax = (1 << pf.abits) - 1;