Commit 87783be4 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Ingo Molnar

x86: io-apic - get rid of __DO_ACTION macro

Replace __DO_ACTION macro with io_apic_modify_irq function.
This allow us to 'grep' definitions being hided by
__DO_ACTION macro:

	__unmask_IO_APIC_irq
	__mask_IO_APIC_irq
	__mask_and_edge_IO_APIC_irq
	__unmask_and_level_IO_APIC_irq
Signed-off-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
Acked-by: default avatarYinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent ba374c9b
...@@ -643,65 +643,66 @@ static void __init replace_pin_at_irq(unsigned int irq, ...@@ -643,65 +643,66 @@ static void __init replace_pin_at_irq(unsigned int irq,
add_pin_to_irq(irq, newapic, newpin); add_pin_to_irq(irq, newapic, newpin);
} }
#define __DO_ACTION(R, ACTION_ENABLE, ACTION_DISABLE, FINAL) \ static inline void io_apic_modify_irq(unsigned int irq,
\ int mask_and, int mask_or,
{ \ void (*final)(struct irq_pin_list *entry))
int pin; \ {
struct irq_cfg *cfg; \ int pin;
struct irq_pin_list *entry; \ struct irq_cfg *cfg;
\ struct irq_pin_list *entry;
cfg = irq_cfg(irq); \
entry = cfg->irq_2_pin; \ cfg = irq_cfg(irq);
for (;;) { \ for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) {
unsigned int reg; \ unsigned int reg;
if (!entry) \ pin = entry->pin;
break; \ reg = io_apic_read(entry->apic, 0x10 + pin * 2);
pin = entry->pin; \ reg &= mask_and;
reg = io_apic_read(entry->apic, 0x10 + R + pin*2); \ reg |= mask_or;
reg ACTION_DISABLE; \ io_apic_modify(entry->apic, 0x10 + pin * 2, reg);
reg ACTION_ENABLE; \ if (final)
io_apic_modify(entry->apic, 0x10 + R + pin*2, reg); \ final(entry);
FINAL; \ }
if (!entry->next) \ }
break; \
entry = entry->next; \ static void __unmask_IO_APIC_irq(unsigned int irq)
} \ {
} io_apic_modify_irq(irq, ~IO_APIC_REDIR_MASKED, 0, NULL);
}
#define DO_ACTION(name,R, ACTION_ENABLE, ACTION_DISABLE, FINAL) \
\
static void name##_IO_APIC_irq (unsigned int irq) \
__DO_ACTION(R, ACTION_ENABLE, ACTION_DISABLE, FINAL)
/* mask = 0 */
DO_ACTION(__unmask, 0, |= 0, &= ~IO_APIC_REDIR_MASKED, )
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
/* void io_apic_sync(struct irq_pin_list *entry)
{
/*
* Synchronize the IO-APIC and the CPU by doing * Synchronize the IO-APIC and the CPU by doing
* a dummy read from the IO-APIC * a dummy read from the IO-APIC
*/ */
static inline void io_apic_sync(unsigned int apic) struct io_apic __iomem *io_apic;
{ io_apic = io_apic_base(entry->apic);
struct io_apic __iomem *io_apic = io_apic_base(apic);
readl(&io_apic->data); readl(&io_apic->data);
} }
/* mask = 1 */ static void __mask_IO_APIC_irq(unsigned int irq)
DO_ACTION(__mask, 0, |= IO_APIC_REDIR_MASKED, &= ~0, io_apic_sync(entry->apic)) {
io_apic_modify_irq(irq, ~0, IO_APIC_REDIR_MASKED, &io_apic_sync);
#else }
#else /* CONFIG_X86_32 */
/* mask = 1 */ static void __mask_IO_APIC_irq(unsigned int irq)
DO_ACTION(__mask, 0, |= IO_APIC_REDIR_MASKED, &= ~0, ) {
io_apic_modify_irq(irq, ~0, IO_APIC_REDIR_MASKED, NULL);
/* mask = 1, trigger = 0 */ }
DO_ACTION(__mask_and_edge, 0, |= IO_APIC_REDIR_MASKED, &= ~IO_APIC_REDIR_LEVEL_TRIGGER, )
/* mask = 0, trigger = 1 */ static void __mask_and_edge_IO_APIC_irq(unsigned int irq)
DO_ACTION(__unmask_and_level, 0, |= IO_APIC_REDIR_LEVEL_TRIGGER, &= ~IO_APIC_REDIR_MASKED, ) {
io_apic_modify_irq(irq, ~IO_APIC_REDIR_LEVEL_TRIGGER,
IO_APIC_REDIR_MASKED, NULL);
}
#endif static void __unmask_and_level_IO_APIC_irq(unsigned int irq)
{
io_apic_modify_irq(irq, ~IO_APIC_REDIR_MASKED,
IO_APIC_REDIR_LEVEL_TRIGGER, NULL);
}
#endif /* CONFIG_X86_32 */
static void mask_IO_APIC_irq (unsigned int irq) static void mask_IO_APIC_irq (unsigned int irq)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment