#include <linux/io.h>
#include "internals.h"
-void _intc_enable(unsigned int irq, unsigned long handle)
+void _intc_enable(struct irq_data *data, unsigned long handle)
{
+ unsigned int irq = data->irq;
struct intc_desc_int *d = get_intc_desc(irq);
unsigned long addr;
unsigned int cpu;
for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) {
#ifdef CONFIG_SMP
- if (!cpumask_test_cpu(cpu, irq_to_desc(irq)->affinity))
+ if (!cpumask_test_cpu(cpu, data->affinity))
continue;
#endif
addr = INTC_REG(d, _INTC_ADDR_E(handle), cpu);
intc_balancing_enable(irq);
}
-static void intc_enable(unsigned int irq)
+static void intc_enable(struct irq_data *data)
{
- _intc_enable(irq, (unsigned long)get_irq_chip_data(irq));
+ _intc_enable(data, (unsigned long)irq_data_get_irq_chip_data(data));
}
-static void intc_disable(unsigned int irq)
+static void intc_disable(struct irq_data *data)
{
+ unsigned int irq = data->irq;
struct intc_desc_int *d = get_intc_desc(irq);
- unsigned long handle = (unsigned long)get_irq_chip_data(irq);
+ unsigned long handle = (unsigned long)irq_data_get_irq_chip_data(data);
unsigned long addr;
unsigned int cpu;
for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) {
#ifdef CONFIG_SMP
- if (!cpumask_test_cpu(cpu, irq_to_desc(irq)->affinity))
+ if (!cpumask_test_cpu(cpu, data->affinity))
continue;
#endif
addr = INTC_REG(d, _INTC_ADDR_D(handle), cpu);
}
}
-static int intc_set_wake(unsigned int irq, unsigned int on)
+static int intc_set_wake(struct irq_data *data, unsigned int on)
{
return 0; /* allow wakeup, but setup hardware in intc_suspend() */
}
* additional locking here at the intc desc level. The affinity mask is
* later tested in the enable/disable paths.
*/
-static int intc_set_affinity(unsigned int irq, const struct cpumask *cpumask)
+static int intc_set_affinity(struct irq_data *data,
+ const struct cpumask *cpumask,
+ bool force)
{
if (!cpumask_intersects(cpumask, cpu_online_mask))
return -1;
- cpumask_copy(irq_to_desc(irq)->affinity, cpumask);
+ cpumask_copy(data->affinity, cpumask);
return 0;
}
#endif
-static void intc_mask_ack(unsigned int irq)
+static void intc_mask_ack(struct irq_data *data)
{
+ unsigned int irq = data->irq;
struct intc_desc_int *d = get_intc_desc(irq);
unsigned long handle = intc_get_ack_handle(irq);
unsigned long addr;
- intc_disable(irq);
+ intc_disable(data);
/* read register and write zero only to the associated bit */
if (handle) {
int intc_set_priority(unsigned int irq, unsigned int prio)
{
struct intc_desc_int *d = get_intc_desc(irq);
+ struct irq_data *data = irq_get_irq_data(irq);
struct intc_handle_int *ihp;
if (!intc_get_prio_level(irq) || prio <= 1)
* priority level will be set during next enable()
*/
if (_INTC_FN(ihp->handle) != REG_FN_ERR)
- _intc_enable(irq, ihp->handle);
+ _intc_enable(data, ihp->handle);
}
return 0;
}
#endif
};
-static int intc_set_type(unsigned int irq, unsigned int type)
+static int intc_set_type(struct irq_data *data, unsigned int type)
{
+ unsigned int irq = data->irq;
struct intc_desc_int *d = get_intc_desc(irq);
unsigned char value = intc_irq_sense_table[type & IRQ_TYPE_SENSE_MASK];
struct intc_handle_int *ihp;
}
struct irq_chip intc_irq_chip = {
- .mask = intc_disable,
- .unmask = intc_enable,
- .mask_ack = intc_mask_ack,
- .enable = intc_enable,
- .disable = intc_disable,
- .shutdown = intc_disable,
- .set_type = intc_set_type,
- .set_wake = intc_set_wake,
+ .irq_mask = intc_disable,
+ .irq_unmask = intc_enable,
+ .irq_mask_ack = intc_mask_ack,
+ .irq_enable = intc_enable,
+ .irq_disable = intc_disable,
+ .irq_shutdown = intc_disable,
+ .irq_set_type = intc_set_type,
+ .irq_set_wake = intc_set_wake,
#ifdef CONFIG_SMP
- .set_affinity = intc_set_affinity,
+ .irq_set_affinity = intc_set_affinity,
#endif
};
unsigned int irq)
{
struct intc_handle_int *hp;
+ struct irq_data *irq_data;
unsigned int data[2], primary;
unsigned long flags;
BUG_ON(!data[primary]); /* must have primary masking method */
+ irq_data = irq_get_irq_data(irq);
+
disable_irq_nosync(irq);
set_irq_chip_and_handler_name(irq, &d->chip,
handle_level_irq, "level");
/* enable secondary masking method if present */
if (data[!primary])
- _intc_enable(irq, data[!primary]);
+ _intc_enable(irq_data, data[!primary]);
/* add irq to d->prio list if priority is available */
if (data[1]) {
}
/* irq should be disabled by default */
- d->chip.mask(irq);
+ d->chip.irq_mask(irq_data);
intc_set_ack_handle(irq, desc, d, enum_id);
intc_set_dist_handle(irq, desc, d, enum_id);
for (i = 0; i < hw->nr_ack_regs; i++)
k += save_reg(d, k, hw->ack_regs[i].set_reg, 0);
else
- d->chip.mask_ack = d->chip.disable;
+ d->chip.irq_mask_ack = d->chip.irq_disable;
/* disable bits matching force_disable before registering irqs */
if (desc->force_disable)
static int intc_suspend(struct sys_device *dev, pm_message_t state)
{
struct intc_desc_int *d;
+ struct irq_data *data;
struct irq_desc *desc;
+ struct irq_chip *chip;
int irq;
/* get intc controller associated with this sysdev */
if (d->state.event != PM_EVENT_FREEZE)
break;
- for_each_irq_desc(irq, desc) {
+ for_each_irq_nr(irq) {
+ desc = irq_to_desc(irq);
+ if (!desc)
+ continue;
+
+ data = irq_get_irq_data(irq);
+ chip = irq_data_get_irq_chip(data);
+
/*
* This will catch the redirect and VIRQ cases
* due to the dummy_irq_chip being inserted.
*/
- if (desc->chip != &d->chip)
+ if (chip != &d->chip)
continue;
if (desc->status & IRQ_DISABLED)
- desc->chip->disable(irq);
+ chip->irq_disable(data);
else
- desc->chip->enable(irq);
+ chip->irq_enable(data);
}
break;
case PM_EVENT_FREEZE:
break;
case PM_EVENT_SUSPEND:
/* enable wakeup irqs belonging to this intc controller */
- for_each_irq_desc(irq, desc) {
- if (desc->chip != &d->chip)
+ for_each_irq_nr(irq) {
+ desc = irq_to_desc(irq);
+ if (!desc)
+ continue;
+
+ data = irq_get_irq_data(irq);
+ chip = irq_data_get_irq_chip(data);
+
+ if (chip != &d->chip)
continue;
if ((desc->status & IRQ_WAKEUP))
- desc->chip->enable(irq);
+ chip->irq_enable(data);
}
break;
}
static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
{
struct intc_virq_list **last, *entry;
- struct irq_desc *desc = irq_to_desc(irq);
+ struct irq_data *data = irq_get_irq_data(irq);
/* scan for duplicates */
- last = (struct intc_virq_list **)&desc->handler_data;
- for_each_virq(entry, desc->handler_data) {
+ last = (struct intc_virq_list **)&data->handler_data;
+ for_each_virq(entry, data->handler_data) {
if (entry->irq == virq)
return 0;
last = &entry->next;
static void intc_virq_handler(unsigned int irq, struct irq_desc *desc)
{
- struct intc_virq_list *entry, *vlist = get_irq_data(irq);
+ struct irq_data *data = irq_get_irq_data(irq);
+ struct irq_chip *chip = irq_data_get_irq_chip(data);
+ struct intc_virq_list *entry, *vlist = irq_data_get_irq_data(data);
struct intc_desc_int *d = get_intc_desc(irq);
- desc->chip->mask_ack(irq);
+ chip->irq_mask_ack(data);
for_each_virq(entry, vlist) {
unsigned long addr, handle;
generic_handle_irq(entry->irq);
}
- desc->chip->unmask(irq);
+ chip->irq_unmask(data);
}
static unsigned long __init intc_subgroup_data(struct intc_subgroup *subgroup,