Skip to content

Commit 22111fd

Browse files
alcharkKAGA-KOKO
authored andcommitted
irqchip/irq-vt8500: Split up ack/mask functions
vt8500_irq_mask() really does the ACK for edge triggered interrupts and the MASK for level triggered interrupts. Edge triggered interrupts never really are masked as a result, and there is unnecessary reading of the status register before the ACK even though it's write-one-to-clear. Split it up into a proper standalone vt8500_irq_ack() and an unconditional vt8500_irq_mask(). No Fixes tag added, as it has survived this way for 15 years and nobody complained, so apparently nothing really used edge triggered interrupts anyway. [ tglx: Tabularize the irqchip struct initializer ] Signed-off-by: Alexey Charkov <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 76b66e8 commit 22111fd

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

drivers/irqchip/irq-vt8500.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,25 @@ struct vt8500_irq_data {
6767
static struct vt8500_irq_data intc[VT8500_INTC_MAX];
6868
static u32 active_cnt = 0;
6969

70-
static void vt8500_irq_mask(struct irq_data *d)
70+
static void vt8500_irq_ack(struct irq_data *d)
7171
{
7272
struct vt8500_irq_data *priv = d->domain->host_data;
7373
void __iomem *base = priv->base;
7474
void __iomem *stat_reg = base + VT8500_ICIS + (d->hwirq < 32 ? 0 : 4);
75-
u8 edge, dctr;
76-
u32 status;
77-
78-
edge = readb(base + VT8500_ICDC + d->hwirq) & VT8500_EDGE;
79-
if (edge) {
80-
status = readl(stat_reg);
81-
82-
status |= (1 << (d->hwirq & 0x1f));
83-
writel(status, stat_reg);
84-
} else {
85-
dctr = readb(base + VT8500_ICDC + d->hwirq);
86-
dctr &= ~VT8500_INT_ENABLE;
87-
writeb(dctr, base + VT8500_ICDC + d->hwirq);
88-
}
75+
u32 status = (1 << (d->hwirq & 0x1f));
76+
77+
writel(status, stat_reg);
78+
}
79+
80+
static void vt8500_irq_mask(struct irq_data *d)
81+
{
82+
struct vt8500_irq_data *priv = d->domain->host_data;
83+
void __iomem *base = priv->base;
84+
u8 dctr;
85+
86+
dctr = readb(base + VT8500_ICDC + d->hwirq);
87+
dctr &= ~VT8500_INT_ENABLE;
88+
writeb(dctr, base + VT8500_ICDC + d->hwirq);
8989
}
9090

9191
static void vt8500_irq_unmask(struct irq_data *d)
@@ -130,11 +130,11 @@ static int vt8500_irq_set_type(struct irq_data *d, unsigned int flow_type)
130130
}
131131

132132
static struct irq_chip vt8500_irq_chip = {
133-
.name = "vt8500",
134-
.irq_ack = vt8500_irq_mask,
135-
.irq_mask = vt8500_irq_mask,
136-
.irq_unmask = vt8500_irq_unmask,
137-
.irq_set_type = vt8500_irq_set_type,
133+
.name = "vt8500",
134+
.irq_ack = vt8500_irq_ack,
135+
.irq_mask = vt8500_irq_mask,
136+
.irq_unmask = vt8500_irq_unmask,
137+
.irq_set_type = vt8500_irq_set_type,
138138
};
139139

140140
static void __init vt8500_init_irq_hw(void __iomem *base)

0 commit comments

Comments
 (0)