ide: respect quirk_drives[] list on all controllers
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sun, 7 Jun 2009 13:37:09 +0000 (15:37 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sun, 7 Jun 2009 13:37:09 +0000 (15:37 +0200)
* 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.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/hpt366.c
drivers/ide/ide-iops.c
drivers/ide/ide-probe.c
drivers/ide/pdc202xx_new.c
drivers/ide/pdc202xx_old.c
include/linux/ide.h

index cb04523..a2e9f6c 100644 (file)
 #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_drive_t *drive, const u8 pio)
        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 pci_dev *dev, struct pci_dev *dev2)
 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,
index 8dff623..c553495 100644 (file)
@@ -282,6 +282,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;
index 89574b0..28f95cb 100644 (file)
@@ -732,6 +732,8 @@ static void ide_port_tune_devices(ide_hwif_t *hwif)
        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);
        }
index b68906c..65ba823 100644 (file)
 #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 *hwif)
                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 pdc20270_get_dev2(struct pci_dev *dev)
 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,
 };
index 4980dd7..fe01db6 100644 (file)
 
 #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(ide_hwif_t *hwif)
        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)
@@ -256,13 +231,11 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev,
 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,
        .cable_detect           = pdc2026x_cable_detect,
 };
 
index c8f7b96..6caaae0 100644 (file)
@@ -1453,6 +1453,7 @@ static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
 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 *);