提交 13bfe99e 编写于 作者: T Thomas Gleixner

genirq: Prepare proc for real sparse irq support

/proc/irq never removes any entries, but when irq descriptors can be
freed for real this is necessary. Otherwise we'd reference a freed
descriptor in /proc/irq/N
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
Reviewed-by: NIngo Molnar <mingo@elte.hu>
上级 1f5a5b87
...@@ -32,10 +32,12 @@ void replace_irq_desc(unsigned int irq, struct irq_desc *desc); ...@@ -32,10 +32,12 @@ void replace_irq_desc(unsigned int irq, struct irq_desc *desc);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
extern void register_irq_proc(unsigned int irq, struct irq_desc *desc); extern void register_irq_proc(unsigned int irq, struct irq_desc *desc);
extern void unregister_irq_proc(unsigned int irq, struct irq_desc *desc);
extern void register_handler_proc(unsigned int irq, struct irqaction *action); extern void register_handler_proc(unsigned int irq, struct irqaction *action);
extern void unregister_handler_proc(unsigned int irq, struct irqaction *action); extern void unregister_handler_proc(unsigned int irq, struct irqaction *action);
#else #else
static inline void register_irq_proc(unsigned int irq, struct irq_desc *desc) { } static inline void register_irq_proc(unsigned int irq, struct irq_desc *desc) { }
static inline void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) { }
static inline void register_handler_proc(unsigned int irq, static inline void register_handler_proc(unsigned int irq,
struct irqaction *action) { } struct irqaction *action) { }
static inline void unregister_handler_proc(unsigned int irq, static inline void unregister_handler_proc(unsigned int irq,
......
...@@ -205,6 +205,8 @@ static void free_desc(unsigned int irq) ...@@ -205,6 +205,8 @@ static void free_desc(unsigned int irq)
struct irq_desc *desc = irq_to_desc(irq); struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags; unsigned long flags;
unregister_irq_proc(irq, desc);
raw_spin_lock_irqsave(&sparse_irq_lock, flags); raw_spin_lock_irqsave(&sparse_irq_lock, flags);
delete_irq_desc(irq); delete_irq_desc(irq);
raw_spin_unlock_irqrestore(&sparse_irq_lock, flags); raw_spin_unlock_irqrestore(&sparse_irq_lock, flags);
......
...@@ -297,6 +297,24 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc) ...@@ -297,6 +297,24 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc)
&irq_spurious_proc_fops, (void *)(long)irq); &irq_spurious_proc_fops, (void *)(long)irq);
} }
void unregister_irq_proc(unsigned int irq, struct irq_desc *desc)
{
char name [MAX_NAMELEN];
if (!root_irq_dir || !desc->dir)
return;
#ifdef CONFIG_SMP
remove_proc_entry("smp_affinity", desc->dir);
remove_proc_entry("affinity_hint", desc->dir);
remove_proc_entry("node", desc->dir);
#endif
remove_proc_entry("spurious", desc->dir);
memset(name, 0, MAX_NAMELEN);
sprintf(name, "%u", irq);
remove_proc_entry(name, root_irq_dir);
}
#undef MAX_NAMELEN #undef MAX_NAMELEN
void unregister_handler_proc(unsigned int irq, struct irqaction *action) void unregister_handler_proc(unsigned int irq, struct irqaction *action)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册