MIPS: VR41xx: Convert to new irq_chip functions

And cleanup direct access to irq_desc[].

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
To: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/2208/
Patchwork: https://patchwork.linux-mips.org/patch/2209/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
Thomas Gleixner 2011-03-23 21:09:17 +00:00 committed by Ralf Baechle
parent d7ae7c7137
commit fbaa4e2a19
2 changed files with 44 additions and 47 deletions

View File

@ -154,7 +154,7 @@ static inline uint16_t icu2_clear(uint8_t offset, uint16_t clear)
void vr41xx_enable_piuint(uint16_t mask) void vr41xx_enable_piuint(uint16_t mask)
{ {
struct irq_desc *desc = irq_desc + PIU_IRQ; struct irq_desc *desc = irq_to_desc(PIU_IRQ);
unsigned long flags; unsigned long flags;
if (current_cpu_type() == CPU_VR4111 || if (current_cpu_type() == CPU_VR4111 ||
@ -169,7 +169,7 @@ EXPORT_SYMBOL(vr41xx_enable_piuint);
void vr41xx_disable_piuint(uint16_t mask) void vr41xx_disable_piuint(uint16_t mask)
{ {
struct irq_desc *desc = irq_desc + PIU_IRQ; struct irq_desc *desc = irq_to_desc(PIU_IRQ);
unsigned long flags; unsigned long flags;
if (current_cpu_type() == CPU_VR4111 || if (current_cpu_type() == CPU_VR4111 ||
@ -184,7 +184,7 @@ EXPORT_SYMBOL(vr41xx_disable_piuint);
void vr41xx_enable_aiuint(uint16_t mask) void vr41xx_enable_aiuint(uint16_t mask)
{ {
struct irq_desc *desc = irq_desc + AIU_IRQ; struct irq_desc *desc = irq_to_desc(AIU_IRQ);
unsigned long flags; unsigned long flags;
if (current_cpu_type() == CPU_VR4111 || if (current_cpu_type() == CPU_VR4111 ||
@ -199,7 +199,7 @@ EXPORT_SYMBOL(vr41xx_enable_aiuint);
void vr41xx_disable_aiuint(uint16_t mask) void vr41xx_disable_aiuint(uint16_t mask)
{ {
struct irq_desc *desc = irq_desc + AIU_IRQ; struct irq_desc *desc = irq_to_desc(AIU_IRQ);
unsigned long flags; unsigned long flags;
if (current_cpu_type() == CPU_VR4111 || if (current_cpu_type() == CPU_VR4111 ||
@ -214,7 +214,7 @@ EXPORT_SYMBOL(vr41xx_disable_aiuint);
void vr41xx_enable_kiuint(uint16_t mask) void vr41xx_enable_kiuint(uint16_t mask)
{ {
struct irq_desc *desc = irq_desc + KIU_IRQ; struct irq_desc *desc = irq_to_desc(KIU_IRQ);
unsigned long flags; unsigned long flags;
if (current_cpu_type() == CPU_VR4111 || if (current_cpu_type() == CPU_VR4111 ||
@ -229,7 +229,7 @@ EXPORT_SYMBOL(vr41xx_enable_kiuint);
void vr41xx_disable_kiuint(uint16_t mask) void vr41xx_disable_kiuint(uint16_t mask)
{ {
struct irq_desc *desc = irq_desc + KIU_IRQ; struct irq_desc *desc = irq_to_desc(KIU_IRQ);
unsigned long flags; unsigned long flags;
if (current_cpu_type() == CPU_VR4111 || if (current_cpu_type() == CPU_VR4111 ||
@ -244,7 +244,7 @@ EXPORT_SYMBOL(vr41xx_disable_kiuint);
void vr41xx_enable_macint(uint16_t mask) void vr41xx_enable_macint(uint16_t mask)
{ {
struct irq_desc *desc = irq_desc + ETHERNET_IRQ; struct irq_desc *desc = irq_to_desc(ETHERNET_IRQ);
unsigned long flags; unsigned long flags;
raw_spin_lock_irqsave(&desc->lock, flags); raw_spin_lock_irqsave(&desc->lock, flags);
@ -256,7 +256,7 @@ EXPORT_SYMBOL(vr41xx_enable_macint);
void vr41xx_disable_macint(uint16_t mask) void vr41xx_disable_macint(uint16_t mask)
{ {
struct irq_desc *desc = irq_desc + ETHERNET_IRQ; struct irq_desc *desc = irq_to_desc(ETHERNET_IRQ);
unsigned long flags; unsigned long flags;
raw_spin_lock_irqsave(&desc->lock, flags); raw_spin_lock_irqsave(&desc->lock, flags);
@ -268,7 +268,7 @@ EXPORT_SYMBOL(vr41xx_disable_macint);
void vr41xx_enable_dsiuint(uint16_t mask) void vr41xx_enable_dsiuint(uint16_t mask)
{ {
struct irq_desc *desc = irq_desc + DSIU_IRQ; struct irq_desc *desc = irq_to_desc(DSIU_IRQ);
unsigned long flags; unsigned long flags;
raw_spin_lock_irqsave(&desc->lock, flags); raw_spin_lock_irqsave(&desc->lock, flags);
@ -280,7 +280,7 @@ EXPORT_SYMBOL(vr41xx_enable_dsiuint);
void vr41xx_disable_dsiuint(uint16_t mask) void vr41xx_disable_dsiuint(uint16_t mask)
{ {
struct irq_desc *desc = irq_desc + DSIU_IRQ; struct irq_desc *desc = irq_to_desc(DSIU_IRQ);
unsigned long flags; unsigned long flags;
raw_spin_lock_irqsave(&desc->lock, flags); raw_spin_lock_irqsave(&desc->lock, flags);
@ -292,7 +292,7 @@ EXPORT_SYMBOL(vr41xx_disable_dsiuint);
void vr41xx_enable_firint(uint16_t mask) void vr41xx_enable_firint(uint16_t mask)
{ {
struct irq_desc *desc = irq_desc + FIR_IRQ; struct irq_desc *desc = irq_to_desc(FIR_IRQ);
unsigned long flags; unsigned long flags;
raw_spin_lock_irqsave(&desc->lock, flags); raw_spin_lock_irqsave(&desc->lock, flags);
@ -304,7 +304,7 @@ EXPORT_SYMBOL(vr41xx_enable_firint);
void vr41xx_disable_firint(uint16_t mask) void vr41xx_disable_firint(uint16_t mask)
{ {
struct irq_desc *desc = irq_desc + FIR_IRQ; struct irq_desc *desc = irq_to_desc(FIR_IRQ);
unsigned long flags; unsigned long flags;
raw_spin_lock_irqsave(&desc->lock, flags); raw_spin_lock_irqsave(&desc->lock, flags);
@ -316,7 +316,7 @@ EXPORT_SYMBOL(vr41xx_disable_firint);
void vr41xx_enable_pciint(void) void vr41xx_enable_pciint(void)
{ {
struct irq_desc *desc = irq_desc + PCI_IRQ; struct irq_desc *desc = irq_to_desc(PCI_IRQ);
unsigned long flags; unsigned long flags;
if (current_cpu_type() == CPU_VR4122 || if (current_cpu_type() == CPU_VR4122 ||
@ -332,7 +332,7 @@ EXPORT_SYMBOL(vr41xx_enable_pciint);
void vr41xx_disable_pciint(void) void vr41xx_disable_pciint(void)
{ {
struct irq_desc *desc = irq_desc + PCI_IRQ; struct irq_desc *desc = irq_to_desc(PCI_IRQ);
unsigned long flags; unsigned long flags;
if (current_cpu_type() == CPU_VR4122 || if (current_cpu_type() == CPU_VR4122 ||
@ -348,7 +348,7 @@ EXPORT_SYMBOL(vr41xx_disable_pciint);
void vr41xx_enable_scuint(void) void vr41xx_enable_scuint(void)
{ {
struct irq_desc *desc = irq_desc + SCU_IRQ; struct irq_desc *desc = irq_to_desc(SCU_IRQ);
unsigned long flags; unsigned long flags;
if (current_cpu_type() == CPU_VR4122 || if (current_cpu_type() == CPU_VR4122 ||
@ -364,7 +364,7 @@ EXPORT_SYMBOL(vr41xx_enable_scuint);
void vr41xx_disable_scuint(void) void vr41xx_disable_scuint(void)
{ {
struct irq_desc *desc = irq_desc + SCU_IRQ; struct irq_desc *desc = irq_to_desc(SCU_IRQ);
unsigned long flags; unsigned long flags;
if (current_cpu_type() == CPU_VR4122 || if (current_cpu_type() == CPU_VR4122 ||
@ -380,7 +380,7 @@ EXPORT_SYMBOL(vr41xx_disable_scuint);
void vr41xx_enable_csiint(uint16_t mask) void vr41xx_enable_csiint(uint16_t mask)
{ {
struct irq_desc *desc = irq_desc + CSI_IRQ; struct irq_desc *desc = irq_to_desc(CSI_IRQ);
unsigned long flags; unsigned long flags;
if (current_cpu_type() == CPU_VR4122 || if (current_cpu_type() == CPU_VR4122 ||
@ -396,7 +396,7 @@ EXPORT_SYMBOL(vr41xx_enable_csiint);
void vr41xx_disable_csiint(uint16_t mask) void vr41xx_disable_csiint(uint16_t mask)
{ {
struct irq_desc *desc = irq_desc + CSI_IRQ; struct irq_desc *desc = irq_to_desc(CSI_IRQ);
unsigned long flags; unsigned long flags;
if (current_cpu_type() == CPU_VR4122 || if (current_cpu_type() == CPU_VR4122 ||
@ -412,7 +412,7 @@ EXPORT_SYMBOL(vr41xx_disable_csiint);
void vr41xx_enable_bcuint(void) void vr41xx_enable_bcuint(void)
{ {
struct irq_desc *desc = irq_desc + BCU_IRQ; struct irq_desc *desc = irq_to_desc(BCU_IRQ);
unsigned long flags; unsigned long flags;
if (current_cpu_type() == CPU_VR4122 || if (current_cpu_type() == CPU_VR4122 ||
@ -428,7 +428,7 @@ EXPORT_SYMBOL(vr41xx_enable_bcuint);
void vr41xx_disable_bcuint(void) void vr41xx_disable_bcuint(void)
{ {
struct irq_desc *desc = irq_desc + BCU_IRQ; struct irq_desc *desc = irq_to_desc(BCU_IRQ);
unsigned long flags; unsigned long flags;
if (current_cpu_type() == CPU_VR4122 || if (current_cpu_type() == CPU_VR4122 ||
@ -442,45 +442,41 @@ void vr41xx_disable_bcuint(void)
EXPORT_SYMBOL(vr41xx_disable_bcuint); EXPORT_SYMBOL(vr41xx_disable_bcuint);
static void disable_sysint1_irq(unsigned int irq) static void disable_sysint1_irq(struct irq_data *d)
{ {
icu1_clear(MSYSINT1REG, 1 << SYSINT1_IRQ_TO_PIN(irq)); icu1_clear(MSYSINT1REG, 1 << SYSINT1_IRQ_TO_PIN(d->irq));
} }
static void enable_sysint1_irq(unsigned int irq) static void enable_sysint1_irq(struct irq_data *d)
{ {
icu1_set(MSYSINT1REG, 1 << SYSINT1_IRQ_TO_PIN(irq)); icu1_set(MSYSINT1REG, 1 << SYSINT1_IRQ_TO_PIN(d->irq));
} }
static struct irq_chip sysint1_irq_type = { static struct irq_chip sysint1_irq_type = {
.name = "SYSINT1", .name = "SYSINT1",
.ack = disable_sysint1_irq, .irq_mask = disable_sysint1_irq,
.mask = disable_sysint1_irq, .irq_unmask = enable_sysint1_irq,
.mask_ack = disable_sysint1_irq,
.unmask = enable_sysint1_irq,
}; };
static void disable_sysint2_irq(unsigned int irq) static void disable_sysint2_irq(struct irq_data *d)
{ {
icu2_clear(MSYSINT2REG, 1 << SYSINT2_IRQ_TO_PIN(irq)); icu2_clear(MSYSINT2REG, 1 << SYSINT2_IRQ_TO_PIN(d->irq));
} }
static void enable_sysint2_irq(unsigned int irq) static void enable_sysint2_irq(struct irq_data *d)
{ {
icu2_set(MSYSINT2REG, 1 << SYSINT2_IRQ_TO_PIN(irq)); icu2_set(MSYSINT2REG, 1 << SYSINT2_IRQ_TO_PIN(d->irq));
} }
static struct irq_chip sysint2_irq_type = { static struct irq_chip sysint2_irq_type = {
.name = "SYSINT2", .name = "SYSINT2",
.ack = disable_sysint2_irq, .irq_mask = disable_sysint2_irq,
.mask = disable_sysint2_irq, .irq_unmask = enable_sysint2_irq,
.mask_ack = disable_sysint2_irq,
.unmask = enable_sysint2_irq,
}; };
static inline int set_sysint1_assign(unsigned int irq, unsigned char assign) static inline int set_sysint1_assign(unsigned int irq, unsigned char assign)
{ {
struct irq_desc *desc = irq_desc + irq; struct irq_desc *desc = irq_to_desc(irq);
uint16_t intassign0, intassign1; uint16_t intassign0, intassign1;
unsigned int pin; unsigned int pin;
@ -540,7 +536,7 @@ static inline int set_sysint1_assign(unsigned int irq, unsigned char assign)
static inline int set_sysint2_assign(unsigned int irq, unsigned char assign) static inline int set_sysint2_assign(unsigned int irq, unsigned char assign)
{ {
struct irq_desc *desc = irq_desc + irq; struct irq_desc *desc = irq_to_desc(irq);
uint16_t intassign2, intassign3; uint16_t intassign2, intassign3;
unsigned int pin; unsigned int pin;

View File

@ -62,7 +62,6 @@ EXPORT_SYMBOL_GPL(cascade_irq);
static void irq_dispatch(unsigned int irq) static void irq_dispatch(unsigned int irq)
{ {
irq_cascade_t *cascade; irq_cascade_t *cascade;
struct irq_desc *desc;
if (irq >= NR_IRQS) { if (irq >= NR_IRQS) {
atomic_inc(&irq_err_count); atomic_inc(&irq_err_count);
@ -71,14 +70,16 @@ static void irq_dispatch(unsigned int irq)
cascade = irq_cascade + irq; cascade = irq_cascade + irq;
if (cascade->get_irq != NULL) { if (cascade->get_irq != NULL) {
unsigned int source_irq = irq; struct irq_desc *desc = irq_to_desc(irq);
struct irq_data *idata = irq_desc_get_irq_data(desc);
struct irq_chip *chip = irq_desc_get_chip(desc);
int ret; int ret;
desc = irq_desc + source_irq;
if (desc->chip->mask_ack) if (chip->irq_mask_ack)
desc->chip->mask_ack(source_irq); chip->irq_mask_ack(idata);
else { else {
desc->chip->mask(source_irq); chip->irq_mask(idata);
desc->chip->ack(source_irq); chip->irq_ack(idata);
} }
ret = cascade->get_irq(irq); ret = cascade->get_irq(irq);
irq = ret; irq = ret;
@ -86,8 +87,8 @@ static void irq_dispatch(unsigned int irq)
atomic_inc(&irq_err_count); atomic_inc(&irq_err_count);
else else
irq_dispatch(irq); irq_dispatch(irq);
if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask) if (!(desc->status & IRQ_DISABLED) && chip->irq_unmask)
desc->chip->unmask(source_irq); chip->irq_unmask(idata);
} else } else
do_IRQ(irq); do_IRQ(irq);
} }