aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:16 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:16 -0400
commit0bfeee7d4190938291a76536c7f6cd8f4e2dc30c (patch)
tree94d8a02a4f184852836ae1e1ef5cbb8415238127 /drivers/ide/legacy
parent3b36f66b81bc0d69ec7dfa736592224f6ca366b7 (diff)
ide: use ide_legacy_device_add() for qd65xx (take 2)
* Add 'unsigned long config' argument to ide_legacy_device_add() for setting hwif->config_data. * Use ide_find_port_slot() instead of ide_find_port() in ide_legacy_device_add(). * Handle IDE_HFLAG_QD_2ND_PORT and IDE_HFLAG_SINGLE host flags in ide_legacy_device_add(). * Convert qd65xx host driver to use ide_legacy_device_add(). v2: * Update ali14xx, dtc2278, ht6560b and umc8672 host drivers. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy')
-rw-r--r--drivers/ide/legacy/ali14xx.c2
-rw-r--r--drivers/ide/legacy/dtc2278.c2
-rw-r--r--drivers/ide/legacy/ht6560b.c2
-rw-r--r--drivers/ide/legacy/qd65xx.c58
-rw-r--r--drivers/ide/legacy/umc8672.c2
5 files changed, 11 insertions, 55 deletions
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
index 24bd7838aec5..7bfb28edf511 100644
--- a/drivers/ide/legacy/ali14xx.c
+++ b/drivers/ide/legacy/ali14xx.c
@@ -214,7 +214,7 @@ static int __init ali14xx_probe(void)
214 return 1; 214 return 1;
215 } 215 }
216 216
217 return ide_legacy_device_add(&ali14xx_port_info); 217 return ide_legacy_device_add(&ali14xx_port_info, 0);
218} 218}
219 219
220int probe_ali14xx; 220int probe_ali14xx;
diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c
index 92d119ba92af..7b5585c1c4c0 100644
--- a/drivers/ide/legacy/dtc2278.c
+++ b/drivers/ide/legacy/dtc2278.c
@@ -125,7 +125,7 @@ static int __init dtc2278_probe(void)
125#endif 125#endif
126 local_irq_restore(flags); 126 local_irq_restore(flags);
127 127
128 return ide_legacy_device_add(&dtc2278_port_info); 128 return ide_legacy_device_add(&dtc2278_port_info, 0);
129} 129}
130 130
131int probe_dtc2278 = 0; 131int probe_dtc2278 = 0;
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
index e4e38c3cd8ac..558964fc994e 100644
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -360,7 +360,7 @@ static int __init ht6560b_init(void)
360 goto release_region; 360 goto release_region;
361 } 361 }
362 362
363 return ide_legacy_device_add(&ht6560b_port_info); 363 return ide_legacy_device_add(&ht6560b_port_info, 0);
364 364
365release_region: 365release_region:
366 release_region(HT_CONFIG_PORT, 1); 366 release_region(HT_CONFIG_PORT, 1);
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index 65f098d15154..d8a05b57277b 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -333,10 +333,8 @@ static const struct ide_port_info qd65xx_port_info __initdata = {
333 333
334static int __init qd_probe(int base) 334static int __init qd_probe(int base)
335{ 335{
336 ide_hwif_t *hwif; 336 int rc;
337 u8 config, unit; 337 u8 config, unit;
338 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
339 hw_regs_t hw[2];
340 struct ide_port_info d = qd65xx_port_info; 338 struct ide_port_info d = qd65xx_port_info;
341 339
342 config = inb(QD_CONFIG_PORT); 340 config = inb(QD_CONFIG_PORT);
@@ -349,14 +347,6 @@ static int __init qd_probe(int base)
349 if (unit) 347 if (unit)
350 d.host_flags |= IDE_HFLAG_QD_2ND_PORT; 348 d.host_flags |= IDE_HFLAG_QD_2ND_PORT;
351 349
352 memset(&hw, 0, sizeof(hw));
353
354 ide_std_init_ports(&hw[0], 0x1f0, 0x3f6);
355 hw[0].irq = 14;
356
357 ide_std_init_ports(&hw[1], 0x170, 0x376);
358 hw[1].irq = 15;
359
360 if ((config & 0xf0) == QD_CONFIG_QD6500) { 350 if ((config & 0xf0) == QD_CONFIG_QD6500) {
361 351
362 if (qd_testreg(base)) 352 if (qd_testreg(base))
@@ -376,19 +366,9 @@ static int __init qd_probe(int base)
376 d.port_ops = &qd6500_port_ops; 366 d.port_ops = &qd6500_port_ops;
377 d.host_flags |= IDE_HFLAG_SINGLE; 367 d.host_flags |= IDE_HFLAG_SINGLE;
378 368
379 hwif = ide_find_port_slot(&d); 369 rc = ide_legacy_device_add(&d, (base << 8) | config);
380 if (hwif == NULL)
381 return -ENOENT;
382
383 ide_init_port_hw(hwif, &hw[unit]);
384 370
385 hwif->config_data = (base << 8) | config; 371 return (rc == 0) ? 1 : rc;
386
387 idx[unit] = hwif->index;
388
389 ide_device_add(idx, &d);
390
391 return 1;
392 } 372 }
393 373
394 if (((config & 0xf0) == QD_CONFIG_QD6580_A) || 374 if (((config & 0xf0) == QD_CONFIG_QD6580_A) ||
@@ -418,40 +398,16 @@ static int __init qd_probe(int base)
418 398
419 d.host_flags |= IDE_HFLAG_SINGLE; 399 d.host_flags |= IDE_HFLAG_SINGLE;
420 400
421 hwif = ide_find_port_slot(&d); 401 rc = ide_legacy_device_add(&d, (base << 8) | config);
422 if (hwif == NULL)
423 return -ENOENT;
424 402
425 ide_init_port_hw(hwif, &hw[unit]); 403 return (rc == 0) ? 1 : rc;
426
427 hwif->config_data = (base << 8) | config;
428
429 idx[unit] = hwif->index;
430
431 ide_device_add(idx, &d);
432
433 return 1;
434 } else { 404 } else {
435 ide_hwif_t *mate;
436
437 /* secondary enabled */ 405 /* secondary enabled */
438 printk(KERN_INFO "qd6580: dual IDE board\n"); 406 printk(KERN_INFO "qd6580: dual IDE board\n");
439 407
440 hwif = ide_find_port(); 408 rc = ide_legacy_device_add(&d, (base << 8) | config);
441 if (hwif) {
442 ide_init_port_hw(hwif, &hw[0]);
443 idx[0] = hwif->index;
444 }
445
446 mate = ide_find_port();
447 if (mate) {
448 ide_init_port_hw(mate, &hw[1]);
449 idx[1] = mate->index;
450 }
451
452 ide_device_add(idx, &d);
453 409
454 return 0; /* no other qd65xx possible */ 410 return rc; /* no other qd65xx possible */
455 } 411 }
456 } 412 }
457 /* no qd65xx found */ 413 /* no qd65xx found */
diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c
index b48ee345f817..95c643a2228a 100644
--- a/drivers/ide/legacy/umc8672.c
+++ b/drivers/ide/legacy/umc8672.c
@@ -152,7 +152,7 @@ static int __init umc8672_probe(void)
152 umc_set_speeds(current_speeds); 152 umc_set_speeds(current_speeds);
153 local_irq_restore(flags); 153 local_irq_restore(flags);
154 154
155 return ide_legacy_device_add(&umc8672_port_info); 155 return ide_legacy_device_add(&umc8672_port_info, 0);
156} 156}
157 157
158int probe_umc8672; 158int probe_umc8672;