From: Krzysztof Kozlowski <krzk@kernel.org>
To: Igor Mitsyanko <i.mitsyanko@gmail.com>,
Peter Maydell <peter.maydell@linaro.org>,
Paolo Bonzini <pbonzini@redhat.com>,
qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: eblake@redhat.com, "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Krzysztof Kozlowski" <krzk@kernel.org>
Subject: [Qemu-devel] [PATCH v3 2/3] hw/char/exynos4210_uart: Constify static array and few arguments
Date: Mon, 13 Mar 2017 20:47:49 +0200 [thread overview]
Message-ID: <20170313184750.429-3-krzk@kernel.org> (raw)
In-Reply-To: <20170313184750.429-1-krzk@kernel.org>
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 <krzk@kernel.org>
---
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;
-static Exynos4210UartReg exynos4210_uart_regs[] = {
+static const Exynos4210UartReg exynos4210_uart_regs[] = {
{"ULCON", ULCON, 0x00000000},
{"UCON", UCON, 0x00003000},
{"UFCON", UFCON, 0x00000000},
@@ -220,7 +220,7 @@ static uint8_t fifo_retrieve(Exynos4210UartFIFO *q)
return ret;
}
-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;
}
-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 = 0;
}
-static uint32_t exynos4210_uart_Tx_FIFO_trigger_level(Exynos4210UartState *s)
+static uint32_t exynos4210_uart_Tx_FIFO_trigger_level(const Exynos4210UartState *s)
{
uint32_t level = 0;
uint32_t reg;
--
2.9.3
next prev parent reply other threads:[~2017-03-13 18:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-13 18:47 [Qemu-devel] [PATCH v3 0/3] hw/arm/exynos: Minor cleanups Krzysztof Kozlowski
2017-03-13 18:47 ` [Qemu-devel] [PATCH v3 1/3] hw/arm/exynos: Convert fprintf to qemu_log_mask/error_report Krzysztof Kozlowski
2017-03-13 19:26 ` Philippe Mathieu-Daudé
2017-03-13 18:47 ` Krzysztof Kozlowski [this message]
2017-03-13 18:47 ` [Qemu-devel] [PATCH v3 3/3] hw/misc/exynos4210_pmu: Reorder local variables for readability Krzysztof Kozlowski
2017-03-13 19:28 ` Philippe Mathieu-Daudé
2017-04-04 11:52 ` [Qemu-devel] [PATCH v3 0/3] hw/arm/exynos: Minor cleanups Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170313184750.429-3-krzk@kernel.org \
--to=krzk@kernel.org \
--cc=eblake@redhat.com \
--cc=f4bug@amsat.org \
--cc=i.mitsyanko@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).