2013-04-19 13:41:14

by Andreas Fenkart

[permalink] [raw]
Subject: [PATCH] genirq: use irq_mask as fallback for irq_disable.

This is in line with irq_enable that uses the same fallback.
When masked, interrupts are still latched into the status register
so when unmasked there is an interrupt straight away.

Signed-off-by: Andreas Fenkart <[email protected]>
---
kernel/irq/chip.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index cbd97ce..21f87b7 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -216,10 +216,11 @@ void irq_enable(struct irq_desc *desc)
void irq_disable(struct irq_desc *desc)
{
irq_state_set_disabled(desc);
- if (desc->irq_data.chip->irq_disable) {
+ if (desc->irq_data.chip->irq_disable)
desc->irq_data.chip->irq_disable(&desc->irq_data);
- irq_state_set_masked(desc);
- }
+ else
+ desc->irq_data.chip->irq_mask(&desc->irq_data);
+ irq_state_set_masked(desc);
}

void irq_percpu_enable(struct irq_desc *desc, unsigned int cpu)
--
1.7.10.4


2013-04-22 23:24:12

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] genirq: use irq_mask as fallback for irq_disable.

On Fri, 19 Apr 2013 15:41:02 +0200 Andreas Fenkart <[email protected]> wrote:

> This is in line with irq_enable that uses the same fallback.
> When masked, interrupts are still latched into the status register
> so when unmasked there is an interrupt straight away.
>
> ...
>
> --- a/kernel/irq/chip.c
> +++ b/kernel/irq/chip.c
> @@ -216,10 +216,11 @@ void irq_enable(struct irq_desc *desc)
> void irq_disable(struct irq_desc *desc)
> {
> irq_state_set_disabled(desc);
> - if (desc->irq_data.chip->irq_disable) {
> + if (desc->irq_data.chip->irq_disable)
> desc->irq_data.chip->irq_disable(&desc->irq_data);
> - irq_state_set_masked(desc);
> - }
> + else
> + desc->irq_data.chip->irq_mask(&desc->irq_data);
> + irq_state_set_masked(desc);
> }
>
> void irq_percpu_enable(struct irq_desc *desc, unsigned int cpu)

Well I hope Thomas knows what this patch does, because I sure don't.

Does it fix a bug? Does it add a bug? Does it have any
runtime-observable effects at all? If so, what are they?

2013-04-23 12:46:21

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [PATCH] genirq: use irq_mask as fallback for irq_disable.

On Mon, 22 Apr 2013, Andrew Morton wrote:

> On Fri, 19 Apr 2013 15:41:02 +0200 Andreas Fenkart <[email protected]> wrote:
>
> > This is in line with irq_enable that uses the same fallback.
> > When masked, interrupts are still latched into the status register
> > so when unmasked there is an interrupt straight away.
> >
> > ...
> >
> > --- a/kernel/irq/chip.c
> > +++ b/kernel/irq/chip.c
> > @@ -216,10 +216,11 @@ void irq_enable(struct irq_desc *desc)
> > void irq_disable(struct irq_desc *desc)
> > {
> > irq_state_set_disabled(desc);
> > - if (desc->irq_data.chip->irq_disable) {
> > + if (desc->irq_data.chip->irq_disable)
> > desc->irq_data.chip->irq_disable(&desc->irq_data);
> > - irq_state_set_masked(desc);
> > - }
> > + else
> > + desc->irq_data.chip->irq_mask(&desc->irq_data);
> > + irq_state_set_masked(desc);
> > }
> >
> > void irq_percpu_enable(struct irq_desc *desc, unsigned int cpu)
>
> Well I hope Thomas knows what this patch does, because I sure don't.

I know what it does, but the changelog is completely useless.

> Does it fix a bug? Does it add a bug? Does it have any
> runtime-observable effects at all? If so, what are they?

It fixes a state inconsistency. Have to think about observable
effects.

Thanks

tglx