Skip to content

Commit 5cbf79c

Browse files
committed
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>
1 parent 869c56e commit 5cbf79c

18 files changed

Lines changed: 91 additions & 55 deletions

File tree

‎drivers/ide/arm/icside.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,8 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
591591
state->hwif[0] = hwif;
592592

593593
probe_hwif_init(hwif);
594-
create_proc_ide_interfaces();
594+
595+
ide_proc_register_port(hwif);
595596

596597
return 0;
597598
}
@@ -679,7 +680,9 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
679680

680681
probe_hwif_init(hwif);
681682
probe_hwif_init(mate);
682-
create_proc_ide_interfaces();
683+
684+
ide_proc_register_port(hwif);
685+
ide_proc_register_port(mate);
683686

684687
return 0;
685688

‎drivers/ide/arm/rapide.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
7676
hwif->gendev.parent = &ec->dev;
7777
hwif->noprobe = 0;
7878
probe_hwif_init(hwif);
79-
create_proc_ide_interfaces();
79+
ide_proc_register_port(hwif);
8080
ecard_set_drvdata(ec, hwif);
8181
goto out;
8282
}

‎drivers/ide/ide-generic.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ static int __init ide_generic_init(void)
2222
if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET])
2323
ide_release_lock(); /* for atari only */
2424

25-
create_proc_ide_interfaces();
26-
2725
return 0;
2826
}
2927

‎drivers/ide/ide-probe.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,9 @@ int ideprobe_init (void)
14271427
}
14281428
}
14291429
}
1430+
for (index = 0; index < MAX_HWIFS; ++index)
1431+
if (probe[index])
1432+
ide_proc_register_port(&ide_hwifs[index]);
14301433
return 0;
14311434
}
14321435

‎drivers/ide/ide-proc.c‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939

4040
#include <asm/io.h>
4141

42+
static struct proc_dir_entry *proc_ide_root;
43+
4244
static int proc_ide_read_imodel
4345
(char *page, char **start, off_t off, int count, int *eof, void *data)
4446
{
@@ -783,26 +785,24 @@ static ide_proc_entry_t hwif_entries[] = {
783785
{ NULL, 0, NULL, NULL }
784786
};
785787

786-
void create_proc_ide_interfaces(void)
788+
void ide_proc_register_port(ide_hwif_t *hwif)
787789
{
788-
int h;
790+
if (!hwif->present)
791+
return;
789792

790-
for (h = 0; h < MAX_HWIFS; h++) {
791-
ide_hwif_t *hwif = &ide_hwifs[h];
793+
if (!hwif->proc) {
794+
hwif->proc = proc_mkdir(hwif->name, proc_ide_root);
792795

793-
if (!hwif->present)
794-
continue;
795-
if (!hwif->proc) {
796-
hwif->proc = proc_mkdir(hwif->name, proc_ide_root);
797-
if (!hwif->proc)
798-
return;
799-
ide_add_proc_entries(hwif->proc, hwif_entries, hwif);
800-
}
801-
create_proc_ide_drives(hwif);
796+
if (!hwif->proc)
797+
return;
798+
799+
ide_add_proc_entries(hwif->proc, hwif_entries, hwif);
802800
}
801+
802+
create_proc_ide_drives(hwif);
803803
}
804804

805-
EXPORT_SYMBOL(create_proc_ide_interfaces);
805+
EXPORT_SYMBOL_GPL(ide_proc_register_port);
806806

807807
#ifdef CONFIG_BLK_DEV_IDEPCI
808808
void 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)
813813
EXPORT_SYMBOL_GPL(ide_pci_create_host_proc);
814814
#endif
815815

816-
void destroy_proc_ide_interface(ide_hwif_t *hwif)
816+
void ide_proc_unregister_port(ide_hwif_t *hwif)
817817
{
818818
if (hwif->proc) {
819819
destroy_proc_ide_drives(hwif);
@@ -860,11 +860,11 @@ void proc_ide_create(void)
860860
{
861861
struct proc_dir_entry *entry;
862862

863+
proc_ide_root = proc_mkdir("ide", NULL);
864+
863865
if (!proc_ide_root)
864866
return;
865867

866-
create_proc_ide_interfaces();
867-
868868
entry = create_proc_entry("drivers", 0, proc_ide_root);
869869
if (entry)
870870
entry->proc_fops = &ide_drivers_operations;

‎drivers/ide/ide.c‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,6 @@ static int ide_system_bus_speed(void)
347347
return system_bus_speed;
348348
}
349349

350-
#ifdef CONFIG_IDE_PROC_FS
351-
struct proc_dir_entry *proc_ide_root;
352-
#endif
353-
354350
static struct resource* hwif_request_region(ide_hwif_t *hwif,
355351
unsigned long addr, int num)
356352
{
@@ -594,7 +590,7 @@ void ide_unregister(unsigned int index)
594590

595591
spin_unlock_irq(&ide_lock);
596592

597-
destroy_proc_ide_interface(hwif);
593+
ide_proc_unregister_port(hwif);
598594

599595
hwgroup = hwif->hwgroup;
600596
/*
@@ -799,7 +795,7 @@ int ide_register_hw_with_fixup(hw_regs_t *hw, int initializing,
799795

800796
if (!initializing) {
801797
probe_hwif_init_with_fixup(hwif, fixup);
802-
create_proc_ide_interfaces();
798+
ide_proc_register_port(hwif);
803799
}
804800

805801
if (hwifp)
@@ -1794,9 +1790,7 @@ static int __init ide_init(void)
17941790

17951791
init_ide_data();
17961792

1797-
#ifdef CONFIG_IDE_PROC_FS
1798-
proc_ide_root = proc_mkdir("ide", NULL);
1799-
#endif
1793+
proc_ide_create();
18001794

18011795
#ifdef CONFIG_BLK_DEV_ALI14XX
18021796
if (probe_ali14xx)
@@ -1822,8 +1816,6 @@ static int __init ide_init(void)
18221816
/* Probe for special PCI and other "known" interface chipsets. */
18231817
probe_for_hwifs();
18241818

1825-
proc_ide_create();
1826-
18271819
return 0;
18281820
}
18291821

‎drivers/ide/legacy/ali14xx.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ static int __init ali14xx_probe(void)
223223
probe_hwif_init(hwif);
224224
probe_hwif_init(mate);
225225

226-
create_proc_ide_interfaces();
226+
ide_proc_register_port(hwif);
227+
ide_proc_register_port(mate);
227228

228229
return 0;
229230
}

‎drivers/ide/legacy/dtc2278.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ static int __init dtc2278_probe(void)
138138
probe_hwif_init(hwif);
139139
probe_hwif_init(mate);
140140

141-
create_proc_ide_interfaces();
141+
ide_proc_register_port(hwif);
142+
ide_proc_register_port(mate);
142143

143144
return 0;
144145
}

‎drivers/ide/legacy/ht6560b.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@ int __init ht6560b_init(void)
357357
probe_hwif_init(hwif);
358358
probe_hwif_init(mate);
359359

360-
create_proc_ide_interfaces();
360+
ide_proc_register_port(hwif);
361+
ide_proc_register_port(mate);
361362

362363
return 0;
363364

‎drivers/ide/legacy/qd65xx.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ static int __init qd_probe(int base)
427427
qd_setup(hwif, base, config, QD6500_DEF_DATA, QD6500_DEF_DATA,
428428
&qd6500_tune_drive);
429429

430-
create_proc_ide_interfaces();
430+
ide_proc_register_port(hwif);
431431

432432
return 1;
433433
}
@@ -459,7 +459,7 @@ static int __init qd_probe(int base)
459459
&qd6580_tune_drive);
460460
qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT);
461461

462-
create_proc_ide_interfaces();
462+
ide_proc_register_port(hwif);
463463

464464
return 1;
465465
} else {
@@ -479,7 +479,8 @@ static int __init qd_probe(int base)
479479
&qd6580_tune_drive);
480480
qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT);
481481

482-
create_proc_ide_interfaces();
482+
ide_proc_register_port(hwif);
483+
ide_proc_register_port(mate);
483484

484485
return 0; /* no other qd65xx possible */
485486
}

0 commit comments

Comments
 (0)