From 8447d9d52adbe4c653482bd0d5ccb9b5d26f9c9d Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 20 Oct 2007 00:32:31 +0200 Subject: ide: add ide_device_add() * Add ide_device_add() helper and convert host drivers to use it instead of open-coded variants. * Make ide_pci_setup_ports() and do_ide_setup_pci_device() take 'u8 *idx' argument instead of 'ata_index_t *index'. * Remove no longer needed ata_index_t. * Unexport probe_hwif_init() and make it static. * Unexport ide_proc_register_port(). There should be no functionality changes caused by this patch (sgiioc4.c: ide_proc_register_port() requires hwif->present to be set and it won't be set if probe_hwif_init() fails). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/legacy/ali14xx.c | 7 ++----- drivers/ide/legacy/dtc2278.c | 7 ++----- drivers/ide/legacy/ht6560b.c | 7 ++----- drivers/ide/legacy/ide_platform.c | 6 ++++-- drivers/ide/legacy/qd65xx.c | 21 ++++++++++----------- drivers/ide/legacy/umc8672.c | 9 +++------ 6 files changed, 23 insertions(+), 34 deletions(-) (limited to 'drivers/ide/legacy') diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c index 2f0ef9b4403..0973c85e49b 100644 --- a/drivers/ide/legacy/ali14xx.c +++ b/drivers/ide/legacy/ali14xx.c @@ -193,6 +193,7 @@ static int __init initRegisters (void) { static int __init ali14xx_probe(void) { ide_hwif_t *hwif, *mate; + static u8 idx[4] = { 0, 1, 0xff, 0xff }; printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", basePort, regOn); @@ -217,11 +218,7 @@ static int __init ali14xx_probe(void) mate->mate = hwif; mate->channel = 1; - probe_hwif_init(hwif); - probe_hwif_init(mate); - - ide_proc_register_port(hwif); - ide_proc_register_port(mate); + ide_device_add(idx); return 0; } diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c index f1652125486..12a7182b4ad 100644 --- a/drivers/ide/legacy/dtc2278.c +++ b/drivers/ide/legacy/dtc2278.c @@ -94,6 +94,7 @@ static int __init dtc2278_probe(void) { unsigned long flags; ide_hwif_t *hwif, *mate; + static u8 idx[4] = { 0, 1, 0xff, 0xff }; hwif = &ide_hwifs[0]; mate = &ide_hwifs[1]; @@ -134,11 +135,7 @@ static int __init dtc2278_probe(void) mate->mate = hwif; mate->channel = 1; - probe_hwif_init(hwif); - probe_hwif_init(mate); - - ide_proc_register_port(hwif); - ide_proc_register_port(mate); + ide_device_add(idx); return 0; } diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c index 2e5a9cc5c0f..7f0d433cb9d 100644 --- a/drivers/ide/legacy/ht6560b.c +++ b/drivers/ide/legacy/ht6560b.c @@ -311,6 +311,7 @@ MODULE_PARM_DESC(probe, "probe for HT6560B chipset"); int __init ht6560b_init(void) { ide_hwif_t *hwif, *mate; + static u8 idx[4] = { 0, 1, 0xff, 0xff }; int t; if (probe_ht6560b == 0) @@ -359,11 +360,7 @@ int __init ht6560b_init(void) mate->drives[0].drive_data = t; mate->drives[1].drive_data = t; - probe_hwif_init(hwif); - probe_hwif_init(mate); - - ide_proc_register_port(hwif); - ide_proc_register_port(mate); + ide_device_add(idx); return 0; diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c index b992b2b91fe..9a153915f3c 100644 --- a/drivers/ide/legacy/ide_platform.c +++ b/drivers/ide/legacy/ide_platform.c @@ -83,6 +83,7 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) struct resource *res_base, *res_alt, *res_irq; ide_hwif_t *hwif; struct pata_platform_info *pdata; + u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; int ret = 0; int mmio = 0; @@ -130,10 +131,11 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) hwif->gendev.parent = &pdev->dev; hwif->noprobe = 0; - probe_hwif_init(hwif); + idx[0] = hwif->index; + + ide_device_add(idx); platform_set_drvdata(pdev, hwif); - ide_proc_register_port(hwif); return 0; diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 0c81d2d0b94..85104bc79a1 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c @@ -389,6 +389,7 @@ static void __exit qd_unsetup(ide_hwif_t *hwif) static int __init qd_probe(int base) { ide_hwif_t *hwif; + u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; u8 config; u8 unit; @@ -419,9 +420,9 @@ static int __init qd_probe(int base) hwif->set_pio_mode = &qd6500_set_pio_mode; - probe_hwif_init(hwif); + idx[0] = unit; - ide_proc_register_port(hwif); + ide_device_add(idx); return 1; } @@ -453,11 +454,11 @@ static int __init qd_probe(int base) hwif->set_pio_mode = &qd6580_set_pio_mode; - probe_hwif_init(hwif); + idx[0] = unit; - qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); + ide_device_add(idx); - ide_proc_register_port(hwif); + qd_write_reg(QD_DEF_CONTR, QD_CONTROL_PORT); return 1; } else { @@ -474,19 +475,17 @@ static int __init qd_probe(int base) hwif->set_pio_mode = &qd6580_set_pio_mode; - probe_hwif_init(hwif); - qd_setup(mate, base, config | (control << 8), QD6580_DEF_DATA2, QD6580_DEF_DATA2); mate->set_pio_mode = &qd6580_set_pio_mode; - probe_hwif_init(mate); + idx[0] = 0; + idx[1] = 1; - qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); + ide_device_add(idx); - ide_proc_register_port(hwif); - ide_proc_register_port(mate); + qd_write_reg(QD_DEF_CONTR, QD_CONTROL_PORT); return 0; /* no other qd65xx possible */ } diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c index 1151c92dd53..79577b91687 100644 --- a/drivers/ide/legacy/umc8672.c +++ b/drivers/ide/legacy/umc8672.c @@ -124,8 +124,9 @@ static void umc_set_pio_mode(ide_drive_t *drive, const u8 pio) static int __init umc8672_probe(void) { - unsigned long flags; ide_hwif_t *hwif, *mate; + unsigned long flags; + static u8 idx[4] = { 0, 1, 0xff, 0xff }; if (!request_region(0x108, 2, "umc8672")) { printk(KERN_ERR "umc8672: ports 0x108-0x109 already in use.\n"); @@ -158,11 +159,7 @@ static int __init umc8672_probe(void) mate->mate = hwif; mate->channel = 1; - probe_hwif_init(hwif); - probe_hwif_init(mate); - - ide_proc_register_port(hwif); - ide_proc_register_port(mate); + ide_device_add(idx); return 0; } -- cgit v1.2.3