[PATCH v2 0/6] gpiolib: acpi: Refactor to shrink the code by ~8%

Andy Shevchenko posted 6 patches 1 week ago
drivers/gpio/gpiolib-acpi.c   | 146 +++++++++++++++++-----------------
include/linux/gpio/consumer.h |   2 +-
2 files changed, 72 insertions(+), 76 deletions(-)
[PATCH v2 0/6] gpiolib: acpi: Refactor to shrink the code by ~8%
Posted by Andy Shevchenko 1 week ago
A simple refactoring of the GPIO ACPI library parts to get an impressive
~8% code shrink on x86_64 and ~2% on x86_32. Also reduces a C code a bit.

add/remove: 0/2 grow/shrink: 0/5 up/down: 0/-1221 (-1221)
Function                                     old     new   delta
acpi_gpio_property_lookup                    425     414     -11
acpi_find_gpio.__UNIQUE_ID_ddebug478          56       -     -56
acpi_dev_gpio_irq_wake_get_by.__UNIQUE_ID_ddebug480      56       -     -56
acpi_find_gpio                               354     216    -138
acpi_get_gpiod_by_index                      462     307    -155
__acpi_find_gpio                             877     638    -239
acpi_dev_gpio_irq_wake_get_by                695     129    -566
Total: Before=15375, After=14154, chg -7.94%

In v2:
- renamed par to params (Mika, Bart)

Andy Shevchenko (6):
  gpiolib: acpi: Improve struct acpi_gpio_info memory footprint
  gpiolib: acpi: Remove index parameter from acpi_gpio_property_lookup()
  gpiolib: acpi: Reduce memory footprint for struct acpi_gpio_params
  gpiolib: acpi: Rename par to params for better readability
  gpiolib: acpi: Reuse struct acpi_gpio_params in struct
    acpi_gpio_lookup
  gpiolib: acpi: Deduplicate some code in __acpi_find_gpio()

 drivers/gpio/gpiolib-acpi.c   | 146 +++++++++++++++++-----------------
 include/linux/gpio/consumer.h |   2 +-
 2 files changed, 72 insertions(+), 76 deletions(-)

-- 
2.47.2
Re: [PATCH v2 0/6] gpiolib: acpi: Refactor to shrink the code by ~8%
Posted by Bartosz Golaszewski 6 days, 10 hours ago
On Thu, Apr 3, 2025 at 6:00 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> A simple refactoring of the GPIO ACPI library parts to get an impressive
> ~8% code shrink on x86_64 and ~2% on x86_32. Also reduces a C code a bit.
>
> add/remove: 0/2 grow/shrink: 0/5 up/down: 0/-1221 (-1221)
> Function                                     old     new   delta
> acpi_gpio_property_lookup                    425     414     -11
> acpi_find_gpio.__UNIQUE_ID_ddebug478          56       -     -56
> acpi_dev_gpio_irq_wake_get_by.__UNIQUE_ID_ddebug480      56       -     -56
> acpi_find_gpio                               354     216    -138
> acpi_get_gpiod_by_index                      462     307    -155
> __acpi_find_gpio                             877     638    -239
> acpi_dev_gpio_irq_wake_get_by                695     129    -566
> Total: Before=15375, After=14154, chg -7.94%
>
> In v2:
> - renamed par to params (Mika, Bart)
>
> Andy Shevchenko (6):
>   gpiolib: acpi: Improve struct acpi_gpio_info memory footprint
>   gpiolib: acpi: Remove index parameter from acpi_gpio_property_lookup()
>   gpiolib: acpi: Reduce memory footprint for struct acpi_gpio_params
>   gpiolib: acpi: Rename par to params for better readability
>   gpiolib: acpi: Reuse struct acpi_gpio_params in struct
>     acpi_gpio_lookup
>   gpiolib: acpi: Deduplicate some code in __acpi_find_gpio()
>
>  drivers/gpio/gpiolib-acpi.c   | 146 +++++++++++++++++-----------------
>  include/linux/gpio/consumer.h |   2 +-
>  2 files changed, 72 insertions(+), 76 deletions(-)
>
> --
> 2.47.2
>

Will you take it through your tree or do you want me to pick it up next week?

Bart
Re: [PATCH v2 0/6] gpiolib: acpi: Refactor to shrink the code by ~8%
Posted by Andy Shevchenko 6 days, 8 hours ago
On Fri, Apr 04, 2025 at 10:38:04AM +0200, Bartosz Golaszewski wrote:

...

> Will you take it through your tree or do you want me to pick it up next week?

Via my tree as usual.

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v2 0/6] gpiolib: acpi: Refactor to shrink the code by ~8%
Posted by Mika Westerberg 6 days, 14 hours ago
On Thu, Apr 03, 2025 at 06:59:11PM +0300, Andy Shevchenko wrote:
> A simple refactoring of the GPIO ACPI library parts to get an impressive
> ~8% code shrink on x86_64 and ~2% on x86_32. Also reduces a C code a bit.
> 
> add/remove: 0/2 grow/shrink: 0/5 up/down: 0/-1221 (-1221)
> Function                                     old     new   delta
> acpi_gpio_property_lookup                    425     414     -11
> acpi_find_gpio.__UNIQUE_ID_ddebug478          56       -     -56
> acpi_dev_gpio_irq_wake_get_by.__UNIQUE_ID_ddebug480      56       -     -56
> acpi_find_gpio                               354     216    -138
> acpi_get_gpiod_by_index                      462     307    -155
> __acpi_find_gpio                             877     638    -239
> acpi_dev_gpio_irq_wake_get_by                695     129    -566
> Total: Before=15375, After=14154, chg -7.94%
> 
> In v2:
> - renamed par to params (Mika, Bart)
> 
> Andy Shevchenko (6):
>   gpiolib: acpi: Improve struct acpi_gpio_info memory footprint
>   gpiolib: acpi: Remove index parameter from acpi_gpio_property_lookup()
>   gpiolib: acpi: Reduce memory footprint for struct acpi_gpio_params
>   gpiolib: acpi: Rename par to params for better readability
>   gpiolib: acpi: Reuse struct acpi_gpio_params in struct
>     acpi_gpio_lookup
>   gpiolib: acpi: Deduplicate some code in __acpi_find_gpio()

Looks good now,

Acked-by: Mika Westerberg <westeri@kernel.org>
Re: [PATCH v2 0/6] gpiolib: acpi: Refactor to shrink the code by ~8%
Posted by Andy Shevchenko 3 days, 12 hours ago
On Fri, Apr 04, 2025 at 07:43:18AM +0300, Mika Westerberg wrote:
> On Thu, Apr 03, 2025 at 06:59:11PM +0300, Andy Shevchenko wrote:
> > A simple refactoring of the GPIO ACPI library parts to get an impressive
> > ~8% code shrink on x86_64 and ~2% on x86_32. Also reduces a C code a bit.
> > 
> > add/remove: 0/2 grow/shrink: 0/5 up/down: 0/-1221 (-1221)
> > Function                                     old     new   delta
> > acpi_gpio_property_lookup                    425     414     -11
> > acpi_find_gpio.__UNIQUE_ID_ddebug478          56       -     -56
> > acpi_dev_gpio_irq_wake_get_by.__UNIQUE_ID_ddebug480      56       -     -56
> > acpi_find_gpio                               354     216    -138
> > acpi_get_gpiod_by_index                      462     307    -155
> > __acpi_find_gpio                             877     638    -239
> > acpi_dev_gpio_irq_wake_get_by                695     129    -566
> > Total: Before=15375, After=14154, chg -7.94%

> Looks good now,
> 
> Acked-by: Mika Westerberg <westeri@kernel.org>


Pushed to my review and testing queue, thanks!

-- 
With Best Regards,
Andy Shevchenko