* [PATCH 1/6] irqchip/bcm2836: Fix return check in IPI alloc
@ 2021-01-02 17:58 Adam Lackorzynski
2021-01-02 17:58 ` [PATCH 2/6] irqchip/armada-370-xp: " Adam Lackorzynski
` (4 more replies)
0 siblings, 5 replies; 11+ messages in thread
From: Adam Lackorzynski @ 2021-01-02 17:58 UTC (permalink / raw)
To: maz, tglx
Cc: linux-arm-kernel, linusw, kaloz, khalasa, andrew,
gregory.clement, sebastian.hesselbarth, linux-gpio, bgolaszewski
__irq_domain_alloc_irqs returns a negative error
code upon failure, not only 0. Also use irq_domain_alloc_irqs
to require less default arguments.
Signed-off-by: Adam Lackorzynski <adam@l4re.org>
---
drivers/irqchip/irq-bcm2836.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c
index 5f5eb8877c41..e5878eadf90b 100644
--- a/drivers/irqchip/irq-bcm2836.c
+++ b/drivers/irqchip/irq-bcm2836.c
@@ -268,11 +268,10 @@ static void __init bcm2836_arm_irqchip_smp_init(void)
ipi_domain->flags |= IRQ_DOMAIN_FLAG_IPI_SINGLE;
irq_domain_update_bus_token(ipi_domain, DOMAIN_BUS_IPI);
- base_ipi = __irq_domain_alloc_irqs(ipi_domain, -1, BITS_PER_MBOX,
- NUMA_NO_NODE, NULL,
- false, NULL);
+ base_ipi = irq_domain_alloc_irqs(ipi_domain, BITS_PER_MBOX,
+ NUMA_NO_NODE, NULL);
- if (WARN_ON(!base_ipi))
+ if (WARN_ON(base_ipi <= 0))
return;
set_smp_ipi_range(base_ipi, BITS_PER_MBOX);
--
2.30.0.rc2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/6] irqchip/armada-370-xp: Fix return check in IPI alloc
2021-01-02 17:58 [PATCH 1/6] irqchip/bcm2836: Fix return check in IPI alloc Adam Lackorzynski
@ 2021-01-02 17:58 ` Adam Lackorzynski
2021-01-02 18:24 ` Andrew Lunn
2021-01-02 17:58 ` [PATCH 3/6] irqdomain/msi: Fix return check of __irq_domain_alloc_irqs Adam Lackorzynski
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Adam Lackorzynski @ 2021-01-02 17:58 UTC (permalink / raw)
To: maz, tglx
Cc: linux-arm-kernel, linusw, kaloz, khalasa, andrew,
gregory.clement, sebastian.hesselbarth, linux-gpio, bgolaszewski
__irq_domain_alloc_irqs returns a negative error
code upon failure, not only 0. Also use irq_domain_alloc_irqs
to require less default arguments.
Signed-off-by: Adam Lackorzynski <adam@l4re.org>
---
drivers/irqchip/irq-armada-370-xp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 32938dfc0e46..b5e3aacdc2d1 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -430,9 +430,9 @@ static __init void armada_xp_ipi_init(struct device_node *node)
return;
irq_domain_update_bus_token(ipi_domain, DOMAIN_BUS_IPI);
- base_ipi = __irq_domain_alloc_irqs(ipi_domain, -1, IPI_DOORBELL_END,
- NUMA_NO_NODE, NULL, false, NULL);
- if (WARN_ON(!base_ipi))
+ base_ipi = irq_domain_alloc_irqs(ipi_domain, IPI_DOORBELL_END,
+ NUMA_NO_NODE, NULL);
+ if (WARN_ON(base_ipi <= 0))
return;
set_smp_ipi_range(base_ipi, IPI_DOORBELL_END);
--
2.30.0.rc2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/6] irqdomain/msi: Fix return check of __irq_domain_alloc_irqs
2021-01-02 17:58 [PATCH 1/6] irqchip/bcm2836: Fix return check in IPI alloc Adam Lackorzynski
2021-01-02 17:58 ` [PATCH 2/6] irqchip/armada-370-xp: " Adam Lackorzynski
@ 2021-01-02 17:58 ` Adam Lackorzynski
2021-01-02 17:58 ` [PATCH 4/6] irqchip/ixp4xx: " Adam Lackorzynski
` (2 subsequent siblings)
4 siblings, 0 replies; 11+ messages in thread
From: Adam Lackorzynski @ 2021-01-02 17:58 UTC (permalink / raw)
To: maz, tglx
Cc: linux-arm-kernel, linusw, kaloz, khalasa, andrew,
gregory.clement, sebastian.hesselbarth, linux-gpio, bgolaszewski
0 is not a proper IRQ number and also indicates failure.
Signed-off-by: Adam Lackorzynski <adam@l4re.org>
---
kernel/irq/msi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index 2c0c4d6d0f83..e1fe832e7161 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -416,7 +416,7 @@ int __msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev,
virq = __irq_domain_alloc_irqs(domain, -1, desc->nvec_used,
dev_to_node(dev), &arg, false,
desc->affinity);
- if (virq < 0) {
+ if (virq <= 0) {
ret = -ENOSPC;
if (ops->handle_error)
ret = ops->handle_error(domain, desc, ret);
--
2.30.0.rc2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/6] irqchip/ixp4xx: Fix return check of __irq_domain_alloc_irqs
2021-01-02 17:58 [PATCH 1/6] irqchip/bcm2836: Fix return check in IPI alloc Adam Lackorzynski
2021-01-02 17:58 ` [PATCH 2/6] irqchip/armada-370-xp: " Adam Lackorzynski
2021-01-02 17:58 ` [PATCH 3/6] irqdomain/msi: Fix return check of __irq_domain_alloc_irqs Adam Lackorzynski
@ 2021-01-02 17:58 ` Adam Lackorzynski
2021-01-02 17:58 ` [PATCH 5/6] gpiolib: " Adam Lackorzynski
2021-01-02 17:58 ` [PATCH 6/6] x86/ioapic: " Adam Lackorzynski
4 siblings, 0 replies; 11+ messages in thread
From: Adam Lackorzynski @ 2021-01-02 17:58 UTC (permalink / raw)
To: maz, tglx
Cc: linux-arm-kernel, linusw, kaloz, khalasa, andrew,
gregory.clement, sebastian.hesselbarth, linux-gpio, bgolaszewski
0 is not a proper IRQ number and also indicates failure.
Signed-off-by: Adam Lackorzynski <adam@l4re.org>
---
drivers/irqchip/irq-ixp4xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-ixp4xx.c b/drivers/irqchip/irq-ixp4xx.c
index 37e0749215c7..54dcffe2309f 100644
--- a/drivers/irqchip/irq-ixp4xx.c
+++ b/drivers/irqchip/irq-ixp4xx.c
@@ -355,7 +355,7 @@ void __init ixp4xx_irq_init(resource_size_t irqbase,
&fwspec,
false,
NULL);
- if (ret < 0) {
+ if (ret <= 0) {
pr_crit("IXP4XX: can not allocate irqs in hierarchy %d\n",
ret);
return;
--
2.30.0.rc2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 5/6] gpiolib: Fix return check of __irq_domain_alloc_irqs
2021-01-02 17:58 [PATCH 1/6] irqchip/bcm2836: Fix return check in IPI alloc Adam Lackorzynski
` (2 preceding siblings ...)
2021-01-02 17:58 ` [PATCH 4/6] irqchip/ixp4xx: " Adam Lackorzynski
@ 2021-01-02 17:58 ` Adam Lackorzynski
2021-01-04 13:57 ` Bartosz Golaszewski
2021-01-04 15:00 ` Andy Shevchenko
2021-01-02 17:58 ` [PATCH 6/6] x86/ioapic: " Adam Lackorzynski
4 siblings, 2 replies; 11+ messages in thread
From: Adam Lackorzynski @ 2021-01-02 17:58 UTC (permalink / raw)
To: maz, tglx
Cc: linux-arm-kernel, linusw, kaloz, khalasa, andrew,
gregory.clement, sebastian.hesselbarth, linux-gpio, bgolaszewski
0 is not a proper IRQ number and also indicates failure.
Signed-off-by: Adam Lackorzynski <adam@l4re.org>
---
drivers/gpio/gpiolib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index b02cc2abd3b6..9667e1a62626 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1003,7 +1003,7 @@ static void gpiochip_set_hierarchical_irqchip(struct gpio_chip *gc,
&fwspec,
false,
NULL);
- if (ret < 0) {
+ if (ret <= 0) {
chip_err(gc,
"can not allocate irq for GPIO line %d parent hwirq %d in hierarchy domain: %d\n",
i, parent_hwirq,
--
2.30.0.rc2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 6/6] x86/ioapic: Fix return check of __irq_domain_alloc_irqs
2021-01-02 17:58 [PATCH 1/6] irqchip/bcm2836: Fix return check in IPI alloc Adam Lackorzynski
` (3 preceding siblings ...)
2021-01-02 17:58 ` [PATCH 5/6] gpiolib: " Adam Lackorzynski
@ 2021-01-02 17:58 ` Adam Lackorzynski
2021-01-27 12:03 ` Thomas Gleixner
4 siblings, 1 reply; 11+ messages in thread
From: Adam Lackorzynski @ 2021-01-02 17:58 UTC (permalink / raw)
To: maz, tglx
Cc: linux-arm-kernel, linusw, kaloz, khalasa, andrew,
gregory.clement, sebastian.hesselbarth, linux-gpio, bgolaszewski
0 is not a proper IRQ number and also indicates failure.
Also check for this case in upwards functions.
Signed-off-by: Adam Lackorzynski <adam@l4re.org>
---
arch/x86/kernel/apic/io_apic.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index e4ab4804b20d..8ae46a092c88 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1007,7 +1007,7 @@ static int alloc_isa_irq_from_domain(struct irq_domain *domain,
info->flags |= X86_IRQ_ALLOC_LEGACY;
irq = __irq_domain_alloc_irqs(domain, irq, 1, node, info, true,
NULL);
- if (irq >= 0) {
+ if (irq > 0) {
irq_data = irq_domain_get_irq_data(domain, irq);
data = irq_data->chip_data;
data->isa_irq = true;
@@ -1050,10 +1050,11 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin,
irq = alloc_irq_from_domain(domain, ioapic, gsi, &tmp);
else if (!mp_check_pin_attr(irq, &tmp))
irq = -EBUSY;
- if (irq >= 0) {
+ if (irq > 0) {
data = irq_get_chip_data(irq);
data->count++;
- }
+ } else if (irq == 0)
+ irq = -ENOENT;
}
mutex_unlock(&ioapic_mutex);
--
2.30.0.rc2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/6] irqchip/armada-370-xp: Fix return check in IPI alloc
2021-01-02 17:58 ` [PATCH 2/6] irqchip/armada-370-xp: " Adam Lackorzynski
@ 2021-01-02 18:24 ` Andrew Lunn
0 siblings, 0 replies; 11+ messages in thread
From: Andrew Lunn @ 2021-01-02 18:24 UTC (permalink / raw)
To: Adam Lackorzynski
Cc: maz, tglx, linux-arm-kernel, linusw, kaloz, khalasa,
gregory.clement, sebastian.hesselbarth, linux-gpio, bgolaszewski
On Sat, Jan 02, 2021 at 06:58:55PM +0100, Adam Lackorzynski wrote:
> __irq_domain_alloc_irqs returns a negative error
> code upon failure, not only 0. Also use irq_domain_alloc_irqs
> to require less default arguments.
>
> Signed-off-by: Adam Lackorzynski <adam@l4re.org>
Fixes: f02147dd02eb ("irqchip/armada-370-xp: Configure IPIs as standard interrupts")
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 5/6] gpiolib: Fix return check of __irq_domain_alloc_irqs
2021-01-02 17:58 ` [PATCH 5/6] gpiolib: " Adam Lackorzynski
@ 2021-01-04 13:57 ` Bartosz Golaszewski
2021-01-04 14:43 ` Adam Lackorzynski
2021-01-04 15:00 ` Andy Shevchenko
1 sibling, 1 reply; 11+ messages in thread
From: Bartosz Golaszewski @ 2021-01-04 13:57 UTC (permalink / raw)
To: Adam Lackorzynski
Cc: Marc Zyngier, Thomas Gleixner, arm-soc, linusw, Imre Kaloz,
Krzysztof Halasa, Andrew Lunn, Gregory Clement,
Sebastian Hesselbarth, linux-gpio
On Sat, Jan 2, 2021 at 6:59 PM Adam Lackorzynski <adam@l4re.org> wrote:
>
> 0 is not a proper IRQ number and also indicates failure.
>
> Signed-off-by: Adam Lackorzynski <adam@l4re.org>
> ---
> drivers/gpio/gpiolib.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index b02cc2abd3b6..9667e1a62626 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -1003,7 +1003,7 @@ static void gpiochip_set_hierarchical_irqchip(struct gpio_chip *gc,
> &fwspec,
> false,
> NULL);
> - if (ret < 0) {
> + if (ret <= 0) {
> chip_err(gc,
> "can not allocate irq for GPIO line %d parent hwirq %d in hierarchy domain: %d\n",
> i, parent_hwirq,
> --
> 2.30.0.rc2
>
Hi Adam,
Does this commit depend in any way on others in this series or can I
apply it directly for fixes?
Bart
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 5/6] gpiolib: Fix return check of __irq_domain_alloc_irqs
2021-01-04 13:57 ` Bartosz Golaszewski
@ 2021-01-04 14:43 ` Adam Lackorzynski
0 siblings, 0 replies; 11+ messages in thread
From: Adam Lackorzynski @ 2021-01-04 14:43 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Marc Zyngier, Thomas Gleixner, arm-soc, linusw, Imre Kaloz,
Krzysztof Halasa, Andrew Lunn, Gregory Clement,
Sebastian Hesselbarth, linux-gpio
Hi,
On Mon Jan 04, 2021 at 14:57:31 +0100, Bartosz Golaszewski wrote:
> On Sat, Jan 2, 2021 at 6:59 PM Adam Lackorzynski <adam@l4re.org> wrote:
> >
> > 0 is not a proper IRQ number and also indicates failure.
> >
> > Signed-off-by: Adam Lackorzynski <adam@l4re.org>
> > ---
> > drivers/gpio/gpiolib.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> > index b02cc2abd3b6..9667e1a62626 100644
> > --- a/drivers/gpio/gpiolib.c
> > +++ b/drivers/gpio/gpiolib.c
> > @@ -1003,7 +1003,7 @@ static void gpiochip_set_hierarchical_irqchip(struct gpio_chip *gc,
> > &fwspec,
> > false,
> > NULL);
> > - if (ret < 0) {
> > + if (ret <= 0) {
> > chip_err(gc,
> > "can not allocate irq for GPIO line %d parent hwirq %d in hierarchy domain: %d\n",
> > i, parent_hwirq,
> > --
> > 2.30.0.rc2
> >
>
> Does this commit depend in any way on others in this series or can I
> apply it directly for fixes?
It is independent, you can directly apply it.
Thanks, Adam
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 5/6] gpiolib: Fix return check of __irq_domain_alloc_irqs
2021-01-02 17:58 ` [PATCH 5/6] gpiolib: " Adam Lackorzynski
2021-01-04 13:57 ` Bartosz Golaszewski
@ 2021-01-04 15:00 ` Andy Shevchenko
1 sibling, 0 replies; 11+ messages in thread
From: Andy Shevchenko @ 2021-01-04 15:00 UTC (permalink / raw)
To: Adam Lackorzynski
Cc: Marc Zyngier, Thomas Gleixner, linux-arm Mailing List,
Linus Walleij, kaloz, khalasa, Andrew Lunn, Gregory Clement,
Sebastian Hesselbarth, open list:GPIO SUBSYSTEM,
Bartosz Golaszewski
On Sat, Jan 2, 2021 at 8:24 PM Adam Lackorzynski <adam@l4re.org> wrote:
>
> 0 is not a proper IRQ number and also indicates failure.
Hmm... While in this case it's perhaps okay, this does not work in
general since the function can take irq_base == 0 and realloc == true.
So if we want to have a code that somebody may reuse better not to do
this (we never get 0 from this function).
In my humble opinion NAK.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 6/6] x86/ioapic: Fix return check of __irq_domain_alloc_irqs
2021-01-02 17:58 ` [PATCH 6/6] x86/ioapic: " Adam Lackorzynski
@ 2021-01-27 12:03 ` Thomas Gleixner
0 siblings, 0 replies; 11+ messages in thread
From: Thomas Gleixner @ 2021-01-27 12:03 UTC (permalink / raw)
To: Adam Lackorzynski, maz
Cc: linux-arm-kernel, linusw, kaloz, khalasa, andrew,
gregory.clement, sebastian.hesselbarth, linux-gpio, bgolaszewski
On Sat, Jan 02 2021 at 18:58, Adam Lackorzynski wrote:
> 0 is not a proper IRQ number and also indicates failure.
> Also check for this case in upwards functions.
0 is a valid irq number for historical reasons on x86. So no.
Thanks,
tglx
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-01-27 12:06 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-02 17:58 [PATCH 1/6] irqchip/bcm2836: Fix return check in IPI alloc Adam Lackorzynski
2021-01-02 17:58 ` [PATCH 2/6] irqchip/armada-370-xp: " Adam Lackorzynski
2021-01-02 18:24 ` Andrew Lunn
2021-01-02 17:58 ` [PATCH 3/6] irqdomain/msi: Fix return check of __irq_domain_alloc_irqs Adam Lackorzynski
2021-01-02 17:58 ` [PATCH 4/6] irqchip/ixp4xx: " Adam Lackorzynski
2021-01-02 17:58 ` [PATCH 5/6] gpiolib: " Adam Lackorzynski
2021-01-04 13:57 ` Bartosz Golaszewski
2021-01-04 14:43 ` Adam Lackorzynski
2021-01-04 15:00 ` Andy Shevchenko
2021-01-02 17:58 ` [PATCH 6/6] x86/ioapic: " Adam Lackorzynski
2021-01-27 12:03 ` Thomas Gleixner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).