diff options
Diffstat (limited to 'kernel/irq/proc.c')
-rw-r--r-- | kernel/irq/proc.c | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index 692363dd591f..7a6eb04ef6b5 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/irq.h> | 9 | #include <linux/irq.h> |
10 | #include <linux/gfp.h> | ||
10 | #include <linux/proc_fs.h> | 11 | #include <linux/proc_fs.h> |
11 | #include <linux/seq_file.h> | 12 | #include <linux/seq_file.h> |
12 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
@@ -136,7 +137,7 @@ out: | |||
136 | 137 | ||
137 | static int default_affinity_open(struct inode *inode, struct file *file) | 138 | static int default_affinity_open(struct inode *inode, struct file *file) |
138 | { | 139 | { |
139 | return single_open(file, default_affinity_show, NULL); | 140 | return single_open(file, default_affinity_show, PDE(inode)->data); |
140 | } | 141 | } |
141 | 142 | ||
142 | static const struct file_operations default_affinity_proc_fops = { | 143 | static const struct file_operations default_affinity_proc_fops = { |
@@ -148,18 +149,28 @@ static const struct file_operations default_affinity_proc_fops = { | |||
148 | }; | 149 | }; |
149 | #endif | 150 | #endif |
150 | 151 | ||
151 | static int irq_spurious_read(char *page, char **start, off_t off, | 152 | static int irq_spurious_proc_show(struct seq_file *m, void *v) |
152 | int count, int *eof, void *data) | ||
153 | { | 153 | { |
154 | struct irq_desc *desc = irq_to_desc((long) data); | 154 | struct irq_desc *desc = irq_to_desc((long) m->private); |
155 | return sprintf(page, "count %u\n" | 155 | |
156 | "unhandled %u\n" | 156 | seq_printf(m, "count %u\n" "unhandled %u\n" "last_unhandled %u ms\n", |
157 | "last_unhandled %u ms\n", | 157 | desc->irq_count, desc->irqs_unhandled, |
158 | desc->irq_count, | 158 | jiffies_to_msecs(desc->last_unhandled)); |
159 | desc->irqs_unhandled, | 159 | return 0; |
160 | jiffies_to_msecs(desc->last_unhandled)); | 160 | } |
161 | |||
162 | static int irq_spurious_proc_open(struct inode *inode, struct file *file) | ||
163 | { | ||
164 | return single_open(file, irq_spurious_proc_show, NULL); | ||
161 | } | 165 | } |
162 | 166 | ||
167 | static const struct file_operations irq_spurious_proc_fops = { | ||
168 | .open = irq_spurious_proc_open, | ||
169 | .read = seq_read, | ||
170 | .llseek = seq_lseek, | ||
171 | .release = single_release, | ||
172 | }; | ||
173 | |||
163 | #define MAX_NAMELEN 128 | 174 | #define MAX_NAMELEN 128 |
164 | 175 | ||
165 | static int name_unique(unsigned int irq, struct irqaction *new_action) | 176 | static int name_unique(unsigned int irq, struct irqaction *new_action) |
@@ -169,7 +180,7 @@ static int name_unique(unsigned int irq, struct irqaction *new_action) | |||
169 | unsigned long flags; | 180 | unsigned long flags; |
170 | int ret = 1; | 181 | int ret = 1; |
171 | 182 | ||
172 | spin_lock_irqsave(&desc->lock, flags); | 183 | raw_spin_lock_irqsave(&desc->lock, flags); |
173 | for (action = desc->action ; action; action = action->next) { | 184 | for (action = desc->action ; action; action = action->next) { |
174 | if ((action != new_action) && action->name && | 185 | if ((action != new_action) && action->name && |
175 | !strcmp(new_action->name, action->name)) { | 186 | !strcmp(new_action->name, action->name)) { |
@@ -177,7 +188,7 @@ static int name_unique(unsigned int irq, struct irqaction *new_action) | |||
177 | break; | 188 | break; |
178 | } | 189 | } |
179 | } | 190 | } |
180 | spin_unlock_irqrestore(&desc->lock, flags); | 191 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
181 | return ret; | 192 | return ret; |
182 | } | 193 | } |
183 | 194 | ||
@@ -204,7 +215,6 @@ void register_handler_proc(unsigned int irq, struct irqaction *action) | |||
204 | void register_irq_proc(unsigned int irq, struct irq_desc *desc) | 215 | void register_irq_proc(unsigned int irq, struct irq_desc *desc) |
205 | { | 216 | { |
206 | char name [MAX_NAMELEN]; | 217 | char name [MAX_NAMELEN]; |
207 | struct proc_dir_entry *entry; | ||
208 | 218 | ||
209 | if (!root_irq_dir || (desc->chip == &no_irq_chip) || desc->dir) | 219 | if (!root_irq_dir || (desc->chip == &no_irq_chip) || desc->dir) |
210 | return; | 220 | return; |
@@ -214,6 +224,8 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc) | |||
214 | 224 | ||
215 | /* create /proc/irq/1234 */ | 225 | /* create /proc/irq/1234 */ |
216 | desc->dir = proc_mkdir(name, root_irq_dir); | 226 | desc->dir = proc_mkdir(name, root_irq_dir); |
227 | if (!desc->dir) | ||
228 | return; | ||
217 | 229 | ||
218 | #ifdef CONFIG_SMP | 230 | #ifdef CONFIG_SMP |
219 | /* create /proc/irq/<irq>/smp_affinity */ | 231 | /* create /proc/irq/<irq>/smp_affinity */ |
@@ -221,11 +233,8 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc) | |||
221 | &irq_affinity_proc_fops, (void *)(long)irq); | 233 | &irq_affinity_proc_fops, (void *)(long)irq); |
222 | #endif | 234 | #endif |
223 | 235 | ||
224 | entry = create_proc_entry("spurious", 0444, desc->dir); | 236 | proc_create_data("spurious", 0444, desc->dir, |
225 | if (entry) { | 237 | &irq_spurious_proc_fops, (void *)(long)irq); |
226 | entry->data = (void *)(long)irq; | ||
227 | entry->read_proc = irq_spurious_read; | ||
228 | } | ||
229 | } | 238 | } |
230 | 239 | ||
231 | #undef MAX_NAMELEN | 240 | #undef MAX_NAMELEN |