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 <bala...@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é <phi...@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);
}