From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: BALATON Zoltan <balaton@eik.bme.hu>,
qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Subject: Re: [PATCH] hw/misc/macio/gpio.c: Add defines for register bits
Date: Mon, 24 Feb 2025 10:23:02 +0100 [thread overview]
Message-ID: <6b2f8e99-d7f3-4f37-97a2-e9260a11a34b@linaro.org> (raw)
In-Reply-To: <20250223001445.D21104E603E@zero.eik.bme.hu>
On 23/2/25 01:14, BALATON Zoltan wrote:
> Add named constants for register bit values that should make it easier
> to understand what these mean.
>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
> hw/misc/macio/gpio.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/hw/misc/macio/gpio.c b/hw/misc/macio/gpio.c
> index 4364afc84a..06be5a4f98 100644
> --- a/hw/misc/macio/gpio.c
> +++ b/hw/misc/macio/gpio.c
> @@ -34,6 +34,9 @@
> #include "qemu/module.h"
> #include "trace.h"
>
Maybe use an enum and add a comment /* Register ... bits */, otherwise:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> +#define OUT_DATA 1
> +#define IN_DATA 2
> +#define OUT_ENABLE 4
>
> void macio_set_gpio(MacIOGPIOState *s, uint32_t gpio, bool state)
> {
> @@ -41,14 +44,14 @@ void macio_set_gpio(MacIOGPIOState *s, uint32_t gpio, bool state)
>
> trace_macio_set_gpio(gpio, state);
>
> - if (s->gpio_regs[gpio] & 4) {
> + if (s->gpio_regs[gpio] & OUT_ENABLE) {
> qemu_log_mask(LOG_GUEST_ERROR,
> "GPIO: Setting GPIO %d while it's an output\n", gpio);
> }
prev parent reply other threads:[~2025-02-24 9:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-23 0:14 [PATCH] hw/misc/macio/gpio.c: Add defines for register bits BALATON Zoltan
2025-02-24 9:23 ` Philippe Mathieu-Daudé [this message]
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=6b2f8e99-d7f3-4f37-97a2-e9260a11a34b@linaro.org \
--to=philmd@linaro.org \
--cc=balaton@eik.bme.hu \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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).