diff options
Diffstat (limited to 'drivers/ide/ide-proc.c')
-rw-r--r-- | drivers/ide/ide-proc.c | 136 |
1 files changed, 18 insertions, 118 deletions
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index b3b8b8822d6a..45c997430332 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
@@ -56,19 +56,6 @@ static int ide_imodel_proc_show(struct seq_file *m, void *v) | |||
56 | return 0; | 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 | static int ide_mate_proc_show(struct seq_file *m, void *v) | 59 | static int ide_mate_proc_show(struct seq_file *m, void *v) |
73 | { | 60 | { |
74 | ide_hwif_t *hwif = (ide_hwif_t *) m->private; | 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 | return 0; | 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 | static int ide_channel_proc_show(struct seq_file *m, void *v) | 70 | static int ide_channel_proc_show(struct seq_file *m, void *v) |
97 | { | 71 | { |
98 | ide_hwif_t *hwif = (ide_hwif_t *) m->private; | 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 | return 0; | 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 | static int ide_identify_proc_show(struct seq_file *m, void *v) | 78 | static int ide_identify_proc_show(struct seq_file *m, void *v) |
118 | { | 79 | { |
119 | ide_drive_t *drive = (ide_drive_t *)m->private; | 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 | return 0; | 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 | * ide_find_setting - find a specific setting | 106 | * ide_find_setting - find a specific setting |
159 | * @st: setting table pointer | 107 | * @st: setting table pointer |
@@ -441,27 +389,14 @@ static const struct file_operations ide_settings_proc_fops = { | |||
441 | .write = ide_settings_proc_write, | 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 | seq_printf(m, "%llu\n", (long long)0x7fffffff); | 394 | seq_printf(m, "%llu\n", (long long)0x7fffffff); |
447 | return 0; | 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) | 399 | int ide_geometry_proc_show(struct seq_file *m, void *v) |
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) | ||
465 | { | 400 | { |
466 | ide_drive_t *drive = (ide_drive_t *) m->private; | 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 | drive->bios_cyl, drive->bios_head, drive->bios_sect); | 406 | drive->bios_cyl, drive->bios_head, drive->bios_sect); |
472 | return 0; | 407 | return 0; |
473 | } | 408 | } |
474 | 409 | EXPORT_SYMBOL(ide_geometry_proc_show); | |
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); | ||
488 | 410 | ||
489 | static int ide_dmodel_proc_show(struct seq_file *seq, void *v) | 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 | return 0; | 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 | static int ide_driver_proc_show(struct seq_file *m, void *v) | 420 | static int ide_driver_proc_show(struct seq_file *m, void *v) |
512 | { | 421 | { |
513 | ide_drive_t *drive = (ide_drive_t *)m->private; | 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 | return 0; | 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 | static int ide_media_proc_show(struct seq_file *m, void *v) | 435 | static int ide_media_proc_show(struct seq_file *m, void *v) |
540 | { | 436 | { |
541 | ide_drive_t *drive = (ide_drive_t *) m->private; | 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 | static ide_proc_entry_t generic_drive_entries[] = { | 465 | static ide_proc_entry_t generic_drive_entries[] = { |
570 | { "driver", S_IFREG|S_IRUGO, &ide_driver_proc_fops }, | 466 | { "driver", S_IFREG|S_IRUGO, ide_driver_proc_show }, |
571 | { "identify", S_IFREG|S_IRUSR, &ide_identify_proc_fops}, | 467 | { "identify", S_IFREG|S_IRUSR, ide_identify_proc_show }, |
572 | { "media", S_IFREG|S_IRUGO, &ide_media_proc_fops }, | 468 | { "media", S_IFREG|S_IRUGO, ide_media_proc_show }, |
573 | { "model", S_IFREG|S_IRUGO, &ide_dmodel_proc_fops }, | 469 | { "model", S_IFREG|S_IRUGO, ide_dmodel_proc_show }, |
574 | { "settings", S_IFREG|S_IRUSR|S_IWUSR, &ide_settings_proc_fops}, | ||
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 | if (!dir || !p) | 477 | if (!dir || !p) |
583 | return; | 478 | return; |
584 | while (p->name != NULL) { | 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 | if (!ent) return; | 481 | if (!ent) return; |
587 | p++; | 482 | p++; |
588 | } | 483 | } |
@@ -647,8 +542,12 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif) | |||
647 | continue; | 542 | continue; |
648 | 543 | ||
649 | drive->proc = proc_mkdir(drive->name, parent); | 544 | drive->proc = proc_mkdir(drive->name, parent); |
650 | if (drive->proc) | 545 | if (drive->proc) { |
651 | ide_add_proc_entries(drive->proc, generic_drive_entries, drive); | 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 | sprintf(name, "ide%d/%s", (drive->name[2]-'a')/2, drive->name); | 551 | sprintf(name, "ide%d/%s", (drive->name[2]-'a')/2, drive->name); |
653 | ent = proc_symlink(drive->name, proc_ide_root, name); | 552 | ent = proc_symlink(drive->name, proc_ide_root, name); |
654 | if (!ent) return; | 553 | if (!ent) return; |
@@ -658,6 +557,7 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif) | |||
658 | void ide_proc_unregister_device(ide_drive_t *drive) | 557 | void ide_proc_unregister_device(ide_drive_t *drive) |
659 | { | 558 | { |
660 | if (drive->proc) { | 559 | if (drive->proc) { |
560 | remove_proc_entry("settings", drive->proc); | ||
661 | ide_remove_proc_entries(drive->proc, generic_drive_entries); | 561 | ide_remove_proc_entries(drive->proc, generic_drive_entries); |
662 | remove_proc_entry(drive->name, proc_ide_root); | 562 | remove_proc_entry(drive->name, proc_ide_root); |
663 | remove_proc_entry(drive->name, drive->hwif->proc); | 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 | static ide_proc_entry_t hwif_entries[] = { | 568 | static ide_proc_entry_t hwif_entries[] = { |
669 | { "channel", S_IFREG|S_IRUGO, &ide_channel_proc_fops }, | 569 | { "channel", S_IFREG|S_IRUGO, ide_channel_proc_show }, |
670 | { "mate", S_IFREG|S_IRUGO, &ide_mate_proc_fops }, | 570 | { "mate", S_IFREG|S_IRUGO, ide_mate_proc_show }, |
671 | { "model", S_IFREG|S_IRUGO, &ide_imodel_proc_fops }, | 571 | { "model", S_IFREG|S_IRUGO, ide_imodel_proc_show }, |
672 | {} | 572 | {} |
673 | }; | 573 | }; |
674 | 574 | ||