@@ -136,7 +136,7 @@ static ssize_t default_affinity_write(struct file *file,
136136
137137static int default_affinity_open (struct inode * inode , struct file * file )
138138{
139- return single_open (file , default_affinity_show , NULL );
139+ return single_open (file , default_affinity_show , PDE ( inode ) -> data );
140140}
141141
142142static const struct file_operations default_affinity_proc_fops = {
@@ -148,18 +148,28 @@ static const struct file_operations default_affinity_proc_fops = {
148148};
149149#endif
150150
151- static int irq_spurious_read (char * page , char * * start , off_t off ,
152- int count , int * eof , void * data )
151+ static int irq_spurious_proc_show (struct seq_file * m , void * v )
153152{
154- struct irq_desc * desc = irq_to_desc ((long ) data );
155- return sprintf (page , "count %u\n"
156- "unhandled %u\n"
157- "last_unhandled %u ms\n" ,
158- desc -> irq_count ,
159- desc -> irqs_unhandled ,
160- jiffies_to_msecs (desc -> last_unhandled ));
153+ struct irq_desc * desc = irq_to_desc ((long ) m -> private );
154+
155+ seq_printf (m , "count %u\n" "unhandled %u\n" "last_unhandled %u ms\n" ,
156+ desc -> irq_count , desc -> irqs_unhandled ,
157+ jiffies_to_msecs (desc -> last_unhandled ));
158+ return 0 ;
159+ }
160+
161+ static int irq_spurious_proc_open (struct inode * inode , struct file * file )
162+ {
163+ return single_open (file , irq_spurious_proc_show , NULL );
161164}
162165
166+ static const struct file_operations irq_spurious_proc_fops = {
167+ .open = irq_spurious_proc_open ,
168+ .read = seq_read ,
169+ .llseek = seq_lseek ,
170+ .release = single_release ,
171+ };
172+
163173#define MAX_NAMELEN 128
164174
165175static int name_unique (unsigned int irq , struct irqaction * new_action )
@@ -204,7 +214,6 @@ void register_handler_proc(unsigned int irq, struct irqaction *action)
204214void register_irq_proc (unsigned int irq , struct irq_desc * desc )
205215{
206216 char name [MAX_NAMELEN ];
207- struct proc_dir_entry * entry ;
208217
209218 if (!root_irq_dir || (desc -> chip == & no_irq_chip ) || desc -> dir )
210219 return ;
@@ -214,18 +223,17 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc)
214223
215224 /* create /proc/irq/1234 */
216225 desc -> dir = proc_mkdir (name , root_irq_dir );
226+ if (!desc -> dir )
227+ return ;
217228
218229#ifdef CONFIG_SMP
219230 /* create /proc/irq/<irq>/smp_affinity */
220231 proc_create_data ("smp_affinity" , 0600 , desc -> dir ,
221232 & irq_affinity_proc_fops , (void * )(long )irq );
222233#endif
223234
224- entry = create_proc_entry ("spurious" , 0444 , desc -> dir );
225- if (entry ) {
226- entry -> data = (void * )(long )irq ;
227- entry -> read_proc = irq_spurious_read ;
228- }
235+ proc_create_data ("spurious" , 0444 , desc -> dir ,
236+ & irq_spurious_proc_fops , (void * )(long )irq );
229237}
230238
231239#undef MAX_NAMELEN
0 commit comments