[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aSQQA1pCyFN2rppy@smile.fi.intel.com>
Date: Mon, 24 Nov 2025 09:57:55 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Jisheng Zhang <jszhang@...nel.org>
Cc: Hoan Tran <hoan@...amperecomputing.com>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org,
Michael Büsch <mb@...s.ch>
Subject: Re: [PATCH v2] gpio: dwapb: Fold dwapb_context into dwapb_gpio_port
On Mon, Nov 24, 2025 at 09:56:53AM +0200, Andy Shevchenko wrote:
> On Mon, Nov 24, 2025 at 08:32:06AM +0800, Jisheng Zhang 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.
>
> Fold --> fold
>
> Given more thinking on this, I believe the approach with kmalloc() is
> preferable, but what should be done is
> - making context a global variable
I mean global _per device_, so moving it to the DWAPB device level structure.
> - considering allocation for all ports at once
>
> If this is done, the embedded approach will look less efficient.
> So, please try that one instead.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists