login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
September
»
10
Re: [PATCH] x86: io-apic - get rid of __DO_ACTION macro
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Yinghai Lu
Subject:
Re: [PATCH] x86: io-apic - get rid of __DO_ACTION macro
Date: Wednesday, September 10, 2008 - 11:40 am
On Wed, Sep 10, 2008 at 11:19 AM, Cyrill Gorcunov <gorcunov@gmail.com> wrote:
quoted text
> [Yinghai Lu - Wed, Sep 10, 2008 at 10:30:39AM -0700] > | On Wed, Sep 10, 2008 at 2:31 AM, Ingo Molnar <mingo@elte.hu> wrote: > | > > | > * Yinghai Lu <yhlu.kernel@gmail.com> wrote: > | > > | >> On Tue, Sep 9, 2008 at 11:02 PM, Cyrill Gorcunov <gorcunov@gmail.com> wrote: > | >> > On Wed, Sep 10, 2008 at 12:13 AM, Yinghai Lu <yhlu.kernel@gmail.com> wrote: > | >> > ... > | >> >> > | >> >> hope we can keep using MACRO.. > | >> >> > | >> >> YH > | >> >> > | >> > > | >> > Btw, Yinghai, what does it mean? To not touch this macro at all? > | >> > Or you mean about implementation issue (ie the design itself)? > | >> > | >> do not touch this macro... and may revisit after 2.6.28 > | > > | > anything you are particularly worried about? Regressions we should be > | > able to find pretty quickly, in a central macro like that - and the > | > macro is quite ugly. > | > > | > | ok, let remove unneeded "if", and use function pointer... > | > | void (*extra_action_t)(struct irq_pin_list *entry); > | > | +static inline void io_apic_modify_irq(unsigned int irq, > | + int mask_and, int mask_or, > | + int mask_and_not, extra_action_t action) > | +{ > | + int pin; > | + struct irq_cfg *cfg; > | + struct irq_pin_list *entry; > | + cfg = irq_cfg(irq); > | + for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) { > | + unsigned int reg; > | + pin = entry->pin; > | + reg = io_apic_read(entry->apic, 0x10 + pin * 2); > | + reg &= mask_and; > | + reg |= mask_or; > | + reg &= ~mask_and_not; > | + io_apic_modify(entry->apic, 0x10 + pin * 2, reg); > | + if (action) > | + action(entry); > | + } > | +} > | > | +void extra_read(struct irq_pin_list *entry) > | + { > | + /* > | + * Synchronize the IO-APIC and the CPU by doing > | + * a dummy read from the IO-APIC > | + */ > | + struct io_apic __iomem *io_apic; > | + io_apic = io_apic_base(entry->apic); > | + readl(&io_apic->data); > | + } > | > | > | YH > | > > Yinghai, Ingo, what about this one? > > - Cyrill - > --- > From: Cyrill Gorcunov <gorcunov@gmail.com> > Subject: x86: io-apic - get rid of __DO_ACTION macro v3 > > 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: Cyrill Gorcunov <gorcunov@gmail.com> > CC: Yinghai Lu <yhlu.kernel@gmail.com> > --- > > Index: linux-2.6.git/arch/x86/kernel/io_apic.c > =================================================================== > --- linux-2.6.git.orig/arch/x86/kernel/io_apic.c 2008-09-09 22:27:57.000000000 +0400 > +++ linux-2.6.git/arch/x86/kernel/io_apic.c 2008-09-10 22:17:25.000000000 +0400 > @@ -643,65 +643,66 @@ static void __init replace_pin_at_irq(un > add_pin_to_irq(irq, newapic, newpin); > } > > -#define __DO_ACTION(R, ACTION_ENABLE, ACTION_DISABLE, FINAL) \ > - \ > -{ \ > - int pin; \ > - struct irq_cfg *cfg; \ > - struct irq_pin_list *entry; \ > - \ > - cfg = irq_cfg(irq); \ > - entry = cfg->irq_2_pin; \ > - for (;;) { \ > - unsigned int reg; \ > - if (!entry) \ > - break; \ > - pin = entry->pin; \ > - reg = io_apic_read(entry->apic, 0x10 + R + pin*2); \ > - reg ACTION_DISABLE; \ > - reg ACTION_ENABLE; \ > - io_apic_modify(entry->apic, 0x10 + R + pin*2, reg); \ > - FINAL; \ > - if (!entry->next) \ > - break; \ > - entry = entry->next; \ > - } \ > -} > - > -#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) > +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; > + struct irq_pin_list *entry; > > -/* mask = 0 */ > -DO_ACTION(__unmask, 0, |= 0, &= ~IO_APIC_REDIR_MASKED, ) > + cfg = irq_cfg(irq); > + for (entry = cfg->irq_2_pin; entry != NULL; entry = entry->next) { > + unsigned int reg; > + pin = entry->pin; > + reg = io_apic_read(entry->apic, 0x10 + pin * 2); > + reg &= mask_and; > + reg |= mask_or; > + io_apic_modify(entry->apic, 0x10 + pin * 2, reg); > + if (final) > + final(entry); > + } > +} > + > +static void __unmask_IO_APIC_irq(unsigned int irq) > +{ > + io_apic_modify_irq(irq, ~IO_APIC_REDIR_MASKED, 0, NULL); > +} > > #ifdef CONFIG_X86_64 > -/* > - * Synchronize the IO-APIC and the CPU by doing > - * a dummy read from the IO-APIC > - */ > -static inline void io_apic_sync(unsigned int apic) > +void io_apic_sync(struct irq_pin_list *entry) > { > - struct io_apic __iomem *io_apic = io_apic_base(apic); > + /* > + * Synchronize the IO-APIC and the CPU by doing > + * a dummy read from the IO-APIC > + */ > + struct io_apic __iomem *io_apic; > + io_apic = io_apic_base(entry->apic); > readl(&io_apic->data); > } > > -/* mask = 1 */ > -DO_ACTION(__mask, 0, |= IO_APIC_REDIR_MASKED, &= ~0, io_apic_sync(entry->apic)) > - > -#else > - > -/* mask = 1 */ > -DO_ACTION(__mask, 0, |= IO_APIC_REDIR_MASKED, &= ~0, ) > - > -/* mask = 1, trigger = 0 */ > -DO_ACTION(__mask_and_edge, 0, |= IO_APIC_REDIR_MASKED, &= ~IO_APIC_REDIR_LEVEL_TRIGGER, ) > +static void __mask_IO_APIC_irq(unsigned int irq) > +{ > + io_apic_modify_irq(irq, ~0, IO_APIC_REDIR_MASKED, &io_apic_sync); > +} > +#else /* CONFIG_X86_32 */ > +static void __mask_IO_APIC_irq(unsigned int irq) > +{ > + io_apic_modify_irq(irq, ~0, IO_APIC_REDIR_MASKED, NULL); > +} > > -/* mask = 0, trigger = 1 */ > -DO_ACTION(__unmask_and_level, 0, |= IO_APIC_REDIR_LEVEL_TRIGGER, &= ~IO_APIC_REDIR_MASKED, ) > +static void __mask_and_edge_IO_APIC_irq(unsigned int irq) > +{ > + 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) > { >
looks good. YH --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH] x86: io-apic - get rid of __DO_ACTION macro
, Cyrill Gorcunov
, (Tue Sep 9, 11:46 am)
Re: [PATCH] x86: io-apic - get rid of __DO_ACTION macro
, Yinghai Lu
, (Tue Sep 9, 1:13 pm)
Re: [PATCH] x86: io-apic - get rid of __DO_ACTION macro
, Cyrill Gorcunov
, (Tue Sep 9, 1:28 pm)
Re: [PATCH] x86: io-apic - get rid of __DO_ACTION macro
, Cyrill Gorcunov
, (Tue Sep 9, 11:02 pm)
Re: [PATCH] x86: io-apic - get rid of __DO_ACTION macro
, Yinghai Lu
, (Tue Sep 9, 11:22 pm)
Re: [PATCH] x86: io-apic - get rid of __DO_ACTION macro
, Cyrill Gorcunov
, (Wed Sep 10, 1:40 am)
Re: [PATCH] x86: io-apic - get rid of __DO_ACTION macro
, Ingo Molnar
, (Wed Sep 10, 2:31 am)
Re: [PATCH] x86: io-apic - get rid of __DO_ACTION macro
, Cyrill Gorcunov
, (Wed Sep 10, 3:53 am)
Re: [PATCH] x86: io-apic - get rid of __DO_ACTION macro
, Yinghai Lu
, (Wed Sep 10, 10:30 am)
Re: [PATCH] x86: io-apic - get rid of __DO_ACTION macro
, Cyrill Gorcunov
, (Wed Sep 10, 10:44 am)
Re: [PATCH] x86: io-apic - get rid of __DO_ACTION macro
, Cyrill Gorcunov
, (Wed Sep 10, 11:19 am)
Re: [PATCH] x86: io-apic - get rid of __DO_ACTION macro
, Yinghai Lu
, (Wed Sep 10, 11:40 am)
Re: [PATCH] x86: io-apic - get rid of __DO_ACTION macro
, Ingo Molnar
, (Thu Sep 11, 12:08 am)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Michael Trimarchi
Re: [PATCH] VFS: make file->f_pos access atomic on 32bit arch
Miklos Szeredi
[patch 14/15] vfs: more path_permission() conversions
Serge E. Hallyn
Re: [RFC v5][PATCH 7/8] Infrastructure for shared objects
Bernd Schmidt
Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3
Takashi Iwai
[PATCH 2/2] input: Add LED support to Synaptics device
git
:
Junio C Hamano
Re: mingw, windows, crlf/lf, and git
Eyvind Bernhardsen
Re: Where has "git ls-remote" reference pattern matching gone?
Shawn O. Pearce
Re: Switching from CVS to GIT
Todd Zullinger
Re: [PATCH 2/2] send-email: rfc2047-quote subject lines with non-ascii characters
Santi Béjar
Re: How to use git-fmt-merge-msg?
linux-netdev
:
Ramkrishna Vepa
[net-2.6 PATCH 1/10] Neterion: New driver: Driver help file
Mark Anthony
invitation / inquiry
Ingo Molnar
Re: [PATCH 08/16] dma-debug: add core checking functions
David Miller
Re: [PATCH 1/3] f_phonet: dev_kfree_skb instead of dev_kfree_skb_any in TX callback
Sascha Hauer
[PATCH 03/12] fec: do not typedef struct types
git-commits-head
:
Linux Kernel Mailing List
amba: struct device - replace bus_id with dev_name(), dev_set_name()
Linux Kernel Mailing List
MIPS: Yosemite: Convert SMP startup lock to arch spinlock.
Linux Kernel Mailing List
ARM: S5PC100: IRQ and timer
Linux Kernel Mailing List
davinci: edma: clear interrupt status for interrupt enabled channels only
Linux Kernel Mailing List
x86, mm, kprobes: fault.c, simplify notify_page_fault()
openbsd-misc
:
Daniel A. Ramaley
Re: [semi-OT] Can anyone recommend an OpenBSD-compatible colour laser printer?
Matthias Kilian
Re: can't get vesa @ 1280x800 or nv
Tobias Ulmer
Re: Problem after upgrade 4.5 to 4.6: ERR M
Philip Guenther
Re: SIGCHLD and libpthread.so
J.C. Roberts
Re: [semi-OT] Can anyone recommend an OpenBSD-compatible colour laser printer?
Colocation donated by:
Syndicate