@@ -56,19 +56,6 @@ static int ide_imodel_proc_show(struct seq_file *m, void *v)
56
56
return 0 ;
57
57
}
58
58
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
-
72
59
static int ide_mate_proc_show (struct seq_file * m , void * v )
73
60
{
74
61
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)
80
67
return 0 ;
81
68
}
82
69
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
-
96
70
static int ide_channel_proc_show (struct seq_file * m , void * v )
97
71
{
98
72
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)
101
75
return 0 ;
102
76
}
103
77
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
-
117
78
static int ide_identify_proc_show (struct seq_file * m , void * v )
118
79
{
119
80
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)
141
102
return 0 ;
142
103
}
143
104
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
-
157
105
/**
158
106
* ide_find_setting - find a specific setting
159
107
* @st: setting table pointer
@@ -441,27 +389,14 @@ static const struct file_operations ide_settings_proc_fops = {
441
389
.write = ide_settings_proc_write ,
442
390
};
443
391
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 )
445
393
{
446
394
seq_printf (m , "%llu\n" , (long long )0x7fffffff );
447
395
return 0 ;
448
396
}
397
+ EXPORT_SYMBOL_GPL (ide_capacity_proc_show );
449
398
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 )
465
400
{
466
401
ide_drive_t * drive = (ide_drive_t * ) m -> private ;
467
402
@@ -471,20 +406,7 @@ static int ide_geometry_proc_show(struct seq_file *m, void *v)
471
406
drive -> bios_cyl , drive -> bios_head , drive -> bios_sect );
472
407
return 0 ;
473
408
}
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 );
488
410
489
411
static int ide_dmodel_proc_show (struct seq_file * seq , void * v )
490
412
{
@@ -495,19 +417,6 @@ static int ide_dmodel_proc_show(struct seq_file *seq, void *v)
495
417
return 0 ;
496
418
}
497
419
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
-
511
420
static int ide_driver_proc_show (struct seq_file * m , void * v )
512
421
{
513
422
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)
523
432
return 0 ;
524
433
}
525
434
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
-
539
435
static int ide_media_proc_show (struct seq_file * m , void * v )
540
436
{
541
437
ide_drive_t * drive = (ide_drive_t * ) m -> private ;
@@ -567,11 +463,10 @@ static const struct file_operations ide_media_proc_fops = {
567
463
};
568
464
569
465
static 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 },
575
470
{}
576
471
};
577
472
@@ -582,7 +477,7 @@ static void ide_add_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p
582
477
if (!dir || !p )
583
478
return ;
584
479
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 );
586
481
if (!ent ) return ;
587
482
p ++ ;
588
483
}
@@ -647,8 +542,12 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif)
647
542
continue ;
648
543
649
544
drive -> proc = proc_mkdir (drive -> name , parent );
650
- if (drive -> proc )
545
+ if (drive -> proc ) {
651
546
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
+ }
652
551
sprintf (name , "ide%d/%s" , (drive -> name [2 ]- 'a' )/2 , drive -> name );
653
552
ent = proc_symlink (drive -> name , proc_ide_root , name );
654
553
if (!ent ) return ;
@@ -658,6 +557,7 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif)
658
557
void ide_proc_unregister_device (ide_drive_t * drive )
659
558
{
660
559
if (drive -> proc ) {
560
+ remove_proc_entry ("settings" , drive -> proc );
661
561
ide_remove_proc_entries (drive -> proc , generic_drive_entries );
662
562
remove_proc_entry (drive -> name , proc_ide_root );
663
563
remove_proc_entry (drive -> name , drive -> hwif -> proc );
@@ -666,9 +566,9 @@ void ide_proc_unregister_device(ide_drive_t *drive)
666
566
}
667
567
668
568
static 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 },
672
572
{}
673
573
};
674
574
0 commit comments