linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/4] ide: respect quirk_drives[] list on all controllers
@ 2009-05-20 15:34 Bartlomiej Zolnierkiewicz
  2009-05-21 19:13 ` Sergei Shtylyov
  0 siblings, 1 reply; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-05-20 15:34 UTC (permalink / raw)
  To: linux-ide; +Cc: linux-kernel, Sergei Shtylyov

* 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.

Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 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(-)

Index: b/drivers/ide/hpt366.c
===================================================================
--- a/drivers/ide/hpt366.c
+++ 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,
Index: b/drivers/ide/ide-iops.c
===================================================================
--- a/drivers/ide/ide-iops.c
+++ 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;
Index: b/drivers/ide/ide-probe.c
===================================================================
--- a/drivers/ide/ide-probe.c
+++ 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);
 	}
Index: b/drivers/ide/pdc202xx_new.c
===================================================================
--- a/drivers/ide/pdc202xx_new.c
+++ 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,
 };
Index: b/drivers/ide/pdc202xx_old.c
===================================================================
--- a/drivers/ide/pdc202xx_old.c
+++ 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,
 };
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ 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 *);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/4] ide: respect quirk_drives[] list on all controllers
  2009-05-20 15:34 [PATCH 3/4] ide: respect quirk_drives[] list on all controllers Bartlomiej Zolnierkiewicz
@ 2009-05-21 19:13 ` Sergei Shtylyov
  2009-05-22 18:59   ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2009-05-21 19:13 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

Bartlomiej Zolnierkiewicz wrote:

> * 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. :-)

> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

> Index: b/drivers/ide/ide-iops.c
> ===================================================================
> --- a/drivers/ide/ide-iops.c
> +++ 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)

    Why not reuse ide_in_drive_list()?

> +{
> +	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...

> +			drive->quirk_list = 2;
> +			return;
> +		}
> +
> +	drive->quirk_list = 0;
> +}
> +
>  int ide_driveid_update(ide_drive_t *drive)
>  {
>  	u16 *id;

MBR, Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/4] ide: respect quirk_drives[] list on all controllers
  2009-05-21 19:13 ` Sergei Shtylyov
@ 2009-05-22 18:59   ` Bartlomiej Zolnierkiewicz
  2009-05-22 19:05     ` Sergei Shtylyov
  0 siblings, 1 reply; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-05-22 18:59 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linux-ide, linux-kernel

On Thursday 21 May 2009 21:13:33 Sergei Shtylyov wrote:
> Bartlomiej Zolnierkiewicz wrote:
> 
> > * 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...

> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> 
> Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> 
> > Index: b/drivers/ide/ide-iops.c
> > ===================================================================
> > --- a/drivers/ide/ide-iops.c
> > +++ 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)
> 
>     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...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/4] ide: respect quirk_drives[] list on all controllers
  2009-05-22 18:59   ` Bartlomiej Zolnierkiewicz
@ 2009-05-22 19:05     ` Sergei Shtylyov
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2009-05-22 19:05 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel

Hello.

Bartlomiej Zolnierkiewicz wrote:

>>>* 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...

    Yes, I figured. :-)

>>>Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

>>Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

>>>Index: b/drivers/ide/ide-iops.c
>>>===================================================================
>>>--- a/drivers/ide/ide-iops.c
>>>+++ 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)

>>    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...

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

MBR, Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-05-22 19:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-20 15:34 [PATCH 3/4] ide: respect quirk_drives[] list on all controllers Bartlomiej Zolnierkiewicz
2009-05-21 19:13 ` Sergei Shtylyov
2009-05-22 18:59   ` Bartlomiej Zolnierkiewicz
2009-05-22 19:05     ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).