The pending set and mask_ack_irq() repeated twice, a new goto label can
reduce a few lines of code, with no functional changes.
Signed-off-by: Jinjie Ruan <[email protected]>
---
kernel/irq/chip.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 638cf5eee04b..4613dc9ff6b6 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -775,21 +775,15 @@ void handle_edge_irq(struct irq_desc *desc)
desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
- if (!irq_may_run(desc)) {
- desc->istate |= IRQS_PENDING;
- mask_ack_irq(desc);
- goto out_unlock;
- }
+ if (!irq_may_run(desc))
+ goto out_mask_ack;
/*
* If its disabled or no action available then mask it and get
* out of here.
*/
- if (irqd_irq_disabled(&desc->irq_data) || !desc->action) {
- desc->istate |= IRQS_PENDING;
- mask_ack_irq(desc);
- goto out_unlock;
- }
+ if (irqd_irq_disabled(&desc->irq_data) || !desc->action)
+ goto out_mask_ack;
kstat_incr_irqs_this_cpu(desc);
@@ -818,6 +812,9 @@ void handle_edge_irq(struct irq_desc *desc)
} while ((desc->istate & IRQS_PENDING) &&
!irqd_irq_disabled(&desc->irq_data));
+out_mask_ack:
+ desc->istate |= IRQS_PENDING;
+ mask_ack_irq(desc);
out_unlock:
raw_spin_unlock(&desc->lock);
}
--
2.34.1
On 2024/5/14 21:09, Jinjie Ruan wrote:
> The pending set and mask_ack_irq() repeated twice, a new goto label can
> reduce a few lines of code, with no functional changes.
>
> Signed-off-by: Jinjie Ruan <[email protected]>
> ---
> kernel/irq/chip.c | 17 +++++++----------
> 1 file changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
> index 638cf5eee04b..4613dc9ff6b6 100644
> --- a/kernel/irq/chip.c
> +++ b/kernel/irq/chip.c
> @@ -775,21 +775,15 @@ void handle_edge_irq(struct irq_desc *desc)
>
> desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
>
> - if (!irq_may_run(desc)) {
> - desc->istate |= IRQS_PENDING;
> - mask_ack_irq(desc);
> - goto out_unlock;
> - }
> + if (!irq_may_run(desc))
> + goto out_mask_ack;
>
> /*
> * If its disabled or no action available then mask it and get
> * out of here.
> */
> - if (irqd_irq_disabled(&desc->irq_data) || !desc->action) {
> - desc->istate |= IRQS_PENDING;
> - mask_ack_irq(desc);
> - goto out_unlock;
> - }
> + if (irqd_irq_disabled(&desc->irq_data) || !desc->action)
> + goto out_mask_ack;
>
> kstat_incr_irqs_this_cpu(desc);
>
> @@ -818,6 +812,9 @@ void handle_edge_irq(struct irq_desc *desc)
> } while ((desc->istate & IRQS_PENDING) &&
> !irqd_irq_disabled(&desc->irq_data));
>
> +out_mask_ack:
> + desc->istate |= IRQS_PENDING;
> + mask_ack_irq(desc);
Please ignore this patch, this is a generic export and should not be
used as such.
> out_unlock:
> raw_spin_unlock(&desc->lock);
> }