aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-26 14:13:03 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-26 14:13:03 -0500
commitf01393e48c44e30f7c9a36c8b98a07b0232580fe (patch)
treed585310ef7ee6509285a96b849af2e544e5fea25 /drivers/ide/pci
parent6dd9b8376adbee95ddc321cc83c7f641577e01f6 (diff)
ide: merge ->fixup and ->quirkproc methods
* Assign drive->quirk_list in ->quirkproc implementations: - hpt366.c::hpt3xx_quirkproc() - pdc202xx_new.c::pdcnew_quirkproc() - pdc202xx_old.c::pdc202xx_quirkproc() * Make ->quirkproc void. * Move calling ->quirkproc from do_identify() to probe_hwif(). * Convert it821x_fixups() to it821x_quirkproc() in it821x.c. * Convert siimage_fixup() to sil_quirkproc() in siimage.c, also remove no longer needed drive->present check from is_dev_seagate_sata(). * Convert ide_undecoded_slave() to accept 'drive' instead of 'hwif' as an argument. Then convert ide_register_hw() to accept 'quirkproc' argument instead of 'fixup' one. * Remove no longer needed ->fixup method. Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci')
-rw-r--r--drivers/ide/pci/hpt366.c11
-rw-r--r--drivers/ide/pci/it821x.c37
-rw-r--r--drivers/ide/pci/pdc202xx_new.c11
-rw-r--r--drivers/ide/pci/pdc202xx_old.c11
-rw-r--r--drivers/ide/pci/siimage.c15
5 files changed, 40 insertions, 45 deletions
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 3777fb8c8043..12685939a813 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -725,15 +725,18 @@ static void hpt3xx_set_pio_mode(ide_drive_t *drive, const u8 pio)
725 hpt3xx_set_mode(drive, XFER_PIO_0 + pio); 725 hpt3xx_set_mode(drive, XFER_PIO_0 + pio);
726} 726}
727 727
728static int hpt3xx_quirkproc(ide_drive_t *drive) 728static void hpt3xx_quirkproc(ide_drive_t *drive)
729{ 729{
730 struct hd_driveid *id = drive->id; 730 struct hd_driveid *id = drive->id;
731 const char **list = quirk_drives; 731 const char **list = quirk_drives;
732 732
733 while (*list) 733 while (*list)
734 if (strstr(id->model, *list++)) 734 if (strstr(id->model, *list++)) {
735 return 1; 735 drive->quirk_list = 1;
736 return 0; 736 return;
737 }
738
739 drive->quirk_list = 0;
737} 740}
738 741
739static void hpt3xx_maskproc(ide_drive_t *drive, int mask) 742static void hpt3xx_maskproc(ide_drive_t *drive, int mask)
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index 99b7d763b6c7..e610a5340fdc 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -431,33 +431,29 @@ static u8 __devinit ata66_it821x(ide_hwif_t *hwif)
431} 431}
432 432
433/** 433/**
434 * it821x_fixup - post init callback 434 * it821x_quirkproc - post init callback
435 * @hwif: interface 435 * @drive: drive
436 * 436 *
437 * This callback is run after the drives have been probed but 437 * This callback is run after the drive has been probed but
438 * before anything gets attached. It allows drivers to do any 438 * before anything gets attached. It allows drivers to do any
439 * final tuning that is needed, or fixups to work around bugs. 439 * final tuning that is needed, or fixups to work around bugs.
440 */ 440 */
441 441
442static void __devinit it821x_fixups(ide_hwif_t *hwif) 442static void __devinit it821x_quirkproc(ide_drive_t *drive)
443{ 443{
444 struct it821x_dev *itdev = ide_get_hwifdata(hwif); 444 struct it821x_dev *itdev = ide_get_hwifdata(drive->hwif);
445 int i; 445 struct hd_driveid *id = drive->id;
446 u16 *idbits = (u16 *)drive->id;
446 447
447 if(!itdev->smart) { 448 if (!itdev->smart) {
448 /* 449 /*
449 * If we are in pass through mode then not much 450 * If we are in pass through mode then not much
450 * needs to be done, but we do bother to clear the 451 * needs to be done, but we do bother to clear the
451 * IRQ mask as we may well be in PIO (eg rev 0x10) 452 * IRQ mask as we may well be in PIO (eg rev 0x10)
452 * for now and we know unmasking is safe on this chipset. 453 * for now and we know unmasking is safe on this chipset.
453 */ 454 */
454 for (i = 0; i < 2; i++) { 455 drive->unmask = 1;
455 ide_drive_t *drive = &hwif->drives[i]; 456 } else {
456 if(drive->present)
457 drive->unmask = 1;
458 }
459 return;
460 }
461 /* 457 /*
462 * Perform fixups on smart mode. We need to "lose" some 458 * Perform fixups on smart mode. We need to "lose" some
463 * capabilities the firmware lacks but does not filter, and 459 * capabilities the firmware lacks but does not filter, and
@@ -465,16 +461,6 @@ static void __devinit it821x_fixups(ide_hwif_t *hwif)
465 * in RAID mode. 461 * in RAID mode.
466 */ 462 */
467 463
468 for(i = 0; i < 2; i++) {
469 ide_drive_t *drive = &hwif->drives[i];
470 struct hd_driveid *id;
471 u16 *idbits;
472
473 if(!drive->present)
474 continue;
475 id = drive->id;
476 idbits = (u16 *)drive->id;
477
478 /* Check for RAID v native */ 464 /* Check for RAID v native */
479 if(strstr(id->model, "Integrated Technology Express")) { 465 if(strstr(id->model, "Integrated Technology Express")) {
480 /* In raid mode the ident block is slightly buggy 466 /* In raid mode the ident block is slightly buggy
@@ -537,6 +523,8 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
537 struct it821x_dev *idev = kzalloc(sizeof(struct it821x_dev), GFP_KERNEL); 523 struct it821x_dev *idev = kzalloc(sizeof(struct it821x_dev), GFP_KERNEL);
538 u8 conf; 524 u8 conf;
539 525
526 hwif->quirkproc = &it821x_quirkproc;
527
540 if (idev == NULL) { 528 if (idev == NULL) {
541 printk(KERN_ERR "it821x: out of memory, falling back to legacy behaviour.\n"); 529 printk(KERN_ERR "it821x: out of memory, falling back to legacy behaviour.\n");
542 return; 530 return;
@@ -633,7 +621,6 @@ static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev, const cha
633 .name = name_str, \ 621 .name = name_str, \
634 .init_chipset = init_chipset_it821x, \ 622 .init_chipset = init_chipset_it821x, \
635 .init_hwif = init_hwif_it821x, \ 623 .init_hwif = init_hwif_it821x, \
636 .fixup = it821x_fixups, \
637 .host_flags = IDE_HFLAG_BOOTABLE, \ 624 .host_flags = IDE_HFLAG_BOOTABLE, \
638 .pio_mask = ATA_PIO4, \ 625 .pio_mask = ATA_PIO4, \
639 } 626 }
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index ef4a99b99d1f..89d2363a1ebd 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -203,14 +203,17 @@ static u8 pdcnew_cable_detect(ide_hwif_t *hwif)
203 return ATA_CBL_PATA80; 203 return ATA_CBL_PATA80;
204} 204}
205 205
206static int pdcnew_quirkproc(ide_drive_t *drive) 206static void pdcnew_quirkproc(ide_drive_t *drive)
207{ 207{
208 const char **list, *model = drive->id->model; 208 const char **list, *model = drive->id->model;
209 209
210 for (list = pdc_quirk_drives; *list != NULL; list++) 210 for (list = pdc_quirk_drives; *list != NULL; list++)
211 if (strstr(model, *list) != NULL) 211 if (strstr(model, *list) != NULL) {
212 return 2; 212 drive->quirk_list = 2;
213 return 0; 213 return;
214 }
215
216 drive->quirk_list = 0;
214} 217}
215 218
216static void pdcnew_reset(ide_drive_t *drive) 219static void pdcnew_reset(ide_drive_t *drive)
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index 67b2781e2213..3a1e081fe390 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -176,14 +176,17 @@ static void pdc_old_disable_66MHz_clock(ide_hwif_t *hwif)
176 outb(clock & ~(hwif->channel ? 0x08 : 0x02), clock_reg); 176 outb(clock & ~(hwif->channel ? 0x08 : 0x02), clock_reg);
177} 177}
178 178
179static int pdc202xx_quirkproc (ide_drive_t *drive) 179static void pdc202xx_quirkproc(ide_drive_t *drive)
180{ 180{
181 const char **list, *model = drive->id->model; 181 const char **list, *model = drive->id->model;
182 182
183 for (list = pdc_quirk_drives; *list != NULL; list++) 183 for (list = pdc_quirk_drives; *list != NULL; list++)
184 if (strstr(model, *list) != NULL) 184 if (strstr(model, *list) != NULL) {
185 return 2; 185 drive->quirk_list = 2;
186 return 0; 186 return;
187 }
188
189 drive->quirk_list = 0;
187} 190}
188 191
189static void pdc202xx_old_ide_dma_start(ide_drive_t *drive) 192static void pdc202xx_old_ide_dma_start(ide_drive_t *drive)
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 7b45eaf5afd9..908f37b4e0ee 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -713,9 +713,6 @@ static int is_dev_seagate_sata(ide_drive_t *drive)
713 const char *s = &drive->id->model[0]; 713 const char *s = &drive->id->model[0];
714 unsigned len; 714 unsigned len;
715 715
716 if (!drive->present)
717 return 0;
718
719 len = strnlen(s, sizeof(drive->id->model)); 716 len = strnlen(s, sizeof(drive->id->model));
720 717
721 if ((len > 4) && (!memcmp(s, "ST", 2))) { 718 if ((len > 4) && (!memcmp(s, "ST", 2))) {
@@ -730,18 +727,20 @@ static int is_dev_seagate_sata(ide_drive_t *drive)
730} 727}
731 728
732/** 729/**
733 * siimage_fixup - post probe fixups 730 * sil_quirkproc - post probe fixups
734 * @hwif: interface to fix up 731 * @drive: drive
735 * 732 *
736 * Called after drive probe we use this to decide whether the 733 * Called after drive probe we use this to decide whether the
737 * Seagate fixup must be applied. This used to be in init_iops but 734 * Seagate fixup must be applied. This used to be in init_iops but
738 * that can occur before we know what drives are present. 735 * that can occur before we know what drives are present.
739 */ 736 */
740 737
741static void __devinit siimage_fixup(ide_hwif_t *hwif) 738static void __devinit sil_quirkproc(ide_drive_t *drive)
742{ 739{
740 ide_hwif_t *hwif = drive->hwif;
741
743 /* Try and raise the rqsize */ 742 /* Try and raise the rqsize */
744 if (!is_sata(hwif) || !is_dev_seagate_sata(&hwif->drives[0])) 743 if (!is_sata(hwif) || !is_dev_seagate_sata(drive))
745 hwif->rqsize = 128; 744 hwif->rqsize = 128;
746} 745}
747 746
@@ -804,6 +803,7 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
804 803
805 hwif->set_pio_mode = &sil_set_pio_mode; 804 hwif->set_pio_mode = &sil_set_pio_mode;
806 hwif->set_dma_mode = &sil_set_dma_mode; 805 hwif->set_dma_mode = &sil_set_dma_mode;
806 hwif->quirkproc = &sil_quirkproc;
807 807
808 if (sata) { 808 if (sata) {
809 static int first = 1; 809 static int first = 1;
@@ -842,7 +842,6 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
842 .init_chipset = init_chipset_siimage, \ 842 .init_chipset = init_chipset_siimage, \
843 .init_iops = init_iops_siimage, \ 843 .init_iops = init_iops_siimage, \
844 .init_hwif = init_hwif_siimage, \ 844 .init_hwif = init_hwif_siimage, \
845 .fixup = siimage_fixup, \
846 .host_flags = IDE_HFLAG_BOOTABLE, \ 845 .host_flags = IDE_HFLAG_BOOTABLE, \
847 .pio_mask = ATA_PIO4, \ 846 .pio_mask = ATA_PIO4, \
848 .mwdma_mask = ATA_MWDMA2, \ 847 .mwdma_mask = ATA_MWDMA2, \