Skip to contentSkip to conversation

ide: respect quirk_drives[] list on all controllers

PATCH In review Bartlomiej Zolnierkiewicz 2 participants 4 messages May 20, 2009 – May 22, 2009 libata

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 ide: respect quirk_drives[] list on all controllers

* Add ide_check_nien_quirk_list() helper to the core code and then use it in ide_port_tune_devices().

* Remove no longer needed ->quirkproc methods from hpt366.c and pdc202xx_{new,old}.c.

---
 drivers/ide/hpt366.c       |   27 ---------------------------
 drivers/ide/ide-iops.c     |   25 +++++++++++++++++++++++++
 drivers/ide/ide-probe.c    |    2 ++
 drivers/ide/pdc202xx_new.c |   26 --------------------------
 drivers/ide/pdc202xx_old.c |   27 ---------------------------
 include/linux/ide.h        |    1 +
 6 files changed, 28 insertions(+), 80 deletions(-)
drivers/ide/hpt366.c +0 -27
Index: b/drivers/ide/hpt366.c
===================================================================
@@ -138,18 +138,6 @@
 #undef	HPT_RESET_STATE_ENGINE
 #undef	HPT_DELAY_INTERRUPT
 
-static const char *quirk_drives[] = {
-	"QUANTUM FIREBALLlct08 08",
-	"QUANTUM FIREBALLP KA6.4",
-	"QUANTUM FIREBALLP KA9.1",
-	"QUANTUM FIREBALLP KX13.6",
-	"QUANTUM FIREBALLP KX20.5",
-	"QUANTUM FIREBALLP KX27.3",
-	"QUANTUM FIREBALLP LM20.4",
-	"QUANTUM FIREBALLP LM20.5",
-	NULL
-};
-
 static const char *bad_ata100_5[] = {
 	"IBM-DTLA-307075",
 	"IBM-DTLA-307060",
@@ -733,20 +721,6 @@ static void hpt3xx_set_pio_mode(ide_driv
 	hpt3xx_set_mode(drive, XFER_PIO_0 + pio);
 }
 
-static void hpt3xx_quirkproc(ide_drive_t *drive)
-{
-	char *m			= (char *)&drive->id[ATA_ID_PROD];
-	const  char **list	= quirk_drives;
-
-	while (*list)
-		if (strstr(m, *list++)) {
-			drive->quirk_list = 2;
-			return;
-		}
-
-	drive->quirk_list = 0;
-}
-
 static void hpt3xx_maskproc(ide_drive_t *drive, int mask)
 {
 	ide_hwif_t *hwif	= drive->hwif;
@@ -1408,7 +1382,6 @@ static int __devinit hpt36x_init(struct 
 static const struct ide_port_ops hpt3xx_port_ops = {
 	.set_pio_mode		= hpt3xx_set_pio_mode,
 	.set_dma_mode		= hpt3xx_set_mode,
-	.quirkproc		= hpt3xx_quirkproc,
 	.maskproc		= hpt3xx_maskproc,
 	.mdma_filter		= hpt3xx_mdma_filter,
 	.udma_filter		= hpt3xx_udma_filter,
drivers/ide/ide-iops.c +25 -0
Index: b/drivers/ide/ide-iops.c
===================================================================
@@ -269,6 +269,31 @@ no_80w:
 	return 0;
 }
 
+static const char *nien_quirk_list[] = {
+	"QUANTUM FIREBALLlct08 08",
+	"QUANTUM FIREBALLP KA6.4",
+	"QUANTUM FIREBALLP KA9.1",
+	"QUANTUM FIREBALLP KX13.6",
+	"QUANTUM FIREBALLP KX20.5",
+	"QUANTUM FIREBALLP KX27.3",
+	"QUANTUM FIREBALLP LM20.4",
+	"QUANTUM FIREBALLP LM20.5",
+	NULL
+};
+
+void ide_check_nien_quirk_list(ide_drive_t *drive)
+{
+	const char **list, *m = (char *)&drive->id[ATA_ID_PROD];
+
+	for (list = nien_quirk_list; *list != NULL; list++)
+		if (strstr(m, *list) != NULL) {
+			drive->quirk_list = 2;
+			return;
+		}
+
+	drive->quirk_list = 0;
+}
+
 int ide_driveid_update(ide_drive_t *drive)
 {
 	u16 *id;
drivers/ide/ide-probe.c +2 -0
Index: b/drivers/ide/ide-probe.c
===================================================================
@@ -729,6 +729,8 @@ static void ide_port_tune_devices(ide_hw
 	int i;
 
 	ide_port_for_each_present_dev(i, drive, hwif) {
+		ide_check_nien_quirk_list(drive);
+
 		if (port_ops && port_ops->quirkproc)
 			port_ops->quirkproc(drive);
 	}
drivers/ide/pdc202xx_new.c +0 -26
Index: b/drivers/ide/pdc202xx_new.c
===================================================================
@@ -40,18 +40,6 @@
 #define DBG(fmt, args...)
 #endif
 
-static const char *pdc_quirk_drives[] = {
-	"QUANTUM FIREBALLlct08 08",
-	"QUANTUM FIREBALLP KA6.4",
-	"QUANTUM FIREBALLP KA9.1",
-	"QUANTUM FIREBALLP LM20.4",
-	"QUANTUM FIREBALLP KX13.6",
-	"QUANTUM FIREBALLP KX20.5",
-	"QUANTUM FIREBALLP KX27.3",
-	"QUANTUM FIREBALLP LM20.5",
-	NULL
-};
-
 static u8 max_dma_rate(struct pci_dev *pdev)
 {
 	u8 mode;
@@ -200,19 +188,6 @@ static u8 pdcnew_cable_detect(ide_hwif_t
 		return ATA_CBL_PATA80;
 }
 
-static void pdcnew_quirkproc(ide_drive_t *drive)
-{
-	const char **list, *m = (char *)&drive->id[ATA_ID_PROD];
-
-	for (list = pdc_quirk_drives; *list != NULL; list++)
-		if (strstr(m, *list) != NULL) {
-			drive->quirk_list = 2;
-			return;
-		}
-
-	drive->quirk_list = 0;
-}
-
 static void pdcnew_reset(ide_drive_t *drive)
 {
 	/*
@@ -473,7 +448,6 @@ static struct pci_dev * __devinit pdc202
 static const struct ide_port_ops pdcnew_port_ops = {
 	.set_pio_mode		= pdcnew_set_pio_mode,
 	.set_dma_mode		= pdcnew_set_dma_mode,
-	.quirkproc		= pdcnew_quirkproc,
 	.resetproc		= pdcnew_reset,
 	.cable_detect		= pdcnew_cable_detect,
 };
drivers/ide/pdc202xx_old.c +0 -27
Index: b/drivers/ide/pdc202xx_old.c
===================================================================
@@ -23,18 +23,6 @@
 
 #define PDC202XX_DEBUG_DRIVE_INFO	0
 
-static const char *pdc_quirk_drives[] = {
-	"QUANTUM FIREBALLlct08 08",
-	"QUANTUM FIREBALLP KA6.4",
-	"QUANTUM FIREBALLP KA9.1",
-	"QUANTUM FIREBALLP LM20.4",
-	"QUANTUM FIREBALLP KX13.6",
-	"QUANTUM FIREBALLP KX20.5",
-	"QUANTUM FIREBALLP KX27.3",
-	"QUANTUM FIREBALLP LM20.5",
-	NULL
-};
-
 static void pdc_old_disable_66MHz_clock(ide_hwif_t *);
 
 static void pdc202xx_set_mode(ide_drive_t *drive, const u8 speed)
@@ -151,19 +139,6 @@ static void pdc_old_disable_66MHz_clock(
 	outb(clock & ~(hwif->channel ? 0x08 : 0x02), clock_reg);
 }
 
-static void pdc202xx_quirkproc(ide_drive_t *drive)
-{
-	const char **list, *m = (char *)&drive->id[ATA_ID_PROD];
-
-	for (list = pdc_quirk_drives; *list != NULL; list++)
-		if (strstr(m, *list) != NULL) {
-			drive->quirk_list = 2;
-			return;
-		}
-
-	drive->quirk_list = 0;
-}
-
 static void pdc202xx_dma_start(ide_drive_t *drive)
 {
 	if (drive->current_speed > XFER_UDMA_2)
@@ -311,13 +286,11 @@ static void __devinit pdc202ata4_fixup_i
 static const struct ide_port_ops pdc20246_port_ops = {
 	.set_pio_mode		= pdc202xx_set_pio_mode,
 	.set_dma_mode		= pdc202xx_set_mode,
-	.quirkproc		= pdc202xx_quirkproc,
 };
 
 static const struct ide_port_ops pdc2026x_port_ops = {
 	.set_pio_mode		= pdc202xx_set_pio_mode,
 	.set_dma_mode		= pdc202xx_set_mode,
-	.quirkproc		= pdc202xx_quirkproc,
 	.resetproc		= pdc202xx_reset,
 	.cable_detect		= pdc2026x_cable_detect,
 };
include/linux/ide.h +1 -0
Index: b/include/linux/ide.h
===================================================================
@@ -1464,6 +1464,7 @@ static inline void ide_acpi_set_state(id
 void ide_register_region(struct gendisk *);
 void ide_unregister_region(struct gendisk *);
 
+void ide_check_nien_quirk_list(ide_drive_t *);
 void ide_undecoded_slave(ide_drive_t *);
 
 void ide_port_apply_params(ide_hwif_t *);
Acked-by on v1 3/4
#1 lore raw
Quoted 5 lines · Bartlomiej Zolnierkiewicz

* Add ide_check_nien_quirk_list() helper to the core code and then use it in ide_port_tune_devices().

* Remove no longer needed ->quirkproc methods from hpt366.c and pdc202xx_{new,old}.c.

Haha, I remembered about that idea of yours and was thinking of
undertaking its implementation just yesterday. You've beten me to it. :-)

Quoted 1 line
Quoted 11 lines

Index: b/drivers/ide/ide-iops.c
===================================================================

drivers/ide/ide-iops.c +3 -0
@@ -269,6 +269,31 @@ no_80w:
 	return 0;
 }
 
+static const char *nien_quirk_list[] = {
+	"QUANTUM FIREBALLlct08 08",
+	"QUANTUM FIREBALLP KA6.4",

drivers/ide/ide-iops.c no_80w: · line 284

Quoted 10 lines
drivers/ide/ide-iops.c +10 -0
+	"QUANTUM FIREBALLP KA9.1",
+	"QUANTUM FIREBALLP KX13.6",
+	"QUANTUM FIREBALLP KX20.5",
+	"QUANTUM FIREBALLP KX27.3",
+	"QUANTUM FIREBALLP LM20.4",
+	"QUANTUM FIREBALLP LM20.5",
+	NULL
+};
+
+void ide_check_nien_quirk_list(ide_drive_t *drive)

Why not reuse ide_in_drive_list()?

drivers/ide/ide-iops.c no_80w: · line 289

Quoted 5 lines
drivers/ide/ide-iops.c +5 -0
+{
+	const char **list, *m = (char *)&drive->id[ATA_ID_PROD];
+
+	for (list = nien_quirk_list; *list != NULL; list++)
+		if (strstr(m, *list) != NULL) {

Ah, strstr() vs strcmp()... I think strcmp() should work anyway...

drivers/ide/ide-iops.c no_80w: · line 299

Quoted 10 lines
drivers/ide/ide-iops.c +7 -0
+			drive->quirk_list = 2;
+			return;
+		}
+
+	drive->quirk_list = 0;
+}
+
 int ide_driveid_update(ide_drive_t *drive)
 {
 	u16 *id;

MBR, Sergei

#2 lore raw
Quoted 10 lines · On Thursday 21 May 2009 21:13:33 Sergei Shtylyov wrote:
Quoted 5 lines · Bartlomiej Zolnierkiewicz

* Add ide_check_nien_quirk_list() helper to the core code and then use it in ide_port_tune_devices().

* Remove no longer needed ->quirkproc methods from hpt366.c and pdc202xx_{new,old}.c.

Haha, I remembered about that idea of yours and was thinking of
undertaking its implementation just yesterday. You've beten me to it. :-)

Sigh, if I knew I would concentrate on other things...

I did it only because there is outstanding ide-pmac bugreport probably related to one of these quirky drives...

Quoted 12 lines
Quoted 1 line
Quoted 8 lines

Index: b/drivers/ide/ide-iops.c
===================================================================

drivers/ide/ide-iops.c +0 -0
@@ -269,6 +269,31 @@ no_80w:
 	return 0;
 }
 
Quoted 15 lines

drivers/ide/ide-iops.c no_80w: · line 284

Quoted 13 lines
drivers/ide/ide-iops.c +13 -0
+static const char *nien_quirk_list[] = {
+	"QUANTUM FIREBALLlct08 08",
+	"QUANTUM FIREBALLP KA6.4",
+	"QUANTUM FIREBALLP KA9.1",
+	"QUANTUM FIREBALLP KX13.6",
+	"QUANTUM FIREBALLP KX20.5",
+	"QUANTUM FIREBALLP KX27.3",
+	"QUANTUM FIREBALLP LM20.4",
+	"QUANTUM FIREBALLP LM20.5",
+	NULL
+};
+
+void ide_check_nien_quirk_list(ide_drive_t *drive)

Why not reuse ide_in_drive_list()?

Should have been in patch #5/4 but I ran out of time, I will do it later unless you would like to handle it...

#3 lore raw

Hello.

Quoted 6 lines · Bartlomiej Zolnierkiewicz
Quoted 5 lines
Quoted 5 lines

* Add ide_check_nien_quirk_list() helper to the core code and then use it in ide_port_tune_devices().

* Remove no longer needed ->quirkproc methods from hpt366.c and pdc202xx_{new,old}.c.

Quoted 7 lines
Quoted 2 lines

Haha, I remembered about that idea of yours and was thinking of
undertaking its implementation just yesterday. You've beten me to it. :-)

Sigh, if I knew I would concentrate on other things...

I did it only because there is outstanding ide-pmac bugreport probably related to one of these quirky drives...

Yes, I figured. :-)

Quoted 28 lines
Quoted 12 lines
Quoted 1 line
Quoted 8 lines

Index: b/drivers/ide/ide-iops.c
===================================================================

drivers/ide/ide-iops.c +0 -0
@@ -269,6 +269,31 @@ no_80w:
 	return 0;
 }
 
Quoted 15 lines

drivers/ide/ide-iops.c no_80w: · line 284

Quoted 13 lines
drivers/ide/ide-iops.c +13 -0
+static const char *nien_quirk_list[] = {
+	"QUANTUM FIREBALLlct08 08",
+	"QUANTUM FIREBALLP KA6.4",
+	"QUANTUM FIREBALLP KA9.1",
+	"QUANTUM FIREBALLP KX13.6",
+	"QUANTUM FIREBALLP KX20.5",
+	"QUANTUM FIREBALLP KX27.3",
+	"QUANTUM FIREBALLP LM20.4",
+	"QUANTUM FIREBALLP LM20.5",
+	NULL
+};
+
+void ide_check_nien_quirk_list(ide_drive_t *drive)

Why not reuse ide_in_drive_list()?

Quoted 2 lines

Should have been in patch #5/4 but I ran out of time, I will do it later unless you would like to handle it...

I'm looking at the unification of ack_intr()/clear_irq() now and making
the former usable for the PCI drivers too...

MBR, Sergei