[PATCH] gpio: dwapb: Fold dwapb_context into dwapb_gpio_port
Linus Walleij
linus.walleij at linaro.org
Wed Nov 19 09:28:33 PST 2025
On Wed, Nov 19, 2025 at 4:18 PM Jisheng Zhang <jszhang at kernel.org> wrote:
> Fold dwapb_context into struct dwapb_gpio_port to further simplify
> the code. Sure this brings a tiny 36 bytes data overhead for
> !PM_SLEEP. After grepping the arm/arm64/riscv dts dir, the max dwapb
> gpio port number is 6(the berlin2q soc family), so this means we will
> waste 216 bytes memory in total which is trivial compared to the
> system memory.
>
> From another side, as Michael mentioned:
> "The driver currently allocates the struct with kzalloc and stores a
> pointer to it in case of PM=y.
> So this probably has an overhead in the same order of magnitude
> (pointer + malloc overhead/alignment/fragmentation) in case of PM=y
> now."
>
> So let's Fold dwapb_context into struct dwapb_gpio_port.
>
> Signed-off-by: Jisheng Zhang <jszhang at kernel.org>
> CC: Michael Büsch <mb at bues.ch>
Neat.
Reviewed-by: Linus Walleij <linus.walleij at linaro.org>
Yours,
Linus Walleij
More information about the linux-riscv
mailing list