From nobody Thu Nov 6 14:12:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148943025287460.144317179321774; Mon, 13 Mar 2017 11:37:32 -0700 (PDT) Received: from localhost ([::1]:53808 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnUqY-0005og-JQ for importer@patchew.org; Mon, 13 Mar 2017 14:37:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnUpb-0005go-TZ for qemu-devel@nongnu.org; Mon, 13 Mar 2017 14:36:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnUpa-0000gp-V3 for qemu-devel@nongnu.org; Mon, 13 Mar 2017 14:36:31 -0400 Received: from mail.kernel.org ([198.145.29.136]:54378) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cnUpX-0000gG-SP; Mon, 13 Mar 2017 14:36:28 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E4E7B20263; Mon, 13 Mar 2017 18:36:25 +0000 (UTC) Received: from localhost.localdomain (bzq-79-180-56-222.red.bezeqint.net [79.180.56.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CB24020225; Mon, 13 Mar 2017 18:36:21 +0000 (UTC) From: Krzysztof Kozlowski To: Igor Mitsyanko , Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Mon, 13 Mar 2017 20:35:55 +0200 Message-Id: <20170313183557.23195-2-krzk@kernel.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170313183557.23195-1-krzk@kernel.org> References: <20170313183557.23195-1-krzk@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 198.145.29.136 Subject: [Qemu-devel] [PATCH v2 1/3] hw/arm/exynos: Convert fprintf to error_report() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Krzysztof Kozlowski Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" error_report() is preferred over fprintf() for logging errors. Also remove square brackets [] and additional new line characters in printed messages. Signed-off-by: Krzysztof Kozlowski --- hw/arm/exynos4_boards.c | 6 +++--- hw/timer/exynos4210_mct.c | 5 +++-- hw/timer/exynos4210_pwm.c | 11 +++++------ hw/timer/exynos4210_rtc.c | 16 +++++++--------- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c index 0efa19405409..0a352815b86d 100644 --- a/hw/arm/exynos4_boards.c +++ b/hw/arm/exynos4_boards.c @@ -22,6 +22,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "cpu.h" #include "sysemu/sysemu.h" @@ -101,9 +102,8 @@ static Exynos4210State *exynos4_boards_init_common(Mach= ineState *machine, MachineClass *mc =3D MACHINE_GET_CLASS(machine); =20 if (smp_cpus !=3D EXYNOS4210_NCPUS && !qtest_enabled()) { - fprintf(stderr, "%s board supports only %d CPU cores. Ignoring smp= _cpus" - " value.\n", - mc->name, EXYNOS4210_NCPUS); + error_report("%s board supports only %d CPU cores, ignoring smp_cp= us value", + mc->name, EXYNOS4210_NCPUS); } =20 exynos4_board_binfo.ram_size =3D exynos4_board_ram_size[board_type]; diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c index 6069116942a4..48041ab036a6 100644 --- a/hw/timer/exynos4210_mct.c +++ b/hw/timer/exynos4210_mct.c @@ -53,6 +53,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/sysbus.h" #include "qemu/timer.h" #include "qemu/main-loop.h" @@ -1364,8 +1365,8 @@ static void exynos4210_mct_write(void *opaque, hwaddr= offset, case L0_TCNTO: case L1_TCNTO: case L0_ICNTO: case L1_ICNTO: case L0_FRCNTO: case L1_FRCNTO: - fprintf(stderr, "\n[exynos4210.mct: write to RO register " - TARGET_FMT_plx "]\n\n", offset); + error_report("exynos4210.mct: write to RO register " TARGET_FMT_pl= x, + offset); break; =20 case L0_INT_CSTAT: case L1_INT_CSTAT: diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c index f5765075c720..f8826e24e63d 100644 --- a/hw/timer/exynos4210_pwm.c +++ b/hw/timer/exynos4210_pwm.c @@ -21,6 +21,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/sysbus.h" #include "qemu/timer.h" #include "qemu-common.h" @@ -252,9 +253,8 @@ static uint64_t exynos4210_pwm_read(void *opaque, hwadd= r offset, break; =20 default: - fprintf(stderr, - "[exynos4210.pwm: bad read offset " TARGET_FMT_plx "]\n", - offset); + error_report("exynos4210.pwm: bad read offset " TARGET_FMT_plx, + offset); break; } return value; @@ -343,9 +343,8 @@ static void exynos4210_pwm_write(void *opaque, hwaddr o= ffset, break; =20 default: - fprintf(stderr, - "[exynos4210.pwm: bad write offset " TARGET_FMT_plx "]\n", - offset); + error_report("exynos4210.pwm: bad write offset " TARGET_FMT_plx, + offset); break; =20 } diff --git a/hw/timer/exynos4210_rtc.c b/hw/timer/exynos4210_rtc.c index 1a648c5d9e67..f4548cd555f4 100644 --- a/hw/timer/exynos4210_rtc.c +++ b/hw/timer/exynos4210_rtc.c @@ -26,6 +26,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/sysbus.h" #include "qemu/timer.h" #include "qemu-common.h" @@ -370,9 +371,8 @@ static uint64_t exynos4210_rtc_read(void *opaque, hwadd= r offset, break; =20 default: - fprintf(stderr, - "[exynos4210.rtc: bad read offset " TARGET_FMT_plx "]\n", - offset); + error_report("exynos4210.rtc: bad read offset " TARGET_FMT_plx, + offset); break; } return value; @@ -433,9 +433,8 @@ static void exynos4210_rtc_write(void *opaque, hwaddr o= ffset, if (value > TICNT_THRESHOLD) { s->reg_ticcnt =3D value; } else { - fprintf(stderr, - "[exynos4210.rtc: bad TICNT value %u ]\n", - (uint32_t)value); + error_report("exynos4210.rtc: bad TICNT value %u", + (uint32_t)value); } break; =20 @@ -500,9 +499,8 @@ static void exynos4210_rtc_write(void *opaque, hwaddr o= ffset, break; =20 default: - fprintf(stderr, - "[exynos4210.rtc: bad write offset " TARGET_FMT_plx "]\n", - offset); + error_report("exynos4210.rtc: bad write offset " TARGET_FMT_plx, + offset); break; =20 } --=20 2.9.3 From nobody Thu Nov 6 14:12:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1489430259039349.23607756291335; Mon, 13 Mar 2017 11:37:39 -0700 (PDT) Received: from localhost ([::1]:53809 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnUqd-0005tS-PC for importer@patchew.org; Mon, 13 Mar 2017 14:37:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnUph-0005lm-VW for qemu-devel@nongnu.org; Mon, 13 Mar 2017 14:36:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnUph-0000iV-9v for qemu-devel@nongnu.org; Mon, 13 Mar 2017 14:36:38 -0400 Received: from mail.kernel.org ([198.145.29.136]:54410) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cnUpc-0000gv-6m; Mon, 13 Mar 2017 14:36:32 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4E542203E1; Mon, 13 Mar 2017 18:36:30 +0000 (UTC) Received: from localhost.localdomain (bzq-79-180-56-222.red.bezeqint.net [79.180.56.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 633B520272; Mon, 13 Mar 2017 18:36:26 +0000 (UTC) From: Krzysztof Kozlowski To: Igor Mitsyanko , Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Mon, 13 Mar 2017 20:35:56 +0200 Message-Id: <20170313183557.23195-3-krzk@kernel.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170313183557.23195-1-krzk@kernel.org> References: <20170313183557.23195-1-krzk@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 198.145.29.136 Subject: [Qemu-devel] [PATCH v2 2/3] hw/char/exynos4210_uart: Constify static array and few arguments X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Krzysztof Kozlowski Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The static array exynos4210_uart_regs with register values is not modified so it can be made const. Few other functions accept driver or uart state as an argument but they do not change it and do not cast it so this can be made const for code safeness. Signed-off-by: Krzysztof Kozlowski --- hw/char/exynos4210_uart.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c index b75f28d473bf..bff706ab3a68 100644 --- a/hw/char/exynos4210_uart.c +++ b/hw/char/exynos4210_uart.c @@ -102,7 +102,7 @@ typedef struct Exynos4210UartReg { uint32_t reset_value; } Exynos4210UartReg; =20 -static Exynos4210UartReg exynos4210_uart_regs[] =3D { +static const Exynos4210UartReg exynos4210_uart_regs[] =3D { {"ULCON", ULCON, 0x00000000}, {"UCON", UCON, 0x00003000}, {"UFCON", UFCON, 0x00000000}, @@ -220,7 +220,7 @@ static uint8_t fifo_retrieve(Exynos4210UartFIFO *q) return ret; } =20 -static int fifo_elements_number(Exynos4210UartFIFO *q) +static int fifo_elements_number(const Exynos4210UartFIFO *q) { if (q->sp < q->rp) { return q->size - q->rp + q->sp; @@ -229,7 +229,7 @@ static int fifo_elements_number(Exynos4210UartFIFO *q) return q->sp - q->rp; } =20 -static int fifo_empty_elements_number(Exynos4210UartFIFO *q) +static int fifo_empty_elements_number(const Exynos4210UartFIFO *q) { return q->size - fifo_elements_number(q); } @@ -245,7 +245,7 @@ static void fifo_reset(Exynos4210UartFIFO *q) q->rp =3D 0; } =20 -static uint32_t exynos4210_uart_Tx_FIFO_trigger_level(Exynos4210UartState = *s) +static uint32_t exynos4210_uart_Tx_FIFO_trigger_level(const Exynos4210Uart= State *s) { uint32_t level =3D 0; uint32_t reg; --=20 2.9.3 From nobody Thu Nov 6 14:12:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1489430341517429.4561498008866; Mon, 13 Mar 2017 11:39:01 -0700 (PDT) Received: from localhost ([::1]:53817 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnUrz-0007G5-D7 for importer@patchew.org; Mon, 13 Mar 2017 14:38:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnUpj-0005mn-4N for qemu-devel@nongnu.org; Mon, 13 Mar 2017 14:36:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnUpi-0000ix-Dk for qemu-devel@nongnu.org; Mon, 13 Mar 2017 14:36:39 -0400 Received: from mail.kernel.org ([198.145.29.136]:54476) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cnUpg-0000hg-8z; Mon, 13 Mar 2017 14:36:36 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7F7DE203F7; Mon, 13 Mar 2017 18:36:34 +0000 (UTC) Received: from localhost.localdomain (bzq-79-180-56-222.red.bezeqint.net [79.180.56.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0CF87203F1; Mon, 13 Mar 2017 18:36:30 +0000 (UTC) From: Krzysztof Kozlowski To: Igor Mitsyanko , Peter Maydell , Paolo Bonzini , qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Mon, 13 Mar 2017 20:35:57 +0200 Message-Id: <20170313183557.23195-4-krzk@kernel.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170313183557.23195-1-krzk@kernel.org> References: <20170313183557.23195-1-krzk@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 198.145.29.136 Subject: [Qemu-devel] [PATCH v2 3/3] hw/misc/exynos4210_pmu: Reorder local variables for readability X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Krzysztof Kozlowski Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Short declaration of 'i' was in the middle of declarations with assignments. Make it a little bit more readable. Additionally switch from "unsigned" to "unsigned int" as this pattern is more widely used. No functional change. Signed-off-by: Krzysztof Kozlowski --- hw/misc/exynos4210_pmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/misc/exynos4210_pmu.c b/hw/misc/exynos4210_pmu.c index e30dbc7d3d83..63a8ccd35559 100644 --- a/hw/misc/exynos4210_pmu.c +++ b/hw/misc/exynos4210_pmu.c @@ -401,8 +401,8 @@ static uint64_t exynos4210_pmu_read(void *opaque, hwadd= r offset, unsigned size) { Exynos4210PmuState *s =3D (Exynos4210PmuState *)opaque; - unsigned i; const Exynos4210PmuReg *reg_p =3D exynos4210_pmu_regs; + unsigned int i; =20 for (i =3D 0; i < PMU_NUM_OF_REGISTERS; i++) { if (reg_p->offset =3D=3D offset) { @@ -420,8 +420,8 @@ static void exynos4210_pmu_write(void *opaque, hwaddr o= ffset, uint64_t val, unsigned size) { Exynos4210PmuState *s =3D (Exynos4210PmuState *)opaque; - unsigned i; const Exynos4210PmuReg *reg_p =3D exynos4210_pmu_regs; + unsigned int i; =20 for (i =3D 0; i < PMU_NUM_OF_REGISTERS; i++) { if (reg_p->offset =3D=3D offset) { --=20 2.9.3