gpiolib: acpi: Improve IRQ labeling
cover gpiolib: acpi: Improve IRQ labeling
The IRQ labeling now is quite ambiguous, improve it here.
Andy Shevchenko (2):
gpiolib: acpi: Add fwnode name to the GPIO interrupt label
gpiolib: acpi: Set label for IRQ only lines
drivers/gpio/gpiolib-acpi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
PATCH 1/2 gpiolib: acpi: Add fwnode name to the GPIO interrupt label
It's ambiguous to have a device-related index in the GPIO interrupt label as most of the devices will have it the same or very similar. Extend label with fwnode name for better granularity. It significantly reduces the scope of searching among devices.
--- drivers/gpio/gpiolib-acpi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpio/gpiolib-acpi.c +3 -2
@@ -1035,6 +1035,7 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,int acpi_dev_gpio_irq_wake_get_by (struct acpi_device *adev,const char *con_id,int index,bool *wake_capable) { +struct fwnode_handle *fwnode =acpi_fwnode_handle (adev);int idx, i;unsigned int irq_flags;int ret;
@@ -1044,7 +1045,7 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id,struct gpio_desc *desc;/* Ignore -EPROBE_DEFER, it only matters if idx matches */ - desc =__acpi_find_gpio (acpi_fwnode_handle (adev), con_id, i, true, &info); + desc =__acpi_find_gpio (fwnode, con_id, i, true, &info);if (IS_ERR (desc) &&PTR_ERR (desc) != -EPROBE_DEFER )return PTR_ERR (desc);
@@ -1064,7 +1065,7 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id,acpi_gpio_update_gpiod_flags (&dflags, &info);acpi_gpio_update_gpiod_lookup_flags (&lflags, &info); -snprintf (label,sizeof (label),"GpioInt() %d" , index); +snprintf (label,sizeof (label),"%pfwP GpioInt(%d)" , fwnode, index); ret =gpiod_configure_flags (desc, label, lflags, dflags);if (ret <0 )return ret;
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Re: [PATCH v1 1/2] gpiolib: acpi: Add fwnode name to the GPIO interrupt label
Quoted 4 lines · Andy Shevchenko
It's ambiguous to have a device-related index in the GPIO interrupt label as most of the devices will have it the same or very similar. Extend label with fwnode name for better granularity. It significantly reduces the scope of searching among devices.
Can you add an example here how it looks like before and after the patch?
Quoted 38 lines
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/gpio/gpiolib-acpi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/gpio/gpiolib-acpi.c +3
-2@@ -1035,6 +1035,7 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,int acpi_dev_gpio_irq_wake_get_by (struct acpi_device *adev,const char *con_id,int index,bool *wake_capable) { +struct fwnode_handle *fwnode =acpi_fwnode_handle (adev);int idx, i;unsigned int irq_flags;int ret;@@ -1044,7 +1045,7 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id,struct gpio_desc *desc;/* Ignore -EPROBE_DEFER, it only matters if idx matches */ - desc =__acpi_find_gpio (acpi_fwnode_handle (adev), con_id, i, true, &info); + desc =__acpi_find_gpio (fwnode, con_id, i, true, &info);if (IS_ERR (desc) &&PTR_ERR (desc) != -EPROBE_DEFER )return PTR_ERR (desc);@@ -1064,7 +1065,7 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id,acpi_gpio_update_gpiod_flags (&dflags, &info);acpi_gpio_update_gpiod_lookup_flags (&lflags, &info); -snprintf (label,sizeof (label),"GpioInt() %d" , index); +snprintf (label,sizeof (label),"%pfwP GpioInt(%d)" , fwnode, index); ret =gpiod_configure_flags (desc, label, lflags, dflags);if (ret <0 )return ret;Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Re: [PATCH v1 1/2] gpiolib: acpi: Add fwnode name to the GPIO interrupt label
Quoted 8 lines · Mika Westerberg
Quoted 4 lines · Andy Shevchenko
It's ambiguous to have a device-related index in the GPIO interrupt label as most of the devices will have it the same or very similar. Extend label with fwnode name for better granularity. It significantly reduces the scope of searching among devices.
Can you add an example here how it looks like before and after the patch?
Sure:
Before:
GpioInt() 0
GpioInt() 0
After:
NIO1 GpioInt(0)
URT0 GpioInt(0)
Assuming I update this when applying, can you give your tag?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Mika Westerberg
Acked-byRe: [PATCH v1 1/2] gpiolib: acpi: Add fwnode name to the GPIO interrupt label
Quoted 17 lines · Andy Shevchenko
Quoted 8 lines · Mika Westerberg
Quoted 4 lines · Andy Shevchenko
It's ambiguous to have a device-related index in the GPIO interrupt label as most of the devices will have it the same or very similar. Extend label with fwnode name for better granularity. It significantly reduces the scope of searching among devices.
Can you add an example here how it looks like before and after the patch?
Sure:
Before:
GpioInt()0
GpioInt()0
Quoted 6 lines
After:
NIO1 GpioInt(0)
URT0 GpioInt(0)Assuming I update this when applying, can you give your tag?
Sure. For both,
Re: [PATCH v1 1/2] gpiolib: acpi: Add fwnode name to the GPIO interrupt label
Quoted 20 lines · Mika Westerberg
Quoted 19 lines · Andy Shevchenko
Quoted 8 lines · Mika Westerberg
Quoted 4 lines · Andy Shevchenko
It's ambiguous to have a device-related index in the GPIO interrupt label as most of the devices will have it the same or very similar. Extend label with fwnode name for better granularity. It significantly reduces the scope of searching among devices.
Can you add an example here how it looks like before and after the patch?
Sure:
Before:
GpioInt()0
GpioInt()0After:
Quoted 8 lines
Quoted 4 lines
NIO1 GpioInt(0)
URT0 GpioInt(0)Assuming I update this when applying, can you give your tag?
Sure. For both,
Acked-by Mika Westerberg <[email protected]>
Pushed to my review and testing queue, thanks!
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 2/2 gpiolib: acpi: Set label for IRQ only lines
In reply to Andy ShevchenkoWhen line locked as IRQ it has no label assigned. Assign the meaningful value to it.
--- drivers/gpio/gpiolib-acpi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpio/gpiolib-acpi.c +4 -0
@@ -1066,6 +1066,10 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id,acpi_gpio_update_gpiod_lookup_flags (&lflags, &info);snprintf (label,sizeof (label),"%pfwP GpioInt(%d)" , fwnode, index); + ret =gpiod_set_consumer_name (desc, con_id ?: label); +if (ret) +return ret; + ret =gpiod_configure_flags (desc, label, lflags, dflags);if (ret <0 )return ret;
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Re: [PATCH v1 2/2] gpiolib: acpi: Set label for IRQ only lines
Quoted 2 lines · Andy Shevchenko
When line locked as IRQ it has no label assigned. Assign the meaningful value to it.
Same here.
Quoted 23 lines
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/gpio/gpiolib-acpi.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpio/gpiolib-acpi.c +4
-0@@ -1066,6 +1066,10 @@ int acpi_dev_gpio_irq_wake_get_by(struct acpi_device *adev, const char *con_id,acpi_gpio_update_gpiod_lookup_flags (&lflags, &info);snprintf (label,sizeof (label),"%pfwP GpioInt(%d)" , fwnode, index); + ret =gpiod_set_consumer_name (desc, con_id ?: label); +if (ret) +return ret; + ret =gpiod_configure_flags (desc, label, lflags, dflags);if (ret <0 )return ret;Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Re: [PATCH v1 2/2] gpiolib: acpi: Set label for IRQ only lines
Quoted 5 lines · Mika Westerberg
Quoted 2 lines · Andy Shevchenko
When line locked as IRQ it has no label assigned. Assign the meaningful value to it.
Same here.
Same answer as in the first reply.
Signature · 2 lines
With Best Regards, Andy Shevchenko