Skip to contentSkip to conversation

ide: use ide_legacy_device_add() for qd65xx (take 2)

PATCH New Bartlomiej Zolnierkiewicz 1 participant 1 message Mar 1, 2008 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/ide/ide-probe.c      |   19 ++++++++++----
 drivers/ide/legacy/ali14xx.c |    2 -
 drivers/ide/legacy/dtc2278.c |    2 -
 drivers/ide/legacy/ht6560b.c |    2 -
 drivers/ide/legacy/qd65xx.c  |   58 +++++--------------------------------------
 drivers/ide/legacy/umc8672.c |    2 -
 include/linux/ide.h          |    2 -
 7 files changed, 26 insertions(+), 61 deletions(-)
drivers/ide/ide-probe.c +14 -5
Index: b/drivers/ide/ide-probe.c
===================================================================
@@ -1630,7 +1630,7 @@ void ide_port_scan(ide_hwif_t *hwif)
 }
 EXPORT_SYMBOL_GPL(ide_port_scan);
 
-int ide_legacy_device_add(const struct ide_port_info *d)
+int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config)
 {
 	ide_hwif_t *hwif, *mate;
 	u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
@@ -1644,15 +1644,24 @@ int ide_legacy_device_add(const struct i
 	ide_std_init_ports(&hw[1], 0x170, 0x376);
 	hw[1].irq = 15;
 
-	hwif = ide_find_port();
+	hwif = ide_find_port_slot(d);
 	if (hwif) {
-		ide_init_port_hw(hwif, &hw[0]);
-		idx[0] = hwif->index;
+		u8 j = (d->host_flags & IDE_HFLAG_QD_2ND_PORT) ? 1 : 0;
+
+		ide_init_port_hw(hwif, &hw[j]);
+		if (config)
+			hwif->config_data = config;
+		idx[j] = hwif->index;
 	}
 
-	mate = ide_find_port();
+	if (hwif == NULL && (d->host_flags & IDE_HFLAG_SINGLE))
+		return -ENOENT;
+
+	mate = ide_find_port_slot(d);
 	if (mate) {
 		ide_init_port_hw(mate, &hw[1]);
+		if (config)
+			mate->config_data = config;
 		idx[1] = mate->index;
 	}
 
drivers/ide/legacy/ali14xx.c +1 -1
Index: b/drivers/ide/legacy/ali14xx.c
===================================================================
@@ -214,7 +214,7 @@ static int __init ali14xx_probe(void)
 		return 1;
 	}
 
-	return ide_legacy_device_add(&ali14xx_port_info);
+	return ide_legacy_device_add(&ali14xx_port_info, 0);
 }
 
 int probe_ali14xx;
drivers/ide/legacy/dtc2278.c +1 -1
Index: b/drivers/ide/legacy/dtc2278.c
===================================================================
@@ -125,7 +125,7 @@ static int __init dtc2278_probe(void)
 #endif
 	local_irq_restore(flags);
 
-	return ide_legacy_device_add(&dtc2278_port_info);
+	return ide_legacy_device_add(&dtc2278_port_info, 0);
 }
 
 int probe_dtc2278 = 0;
drivers/ide/legacy/ht6560b.c +1 -1
Index: b/drivers/ide/legacy/ht6560b.c
===================================================================
@@ -360,7 +360,7 @@ static int __init ht6560b_init(void)
 		goto release_region;
 	}
 
-	return ide_legacy_device_add(&ht6560b_port_info);
+	return ide_legacy_device_add(&ht6560b_port_info, 0);
 
 release_region:
 	release_region(HT_CONFIG_PORT, 1);
drivers/ide/legacy/qd65xx.c +7 -51

90 lines not on this page · raw message

drivers/ide/legacy/umc8672.c +1 -1
Index: b/drivers/ide/legacy/umc8672.c
===================================================================
@@ -152,7 +152,7 @@ static int __init umc8672_probe(void)
 	umc_set_speeds(current_speeds);
 	local_irq_restore(flags);
 
-	return ide_legacy_device_add(&umc8672_port_info);
+	return ide_legacy_device_add(&umc8672_port_info, 0);
 }
 
 int probe_umc8672;
include/linux/ide.h +1 -1
Index: b/include/linux/ide.h
===================================================================
@@ -1215,7 +1215,7 @@ void ide_undecoded_slave(ide_drive_t *);
 
 int ide_device_add_all(u8 *idx, const struct ide_port_info *);
 int ide_device_add(u8 idx[4], const struct ide_port_info *);
-int ide_legacy_device_add(const struct ide_port_info *);
+int ide_legacy_device_add(const struct ide_port_info *, unsigned long);
 void ide_port_unregister_devices(ide_hwif_t *);
 void ide_port_scan(ide_hwif_t *);