aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
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
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')
-rw-r--r--drivers/ide/arm/icside.c7
-rw-r--r--drivers/ide/arm/rapide.c2
-rw-r--r--drivers/ide/ide-generic.c2
-rw-r--r--drivers/ide/ide-probe.c3
-rw-r--r--drivers/ide/ide-proc.c34
-rw-r--r--drivers/ide/ide.c14
-rw-r--r--drivers/ide/legacy/ali14xx.c3
-rw-r--r--drivers/ide/legacy/dtc2278.c3
-rw-r--r--drivers/ide/legacy/ht6560b.c3
-rw-r--r--drivers/ide/legacy/qd65xx.c7
-rw-r--r--drivers/ide/legacy/umc8672.c3
-rw-r--r--drivers/ide/mips/au1xxx-ide.c3
-rw-r--r--drivers/ide/mips/swarm.c3
-rw-r--r--drivers/ide/pci/cs5520.c20
-rw-r--r--drivers/ide/pci/sgiioc4.c2
-rw-r--r--drivers/ide/ppc/pmac.c2
-rw-r--r--drivers/ide/setup-pci.c25
17 files changed, 87 insertions, 49 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index f383ace2a087..1fe0457243db 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -591,7 +591,8 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
591 state->hwif[0] = hwif; 591 state->hwif[0] = hwif;
592 592
593 probe_hwif_init(hwif); 593 probe_hwif_init(hwif);
594 create_proc_ide_interfaces(); 594
595 ide_proc_register_port(hwif);
595 596
596 return 0; 597 return 0;
597} 598}
@@ -679,7 +680,9 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
679 680
680 probe_hwif_init(hwif); 681 probe_hwif_init(hwif);
681 probe_hwif_init(mate); 682 probe_hwif_init(mate);
682 create_proc_ide_interfaces(); 683
684 ide_proc_register_port(hwif);
685 ide_proc_register_port(mate);
683 686
684 return 0; 687 return 0;
685 688
diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c
index 9c6c49fdd2b1..890ea3fac3c6 100644
--- a/drivers/ide/arm/rapide.c
+++ b/drivers/ide/arm/rapide.c
@@ -76,7 +76,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
76 hwif->gendev.parent = &ec->dev; 76 hwif->gendev.parent = &ec->dev;
77 hwif->noprobe = 0; 77 hwif->noprobe = 0;
78 probe_hwif_init(hwif); 78 probe_hwif_init(hwif);
79 create_proc_ide_interfaces(); 79 ide_proc_register_port(hwif);
80 ecard_set_drvdata(ec, hwif); 80 ecard_set_drvdata(ec, hwif);
81 goto out; 81 goto out;
82 } 82 }
diff --git a/drivers/ide/ide-generic.c b/drivers/ide/ide-generic.c
index 99fd56151131..0f72b98d727f 100644
--- a/drivers/ide/ide-generic.c
+++ b/drivers/ide/ide-generic.c
@@ -22,8 +22,6 @@ static int __init ide_generic_init(void)
22 if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET]) 22 if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET])
23 ide_release_lock(); /* for atari only */ 23 ide_release_lock(); /* for atari only */
24 24
25 create_proc_ide_interfaces();
26
27 return 0; 25 return 0;
28} 26}
29 27
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 8f15c23aa70d..3cebed77f55d 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1427,6 +1427,9 @@ int ideprobe_init (void)
1427 } 1427 }
1428 } 1428 }
1429 } 1429 }
1430 for (index = 0; index < MAX_HWIFS; ++index)
1431 if (probe[index])
1432 ide_proc_register_port(&ide_hwifs[index]);
1430 return 0; 1433 return 0;
1431} 1434}
1432 1435
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;
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 0fc532850bbe..038f2610e734 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -347,10 +347,6 @@ static int ide_system_bus_speed(void)
347 return system_bus_speed; 347 return system_bus_speed;
348} 348}
349 349
350#ifdef CONFIG_IDE_PROC_FS
351struct proc_dir_entry *proc_ide_root;
352#endif
353
354static struct resource* hwif_request_region(ide_hwif_t *hwif, 350static struct resource* hwif_request_region(ide_hwif_t *hwif,
355 unsigned long addr, int num) 351 unsigned long addr, int num)
356{ 352{
@@ -594,7 +590,7 @@ void ide_unregister(unsigned int index)
594 590
595 spin_unlock_irq(&ide_lock); 591 spin_unlock_irq(&ide_lock);
596 592
597 destroy_proc_ide_interface(hwif); 593 ide_proc_unregister_port(hwif);
598 594
599 hwgroup = hwif->hwgroup; 595 hwgroup = hwif->hwgroup;
600 /* 596 /*
@@ -799,7 +795,7 @@ found:
799 795
800 if (!initializing) { 796 if (!initializing) {
801 probe_hwif_init_with_fixup(hwif, fixup); 797 probe_hwif_init_with_fixup(hwif, fixup);
802 create_proc_ide_interfaces(); 798 ide_proc_register_port(hwif);
803 } 799 }
804 800
805 if (hwifp) 801 if (hwifp)
@@ -1794,9 +1790,7 @@ static int __init ide_init(void)
1794 1790
1795 init_ide_data(); 1791 init_ide_data();
1796 1792
1797#ifdef CONFIG_IDE_PROC_FS 1793 proc_ide_create();
1798 proc_ide_root = proc_mkdir("ide", NULL);
1799#endif
1800 1794
1801#ifdef CONFIG_BLK_DEV_ALI14XX 1795#ifdef CONFIG_BLK_DEV_ALI14XX
1802 if (probe_ali14xx) 1796 if (probe_ali14xx)
@@ -1822,8 +1816,6 @@ static int __init ide_init(void)
1822 /* Probe for special PCI and other "known" interface chipsets. */ 1816 /* Probe for special PCI and other "known" interface chipsets. */
1823 probe_for_hwifs(); 1817 probe_for_hwifs();
1824 1818
1825 proc_ide_create();
1826
1827 return 0; 1819 return 0;
1828} 1820}
1829 1821
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
index 91961aa03047..df17ed68c0bc 100644
--- a/drivers/ide/legacy/ali14xx.c
+++ b/drivers/ide/legacy/ali14xx.c
@@ -223,7 +223,8 @@ static int __init ali14xx_probe(void)
223 probe_hwif_init(hwif); 223 probe_hwif_init(hwif);
224 probe_hwif_init(mate); 224 probe_hwif_init(mate);
225 225
226 create_proc_ide_interfaces(); 226 ide_proc_register_port(hwif);
227 ide_proc_register_port(mate);
227 228
228 return 0; 229 return 0;
229} 230}
diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c
index 0219ffa64db6..36a3f0ac6162 100644
--- a/drivers/ide/legacy/dtc2278.c
+++ b/drivers/ide/legacy/dtc2278.c
@@ -138,7 +138,8 @@ static int __init dtc2278_probe(void)
138 probe_hwif_init(hwif); 138 probe_hwif_init(hwif);
139 probe_hwif_init(mate); 139 probe_hwif_init(mate);
140 140
141 create_proc_ide_interfaces(); 141 ide_proc_register_port(hwif);
142 ide_proc_register_port(mate);
142 143
143 return 0; 144 return 0;
144} 145}
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
index a2832643c522..c8f353b1296f 100644
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -357,7 +357,8 @@ int __init ht6560b_init(void)
357 probe_hwif_init(hwif); 357 probe_hwif_init(hwif);
358 probe_hwif_init(mate); 358 probe_hwif_init(mate);
359 359
360 create_proc_ide_interfaces(); 360 ide_proc_register_port(hwif);
361 ide_proc_register_port(mate);
361 362
362 return 0; 363 return 0;
363 364
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index 2fb8f50f1293..d1414a75b523 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -427,7 +427,7 @@ static int __init qd_probe(int base)
427 qd_setup(hwif, base, config, QD6500_DEF_DATA, QD6500_DEF_DATA, 427 qd_setup(hwif, base, config, QD6500_DEF_DATA, QD6500_DEF_DATA,
428 &qd6500_tune_drive); 428 &qd6500_tune_drive);
429 429
430 create_proc_ide_interfaces(); 430 ide_proc_register_port(hwif);
431 431
432 return 1; 432 return 1;
433 } 433 }
@@ -459,7 +459,7 @@ static int __init qd_probe(int base)
459 &qd6580_tune_drive); 459 &qd6580_tune_drive);
460 qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); 460 qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT);
461 461
462 create_proc_ide_interfaces(); 462 ide_proc_register_port(hwif);
463 463
464 return 1; 464 return 1;
465 } else { 465 } else {
@@ -479,7 +479,8 @@ static int __init qd_probe(int base)
479 &qd6580_tune_drive); 479 &qd6580_tune_drive);
480 qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); 480 qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT);
481 481
482 create_proc_ide_interfaces(); 482 ide_proc_register_port(hwif);
483 ide_proc_register_port(mate);
483 484
484 return 0; /* no other qd65xx possible */ 485 return 0; /* no other qd65xx possible */
485 } 486 }
diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c
index ca7974455578..ddc403a0bd82 100644
--- a/drivers/ide/legacy/umc8672.c
+++ b/drivers/ide/legacy/umc8672.c
@@ -160,7 +160,8 @@ static int __init umc8672_probe(void)
160 probe_hwif_init(hwif); 160 probe_hwif_init(hwif);
161 probe_hwif_init(mate); 161 probe_hwif_init(mate);
162 162
163 create_proc_ide_interfaces(); 163 ide_proc_register_port(hwif);
164 ide_proc_register_port(mate);
164 165
165 return 0; 166 return 0;
166} 167}
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index d54d9fe92a7d..ca95e990862e 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -760,6 +760,9 @@ static int au_ide_probe(struct device *dev)
760#endif 760#endif
761 761
762 probe_hwif_init(hwif); 762 probe_hwif_init(hwif);
763
764 ide_proc_register_port(hwif);
765
763 dev_set_drvdata(dev, hwif); 766 dev_set_drvdata(dev, hwif);
764 767
765 printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode ); 768 printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode );
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c
index 81fa06851b27..6e935d7c63fd 100644
--- a/drivers/ide/mips/swarm.c
+++ b/drivers/ide/mips/swarm.c
@@ -129,6 +129,9 @@ static int __devinit swarm_ide_probe(struct device *dev)
129 hwif->irq = hwif->hw.irq; 129 hwif->irq = hwif->hw.irq;
130 130
131 probe_hwif_init(hwif); 131 probe_hwif_init(hwif);
132
133 ide_proc_register_port(hwif);
134
132 dev_set_drvdata(dev, hwif); 135 dev_set_drvdata(dev, hwif);
133 136
134 return 0; 137 return 0;
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
index 400859a839f7..3b88a3a56116 100644
--- a/drivers/ide/pci/cs5520.c
+++ b/drivers/ide/pci/cs5520.c
@@ -213,6 +213,7 @@ static ide_pci_device_t cyrix_chipsets[] __devinitdata = {
213 213
214static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) 214static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id)
215{ 215{
216 ide_hwif_t *hwif = NULL, *mate = NULL;
216 ata_index_t index; 217 ata_index_t index;
217 ide_pci_device_t *d = &cyrix_chipsets[id->driver_data]; 218 ide_pci_device_t *d = &cyrix_chipsets[id->driver_data];
218 219
@@ -239,10 +240,21 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic
239 240
240 ide_pci_setup_ports(dev, d, 14, &index); 241 ide_pci_setup_ports(dev, d, 14, &index);
241 242
242 if((index.b.low & 0xf0) != 0xf0) 243 if ((index.b.low & 0xf0) != 0xf0)
243 probe_hwif_init(&ide_hwifs[index.b.low]); 244 hwif = &ide_hwifs[index.b.low];
244 if((index.b.high & 0xf0) != 0xf0) 245 if ((index.b.high & 0xf0) != 0xf0)
245 probe_hwif_init(&ide_hwifs[index.b.high]); 246 mate = &ide_hwifs[index.b.high];
247
248 if (hwif)
249 probe_hwif_init(hwif);
250 if (mate)
251 probe_hwif_init(mate);
252
253 if (hwif)
254 ide_proc_register_port(hwif);
255 if (mate)
256 ide_proc_register_port(mate);
257
246 return 0; 258 return 0;
247} 259}
248 260
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index fd09b295a69d..d3185e29a38e 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -692,7 +692,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t * d)
692 return -EIO; 692 return -EIO;
693 693
694 /* Create /proc/ide entries */ 694 /* Create /proc/ide entries */
695 create_proc_ide_interfaces(); 695 ide_proc_register_port(hwif);
696 696
697 return 0; 697 return 0;
698} 698}
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index a49ebe44babd..45fc36f0f219 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1276,6 +1276,8 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1276 /* We probe the hwif now */ 1276 /* We probe the hwif now */
1277 probe_hwif_init(hwif); 1277 probe_hwif_init(hwif);
1278 1278
1279 ide_proc_register_port(hwif);
1280
1279 return 0; 1281 return 0;
1280} 1282}
1281 1283
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 118fb3205ca8..892cda755782 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -702,6 +702,7 @@ out:
702 702
703int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d) 703int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d)
704{ 704{
705 ide_hwif_t *hwif = NULL, *mate = NULL;
705 ata_index_t index_list; 706 ata_index_t index_list;
706 int ret; 707 int ret;
707 708
@@ -710,11 +711,19 @@ int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d)
710 goto out; 711 goto out;
711 712
712 if ((index_list.b.low & 0xf0) != 0xf0) 713 if ((index_list.b.low & 0xf0) != 0xf0)
713 probe_hwif_init_with_fixup(&ide_hwifs[index_list.b.low], d->fixup); 714 hwif = &ide_hwifs[index_list.b.low];
714 if ((index_list.b.high & 0xf0) != 0xf0) 715 if ((index_list.b.high & 0xf0) != 0xf0)
715 probe_hwif_init_with_fixup(&ide_hwifs[index_list.b.high], d->fixup); 716 mate = &ide_hwifs[index_list.b.high];
716 717
717 create_proc_ide_interfaces(); 718 if (hwif)
719 probe_hwif_init_with_fixup(hwif, d->fixup);
720 if (mate)
721 probe_hwif_init_with_fixup(mate, d->fixup);
722
723 if (hwif)
724 ide_proc_register_port(hwif);
725 if (mate)
726 ide_proc_register_port(mate);
718out: 727out:
719 return ret; 728 return ret;
720} 729}
@@ -748,7 +757,15 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2,
748 } 757 }
749 } 758 }
750 759
751 create_proc_ide_interfaces(); 760 for (i = 0; i < 2; i++) {
761 u8 idx[2] = { index_list[i].b.low, index_list[i].b.high };
762 int j;
763
764 for (j = 0; j < 2; j++) {
765 if ((idx[j] & 0xf0) != 0xf0)
766 ide_proc_register_port(ide_hwifs + idx[j]);
767 }
768 }
752out: 769out:
753 return ret; 770 return ret;
754} 771}