Skip to content

Commit 69ffab9

Browse files
jcmvbkbcKAGA-KOKO
authored andcommitted
irqchip/irq-xtensa-pic: Clean up
- get rid of the cached_irq_mask variable - use BIT() macro instead of bit shifts - drop .disable and .enable as they are equivalent to the default implementations Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20231208163857.82644-1-jcmvbkbc@gmail.com
1 parent 221b110 commit 69ffab9

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

drivers/irqchip/irq-xtensa-pic.c

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212
* Kevin Chea
1313
*/
1414

15+
#include <linux/bits.h>
1516
#include <linux/interrupt.h>
1617
#include <linux/irqdomain.h>
1718
#include <linux/irq.h>
1819
#include <linux/irqchip.h>
1920
#include <linux/irqchip/xtensa-pic.h>
2021
#include <linux/of.h>
2122

22-
unsigned int cached_irq_mask;
23-
2423
/*
2524
* Device Tree IRQ specifier translation function which works with one or
2625
* two cell bindings. First cell value maps directly to the hwirq number.
@@ -44,34 +43,30 @@ static const struct irq_domain_ops xtensa_irq_domain_ops = {
4443

4544
static void xtensa_irq_mask(struct irq_data *d)
4645
{
47-
cached_irq_mask &= ~(1 << d->hwirq);
48-
xtensa_set_sr(cached_irq_mask, intenable);
49-
}
46+
u32 irq_mask;
5047

51-
static void xtensa_irq_unmask(struct irq_data *d)
52-
{
53-
cached_irq_mask |= 1 << d->hwirq;
54-
xtensa_set_sr(cached_irq_mask, intenable);
48+
irq_mask = xtensa_get_sr(intenable);
49+
irq_mask &= ~BIT(d->hwirq);
50+
xtensa_set_sr(irq_mask, intenable);
5551
}
5652

57-
static void xtensa_irq_enable(struct irq_data *d)
53+
static void xtensa_irq_unmask(struct irq_data *d)
5854
{
59-
xtensa_irq_unmask(d);
60-
}
55+
u32 irq_mask;
6156

62-
static void xtensa_irq_disable(struct irq_data *d)
63-
{
64-
xtensa_irq_mask(d);
57+
irq_mask = xtensa_get_sr(intenable);
58+
irq_mask |= BIT(d->hwirq);
59+
xtensa_set_sr(irq_mask, intenable);
6560
}
6661

6762
static void xtensa_irq_ack(struct irq_data *d)
6863
{
69-
xtensa_set_sr(1 << d->hwirq, intclear);
64+
xtensa_set_sr(BIT(d->hwirq), intclear);
7065
}
7166

7267
static int xtensa_irq_retrigger(struct irq_data *d)
7368
{
74-
unsigned int mask = 1u << d->hwirq;
69+
unsigned int mask = BIT(d->hwirq);
7570

7671
if (WARN_ON(mask & ~XCHAL_INTTYPE_MASK_SOFTWARE))
7772
return 0;
@@ -81,8 +76,6 @@ static int xtensa_irq_retrigger(struct irq_data *d)
8176

8277
static struct irq_chip xtensa_irq_chip = {
8378
.name = "xtensa",
84-
.irq_enable = xtensa_irq_enable,
85-
.irq_disable = xtensa_irq_disable,
8679
.irq_mask = xtensa_irq_mask,
8780
.irq_unmask = xtensa_irq_unmask,
8881
.irq_ack = xtensa_irq_ack,

0 commit comments

Comments
 (0)