Thread (21 messages) 21 messages, 6 authors, 2023-08-23

Re: [PATCH v3 2/2] gpio: loongson: add firmware offset parse support

From: Linus Walleij <hidden>
Date: 2023-08-10 08:28:15
Also in: linux-gpio, lkml

Hi Yinbo,

thanks for your patch!

On Mon, Aug 7, 2023 at 9:41 AM Yinbo Zhu [off-list ref] wrote:
Loongson GPIO controllers come in multiple variants that are compatible
except for certain register offset values.  Add support for device
properties allowing to specify them in ACPI or DT.

Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
(...)
quoted hunk ↗ jump to hunk
@@ -26,6 +26,7 @@ struct loongson_gpio_chip_data {
        unsigned int            conf_offset;
        unsigned int            out_offset;
        unsigned int            in_offset;
+       unsigned int            inten_offset;
Consider just changing all of these from unsigned int to u32.

(...)
+       if (device_property_read_u32(dev, "loongson,gpio-conf-offset", (u32 *)&d->conf_offset)
+           || device_property_read_u32(dev, "loongson,gpio-in-offset", (u32 *)&d->in_offset)
+           || device_property_read_u32(dev, "loongson,gpio-out-offset", (u32 *)&d->out_offset)
+           || device_property_read_u32(dev, "loongson,gpio-ctrl-mode", (u32 *)&d->mode))
Because then you can get rid of this annoying forest of cast.

I'm fine with doing this change in this patch without a need for a separate
refactoring, as it's just a contained driver and clearly just about typing.

Yours,
Linus Walleij
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help