From: <pdel@fb.com>
Cc: <clg@kaod.org>, <peter.maydell@linaro.org>,
<andrew.aj.id.au@devvm660.prn0.facebook.com>, <joel@jms.id.au>,
<qemu-arm@nongnu.org>, <qemu-devel@nongnu.org>,
Peter Delevoryas <pdel@fb.com>
Subject: [PATCH v2 0/1] hw: aspeed_gpio: Fix GPIO array indexing
Date: Thu, 7 Oct 2021 20:35:00 -0700 [thread overview]
Message-ID: <20211008033501.934729-1-pdel@fb.com> (raw)
From: Peter Delevoryas <pdel@fb.com>
v1: https://lore.kernel.org/qemu-devel/20210924061953.1996620-1-pdel@fb.com/
v2:
- Standardized the size of the GPIOSetProperties array for each
Aspeed SOC so that we can use the constant
"ASPEED_GPIO_MAX_NR_SETS" to iterate over all of them.
This adds some unused, zeroed memory, and the for-loops spend some
time skipping over zeroed entries, but I don't think it's a big
deal, and it's simpler than tracking a variable-length nr_sets
property on the classes.
Thanks,
Peter
Peter Delevoryas (1):
hw: aspeed_gpio: Fix GPIO array indexing
hw/gpio/aspeed_gpio.c | 80 +++++++++++++++--------------------
include/hw/gpio/aspeed_gpio.h | 5 +--
2 files changed, 35 insertions(+), 50 deletions(-)
Interdiff against v1:
diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c
index 78b0f64b03..911d21c8cf 100644
--- a/hw/gpio/aspeed_gpio.c
+++ b/hw/gpio/aspeed_gpio.c
@@ -759,7 +759,7 @@ static void aspeed_gpio_set_pin(Object *obj, Visitor *v, const char *name,
}
/****************** Setup functions ******************/
-static const GPIOSetProperties ast2400_set_props[] = {
+static const GPIOSetProperties ast2400_set_props[ASPEED_GPIO_MAX_NR_SETS] = {
[0] = {0xffffffff, 0xffffffff, {"A", "B", "C", "D"} },
[1] = {0xffffffff, 0xffffffff, {"E", "F", "G", "H"} },
[2] = {0xffffffff, 0xffffffff, {"I", "J", "K", "L"} },
@@ -769,7 +769,7 @@ static const GPIOSetProperties ast2400_set_props[] = {
[6] = {0x0000000f, 0x0fffff0f, {"Y", "Z", "AA", "AB"} },
};
-static const GPIOSetProperties ast2500_set_props[] = {
+static const GPIOSetProperties ast2500_set_props[ASPEED_GPIO_MAX_NR_SETS] = {
[0] = {0xffffffff, 0xffffffff, {"A", "B", "C", "D"} },
[1] = {0xffffffff, 0xffffffff, {"E", "F", "G", "H"} },
[2] = {0xffffffff, 0xffffffff, {"I", "J", "K", "L"} },
@@ -780,7 +780,7 @@ static const GPIOSetProperties ast2500_set_props[] = {
[7] = {0x000000ff, 0x000000ff, {"AC"} },
};
-static GPIOSetProperties ast2600_3_3v_set_props[] = {
+static GPIOSetProperties ast2600_3_3v_set_props[ASPEED_GPIO_MAX_NR_SETS] = {
[0] = {0xffffffff, 0xffffffff, {"A", "B", "C", "D"} },
[1] = {0xffffffff, 0xffffffff, {"E", "F", "G", "H"} },
[2] = {0xffffffff, 0xffffffff, {"I", "J", "K", "L"} },
@@ -790,7 +790,7 @@ static GPIOSetProperties ast2600_3_3v_set_props[] = {
[6] = {0x0000ffff, 0x0000ffff, {"Y", "Z"} },
};
-static GPIOSetProperties ast2600_1_8v_set_props[] = {
+static GPIOSetProperties ast2600_1_8v_set_props[ASPEED_GPIO_MAX_NR_SETS] = {
[0] = {0xffffffff, 0xffffffff, {"18A", "18B", "18C", "18D"} },
[1] = {0x0000000f, 0x0000000f, {"18E"} },
};
--
2.30.2
next reply other threads:[~2021-10-08 3:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-08 3:35 pdel [this message]
2021-10-08 3:35 ` [PATCH v2 1/1] hw: aspeed_gpio: Fix GPIO array indexing pdel
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=20211008033501.934729-1-pdel@fb.com \
--to=pdel@fb.com \
--cc=andrew.aj.id.au@devvm660.prn0.facebook.com \
--cc=clg@kaod.org \
--cc=joel@jms.id.au \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.