@@ -56,19 +56,6 @@ static int ide_imodel_proc_show(struct seq_file *m, void *v)
5656 return 0 ;
5757}
5858
59- static int ide_imodel_proc_open (struct inode * inode , struct file * file )
60- {
61- return single_open (file , ide_imodel_proc_show , PDE_DATA (inode ));
62- }
63-
64- static const struct file_operations ide_imodel_proc_fops = {
65- .owner = THIS_MODULE ,
66- .open = ide_imodel_proc_open ,
67- .read = seq_read ,
68- .llseek = seq_lseek ,
69- .release = single_release ,
70- };
71-
7259static int ide_mate_proc_show (struct seq_file * m , void * v )
7360{
7461 ide_hwif_t * hwif = (ide_hwif_t * ) m -> private ;
@@ -80,19 +67,6 @@ static int ide_mate_proc_show(struct seq_file *m, void *v)
8067 return 0 ;
8168}
8269
83- static int ide_mate_proc_open (struct inode * inode , struct file * file )
84- {
85- return single_open (file , ide_mate_proc_show , PDE_DATA (inode ));
86- }
87-
88- static const struct file_operations ide_mate_proc_fops = {
89- .owner = THIS_MODULE ,
90- .open = ide_mate_proc_open ,
91- .read = seq_read ,
92- .llseek = seq_lseek ,
93- .release = single_release ,
94- };
95-
9670static int ide_channel_proc_show (struct seq_file * m , void * v )
9771{
9872 ide_hwif_t * hwif = (ide_hwif_t * ) m -> private ;
@@ -101,19 +75,6 @@ static int ide_channel_proc_show(struct seq_file *m, void *v)
10175 return 0 ;
10276}
10377
104- static int ide_channel_proc_open (struct inode * inode , struct file * file )
105- {
106- return single_open (file , ide_channel_proc_show , PDE_DATA (inode ));
107- }
108-
109- static const struct file_operations ide_channel_proc_fops = {
110- .owner = THIS_MODULE ,
111- .open = ide_channel_proc_open ,
112- .read = seq_read ,
113- .llseek = seq_lseek ,
114- .release = single_release ,
115- };
116-
11778static int ide_identify_proc_show (struct seq_file * m , void * v )
11879{
11980 ide_drive_t * drive = (ide_drive_t * )m -> private ;
@@ -141,19 +102,6 @@ static int ide_identify_proc_show(struct seq_file *m, void *v)
141102 return 0 ;
142103}
143104
144- static int ide_identify_proc_open (struct inode * inode , struct file * file )
145- {
146- return single_open (file , ide_identify_proc_show , PDE_DATA (inode ));
147- }
148-
149- static const struct file_operations ide_identify_proc_fops = {
150- .owner = THIS_MODULE ,
151- .open = ide_identify_proc_open ,
152- .read = seq_read ,
153- .llseek = seq_lseek ,
154- .release = single_release ,
155- };
156-
157105/**
158106 * ide_find_setting - find a specific setting
159107 * @st: setting table pointer
@@ -441,27 +389,14 @@ static const struct file_operations ide_settings_proc_fops = {
441389 .write = ide_settings_proc_write ,
442390};
443391
444- static int ide_capacity_proc_show (struct seq_file * m , void * v )
392+ int ide_capacity_proc_show (struct seq_file * m , void * v )
445393{
446394 seq_printf (m , "%llu\n" , (long long )0x7fffffff );
447395 return 0 ;
448396}
397+ EXPORT_SYMBOL_GPL (ide_capacity_proc_show );
449398
450- static int ide_capacity_proc_open (struct inode * inode , struct file * file )
451- {
452- return single_open (file , ide_capacity_proc_show , NULL );
453- }
454-
455- const struct file_operations ide_capacity_proc_fops = {
456- .owner = THIS_MODULE ,
457- .open = ide_capacity_proc_open ,
458- .read = seq_read ,
459- .llseek = seq_lseek ,
460- .release = single_release ,
461- };
462- EXPORT_SYMBOL_GPL (ide_capacity_proc_fops );
463-
464- static int ide_geometry_proc_show (struct seq_file * m , void * v )
399+ int ide_geometry_proc_show (struct seq_file * m , void * v )
465400{
466401 ide_drive_t * drive = (ide_drive_t * ) m -> private ;
467402
@@ -471,20 +406,7 @@ static int ide_geometry_proc_show(struct seq_file *m, void *v)
471406 drive -> bios_cyl , drive -> bios_head , drive -> bios_sect );
472407 return 0 ;
473408}
474-
475- static int ide_geometry_proc_open (struct inode * inode , struct file * file )
476- {
477- return single_open (file , ide_geometry_proc_show , PDE_DATA (inode ));
478- }
479-
480- const struct file_operations ide_geometry_proc_fops = {
481- .owner = THIS_MODULE ,
482- .open = ide_geometry_proc_open ,
483- .read = seq_read ,
484- .llseek = seq_lseek ,
485- .release = single_release ,
486- };
487- EXPORT_SYMBOL (ide_geometry_proc_fops );
409+ EXPORT_SYMBOL (ide_geometry_proc_show );
488410
489411static int ide_dmodel_proc_show (struct seq_file * seq , void * v )
490412{
@@ -495,19 +417,6 @@ static int ide_dmodel_proc_show(struct seq_file *seq, void *v)
495417 return 0 ;
496418}
497419
498- static int ide_dmodel_proc_open (struct inode * inode , struct file * file )
499- {
500- return single_open (file , ide_dmodel_proc_show , PDE_DATA (inode ));
501- }
502-
503- static const struct file_operations ide_dmodel_proc_fops = {
504- .owner = THIS_MODULE ,
505- .open = ide_dmodel_proc_open ,
506- .read = seq_read ,
507- .llseek = seq_lseek ,
508- .release = single_release ,
509- };
510-
511420static int ide_driver_proc_show (struct seq_file * m , void * v )
512421{
513422 ide_drive_t * drive = (ide_drive_t * )m -> private ;
@@ -523,19 +432,6 @@ static int ide_driver_proc_show(struct seq_file *m, void *v)
523432 return 0 ;
524433}
525434
526- static int ide_driver_proc_open (struct inode * inode , struct file * file )
527- {
528- return single_open (file , ide_driver_proc_show , PDE_DATA (inode ));
529- }
530-
531- static const struct file_operations ide_driver_proc_fops = {
532- .owner = THIS_MODULE ,
533- .open = ide_driver_proc_open ,
534- .read = seq_read ,
535- .llseek = seq_lseek ,
536- .release = single_release ,
537- };
538-
539435static int ide_media_proc_show (struct seq_file * m , void * v )
540436{
541437 ide_drive_t * drive = (ide_drive_t * ) m -> private ;
@@ -567,11 +463,10 @@ static const struct file_operations ide_media_proc_fops = {
567463};
568464
569465static ide_proc_entry_t generic_drive_entries [] = {
570- { "driver" , S_IFREG |S_IRUGO , & ide_driver_proc_fops },
571- { "identify" , S_IFREG |S_IRUSR , & ide_identify_proc_fops },
572- { "media" , S_IFREG |S_IRUGO , & ide_media_proc_fops },
573- { "model" , S_IFREG |S_IRUGO , & ide_dmodel_proc_fops },
574- { "settings" , S_IFREG |S_IRUSR |S_IWUSR , & ide_settings_proc_fops },
466+ { "driver" , S_IFREG |S_IRUGO , ide_driver_proc_show },
467+ { "identify" , S_IFREG |S_IRUSR , ide_identify_proc_show },
468+ { "media" , S_IFREG |S_IRUGO , ide_media_proc_show },
469+ { "model" , S_IFREG |S_IRUGO , ide_dmodel_proc_show },
575470 {}
576471};
577472
@@ -582,7 +477,7 @@ static void ide_add_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p
582477 if (!dir || !p )
583478 return ;
584479 while (p -> name != NULL ) {
585- ent = proc_create_data (p -> name , p -> mode , dir , p -> proc_fops , data );
480+ ent = proc_create_single_data (p -> name , p -> mode , dir , p -> show , data );
586481 if (!ent ) return ;
587482 p ++ ;
588483 }
@@ -647,8 +542,12 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif)
647542 continue ;
648543
649544 drive -> proc = proc_mkdir (drive -> name , parent );
650- if (drive -> proc )
545+ if (drive -> proc ) {
651546 ide_add_proc_entries (drive -> proc , generic_drive_entries , drive );
547+ proc_create_data ("setting" , S_IFREG |S_IRUSR |S_IWUSR ,
548+ drive -> proc , & ide_settings_proc_fops ,
549+ drive );
550+ }
652551 sprintf (name , "ide%d/%s" , (drive -> name [2 ]- 'a' )/2 , drive -> name );
653552 ent = proc_symlink (drive -> name , proc_ide_root , name );
654553 if (!ent ) return ;
@@ -658,6 +557,7 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif)
658557void ide_proc_unregister_device (ide_drive_t * drive )
659558{
660559 if (drive -> proc ) {
560+ remove_proc_entry ("settings" , drive -> proc );
661561 ide_remove_proc_entries (drive -> proc , generic_drive_entries );
662562 remove_proc_entry (drive -> name , proc_ide_root );
663563 remove_proc_entry (drive -> name , drive -> hwif -> proc );
@@ -666,9 +566,9 @@ void ide_proc_unregister_device(ide_drive_t *drive)
666566}
667567
668568static ide_proc_entry_t hwif_entries [] = {
669- { "channel" , S_IFREG |S_IRUGO , & ide_channel_proc_fops },
670- { "mate" , S_IFREG |S_IRUGO , & ide_mate_proc_fops },
671- { "model" , S_IFREG |S_IRUGO , & ide_imodel_proc_fops },
569+ { "channel" , S_IFREG |S_IRUGO , ide_channel_proc_show },
570+ { "mate" , S_IFREG |S_IRUGO , ide_mate_proc_show },
571+ { "model" , S_IFREG |S_IRUGO , ide_imodel_proc_show },
672572 {}
673573};
674574
0 commit comments