aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-proc.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-05-09 18:01:11 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-05-09 18:01:11 -0400
commit5cbf79cdb37be2aa2a1b4fa94144526b14557060 (patch)
tree1fcfbc1248b9904e5890cc593f018ee0a8a53238 /drivers/ide/ide-proc.c
parent869c56ee9de1b72cd3f8ab9cdfbd3601e55c61f2 (diff)
ide: add ide_proc_register_port()
* create_proc_ide_interfaces() tries to add /proc entries for every probed and initialized IDE port, replace it by ide_proc_register_port() which does it only for the given port (also rename destroy_proc_ide_interface() to ide_proc_unregister_port() for consistency) * convert {create,destroy}_proc_ide_interface[s]() users to use new functions * pmac driver depended on proc_ide_create() to add /proc port entries, fix it * au1xxx-ide, swarm and cs5520 drivers depended indirectly on ide-generic driver (CONFIG_IDE_GENERIC=y) to add port /proc entries, fix them * there is now no need to add /proc entries for IDE ports in proc_ide_create() so don't do it * proc_ide_create() needs now to be called before drivers are probed - fix it, while at it make proc_ide_create() create /proc "ide" directory Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-proc.c')
-rw-r--r--drivers/ide/ide-proc.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
index 949a6f609d84..d50bd996ff22 100644
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -39,6 +39,8 @@
39 39
40#include <asm/io.h> 40#include <asm/io.h>
41 41
42static struct proc_dir_entry *proc_ide_root;
43
42static int proc_ide_read_imodel 44static int proc_ide_read_imodel
43 (char *page, char **start, off_t off, int count, int *eof, void *data) 45 (char *page, char **start, off_t off, int count, int *eof, void *data)
44{ 46{
@@ -783,26 +785,24 @@ static ide_proc_entry_t hwif_entries[] = {
783 { NULL, 0, NULL, NULL } 785 { NULL, 0, NULL, NULL }
784}; 786};
785 787
786void create_proc_ide_interfaces(void) 788void ide_proc_register_port(ide_hwif_t *hwif)
787{ 789{
788 int h; 790 if (!hwif->present)
791 return;
789 792
790 for (h = 0; h < MAX_HWIFS; h++) { 793 if (!hwif->proc) {
791 ide_hwif_t *hwif = &ide_hwifs[h]; 794 hwif->proc = proc_mkdir(hwif->name, proc_ide_root);
792 795
793 if (!hwif->present) 796 if (!hwif->proc)
794 continue; 797 return;
795 if (!hwif->proc) { 798
796 hwif->proc = proc_mkdir(hwif->name, proc_ide_root); 799 ide_add_proc_entries(hwif->proc, hwif_entries, hwif);
797 if (!hwif->proc)
798 return;
799 ide_add_proc_entries(hwif->proc, hwif_entries, hwif);
800 }
801 create_proc_ide_drives(hwif);
802 } 800 }
801
802 create_proc_ide_drives(hwif);
803} 803}
804 804
805EXPORT_SYMBOL(create_proc_ide_interfaces); 805EXPORT_SYMBOL_GPL(ide_proc_register_port);
806 806
807#ifdef CONFIG_BLK_DEV_IDEPCI 807#ifdef CONFIG_BLK_DEV_IDEPCI
808void ide_pci_create_host_proc(const char *name, get_info_t *get_info) 808void ide_pci_create_host_proc(const char *name, get_info_t *get_info)
@@ -813,7 +813,7 @@ void ide_pci_create_host_proc(const char *name, get_info_t *get_info)
813EXPORT_SYMBOL_GPL(ide_pci_create_host_proc); 813EXPORT_SYMBOL_GPL(ide_pci_create_host_proc);
814#endif 814#endif
815 815
816void destroy_proc_ide_interface(ide_hwif_t *hwif) 816void ide_proc_unregister_port(ide_hwif_t *hwif)
817{ 817{
818 if (hwif->proc) { 818 if (hwif->proc) {
819 destroy_proc_ide_drives(hwif); 819 destroy_proc_ide_drives(hwif);
@@ -860,11 +860,11 @@ void proc_ide_create(void)
860{ 860{
861 struct proc_dir_entry *entry; 861 struct proc_dir_entry *entry;
862 862
863 proc_ide_root = proc_mkdir("ide", NULL);
864
863 if (!proc_ide_root) 865 if (!proc_ide_root)
864 return; 866 return;
865 867
866 create_proc_ide_interfaces();
867
868 entry = create_proc_entry("drivers", 0, proc_ide_root); 868 entry = create_proc_entry("drivers", 0, proc_ide_root);
869 if (entry) 869 if (entry)
870 entry->proc_fops = &ide_drivers_operations; 870 entry->proc_fops = &ide_drivers_operations;