aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/hpt366.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:31 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:31 -0500
commit36501650ec45b1db308c3b51886044863be2d762 (patch)
tree74cf9d9f313e510f8424f9bac35da8d61cce9f7b /drivers/ide/pci/hpt366.c
parentf6fb786d6dcdd7d730e4fba620b071796f487e1b (diff)
ide: keep pointer to struct device instead of struct pci_dev in ide_hwif_t
Keep pointer to struct device instead of struct pci_dev in ide_hwif_t. While on it: * Use *dev->dma_mask instead of pci_dev->dma_mask in ide_toggle_bounce(). There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/hpt366.c')
-rw-r--r--drivers/ide/pci/hpt366.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index d33a3f9c12b..7429a55c164 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -626,7 +626,8 @@ static int check_in_drive_list(ide_drive_t *drive, const char **list)
626static u8 hpt3xx_udma_filter(ide_drive_t *drive) 626static u8 hpt3xx_udma_filter(ide_drive_t *drive)
627{ 627{
628 ide_hwif_t *hwif = HWIF(drive); 628 ide_hwif_t *hwif = HWIF(drive);
629 struct hpt_info *info = pci_get_drvdata(hwif->pci_dev); 629 struct pci_dev *dev = to_pci_dev(hwif->dev);
630 struct hpt_info *info = pci_get_drvdata(dev);
630 u8 mask = hwif->ultra_mask; 631 u8 mask = hwif->ultra_mask;
631 632
632 switch (info->chip_type) { 633 switch (info->chip_type) {
@@ -665,7 +666,8 @@ static u8 hpt3xx_udma_filter(ide_drive_t *drive)
665static u8 hpt3xx_mdma_filter(ide_drive_t *drive) 666static u8 hpt3xx_mdma_filter(ide_drive_t *drive)
666{ 667{
667 ide_hwif_t *hwif = HWIF(drive); 668 ide_hwif_t *hwif = HWIF(drive);
668 struct hpt_info *info = pci_get_drvdata(hwif->pci_dev); 669 struct pci_dev *dev = to_pci_dev(hwif->dev);
670 struct hpt_info *info = pci_get_drvdata(dev);
669 671
670 switch (info->chip_type) { 672 switch (info->chip_type) {
671 case HPT372 : 673 case HPT372 :
@@ -699,7 +701,7 @@ static u32 get_speed_setting(u8 speed, struct hpt_info *info)
699 701
700static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed) 702static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed)
701{ 703{
702 struct pci_dev *dev = HWIF(drive)->pci_dev; 704 struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
703 struct hpt_info *info = pci_get_drvdata(dev); 705 struct hpt_info *info = pci_get_drvdata(dev);
704 struct hpt_timings *t = info->timings; 706 struct hpt_timings *t = info->timings;
705 u8 itr_addr = 0x40 + (drive->dn * 4); 707 u8 itr_addr = 0x40 + (drive->dn * 4);
@@ -742,7 +744,7 @@ static void hpt3xx_quirkproc(ide_drive_t *drive)
742static void hpt3xx_maskproc(ide_drive_t *drive, int mask) 744static void hpt3xx_maskproc(ide_drive_t *drive, int mask)
743{ 745{
744 ide_hwif_t *hwif = HWIF(drive); 746 ide_hwif_t *hwif = HWIF(drive);
745 struct pci_dev *dev = hwif->pci_dev; 747 struct pci_dev *dev = to_pci_dev(hwif->dev);
746 struct hpt_info *info = pci_get_drvdata(dev); 748 struct hpt_info *info = pci_get_drvdata(dev);
747 749
748 if (drive->quirk_list) { 750 if (drive->quirk_list) {
@@ -774,7 +776,7 @@ static void hpt3xx_maskproc(ide_drive_t *drive, int mask)
774 */ 776 */
775static void hpt366_dma_lost_irq(ide_drive_t *drive) 777static void hpt366_dma_lost_irq(ide_drive_t *drive)
776{ 778{
777 struct pci_dev *dev = HWIF(drive)->pci_dev; 779 struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
778 u8 mcr1 = 0, mcr3 = 0, scr1 = 0; 780 u8 mcr1 = 0, mcr3 = 0, scr1 = 0;
779 781
780 pci_read_config_byte(dev, 0x50, &mcr1); 782 pci_read_config_byte(dev, 0x50, &mcr1);
@@ -790,18 +792,20 @@ static void hpt366_dma_lost_irq(ide_drive_t *drive)
790static void hpt370_clear_engine(ide_drive_t *drive) 792static void hpt370_clear_engine(ide_drive_t *drive)
791{ 793{
792 ide_hwif_t *hwif = HWIF(drive); 794 ide_hwif_t *hwif = HWIF(drive);
795 struct pci_dev *dev = to_pci_dev(hwif->dev);
793 796
794 pci_write_config_byte(hwif->pci_dev, hwif->select_data, 0x37); 797 pci_write_config_byte(dev, hwif->select_data, 0x37);
795 udelay(10); 798 udelay(10);
796} 799}
797 800
798static void hpt370_irq_timeout(ide_drive_t *drive) 801static void hpt370_irq_timeout(ide_drive_t *drive)
799{ 802{
800 ide_hwif_t *hwif = HWIF(drive); 803 ide_hwif_t *hwif = HWIF(drive);
804 struct pci_dev *dev = to_pci_dev(hwif->dev);
801 u16 bfifo = 0; 805 u16 bfifo = 0;
802 u8 dma_cmd; 806 u8 dma_cmd;
803 807
804 pci_read_config_word(hwif->pci_dev, hwif->select_data + 2, &bfifo); 808 pci_read_config_word(dev, hwif->select_data + 2, &bfifo);
805 printk(KERN_DEBUG "%s: %d bytes in FIFO\n", drive->name, bfifo & 0x1ff); 809 printk(KERN_DEBUG "%s: %d bytes in FIFO\n", drive->name, bfifo & 0x1ff);
806 810
807 /* get DMA command mode */ 811 /* get DMA command mode */
@@ -844,10 +848,11 @@ static void hpt370_dma_timeout(ide_drive_t *drive)
844static int hpt374_ide_dma_test_irq(ide_drive_t *drive) 848static int hpt374_ide_dma_test_irq(ide_drive_t *drive)
845{ 849{
846 ide_hwif_t *hwif = HWIF(drive); 850 ide_hwif_t *hwif = HWIF(drive);
851 struct pci_dev *dev = to_pci_dev(hwif->dev);
847 u16 bfifo = 0; 852 u16 bfifo = 0;
848 u8 dma_stat; 853 u8 dma_stat;
849 854
850 pci_read_config_word(hwif->pci_dev, hwif->select_data + 2, &bfifo); 855 pci_read_config_word(dev, hwif->select_data + 2, &bfifo);
851 if (bfifo & 0x1FF) { 856 if (bfifo & 0x1FF) {
852// printk("%s: %d bytes in FIFO\n", drive->name, bfifo); 857// printk("%s: %d bytes in FIFO\n", drive->name, bfifo);
853 return 0; 858 return 0;
@@ -867,7 +872,7 @@ static int hpt374_ide_dma_test_irq(ide_drive_t *drive)
867static int hpt374_ide_dma_end(ide_drive_t *drive) 872static int hpt374_ide_dma_end(ide_drive_t *drive)
868{ 873{
869 ide_hwif_t *hwif = HWIF(drive); 874 ide_hwif_t *hwif = HWIF(drive);
870 struct pci_dev *dev = hwif->pci_dev; 875 struct pci_dev *dev = to_pci_dev(hwif->dev);
871 u8 mcr = 0, mcr_addr = hwif->select_data; 876 u8 mcr = 0, mcr_addr = hwif->select_data;
872 u8 bwsr = 0, mask = hwif->channel ? 0x02 : 0x01; 877 u8 bwsr = 0, mask = hwif->channel ? 0x02 : 0x01;
873 878
@@ -942,7 +947,7 @@ static void hpt3xxn_rw_disk(ide_drive_t *drive, struct request *rq)
942static int hpt3xx_busproc(ide_drive_t *drive, int state) 947static int hpt3xx_busproc(ide_drive_t *drive, int state)
943{ 948{
944 ide_hwif_t *hwif = HWIF(drive); 949 ide_hwif_t *hwif = HWIF(drive);
945 struct pci_dev *dev = hwif->pci_dev; 950 struct pci_dev *dev = to_pci_dev(hwif->dev);
946 u8 mcr_addr = hwif->select_data + 2; 951 u8 mcr_addr = hwif->select_data + 2;
947 u8 resetmask = hwif->channel ? 0x80 : 0x40; 952 u8 resetmask = hwif->channel ? 0x80 : 0x40;
948 u8 bsr2 = 0; 953 u8 bsr2 = 0;
@@ -1278,7 +1283,7 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha
1278 1283
1279static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) 1284static void __devinit init_hwif_hpt366(ide_hwif_t *hwif)
1280{ 1285{
1281 struct pci_dev *dev = hwif->pci_dev; 1286 struct pci_dev *dev = to_pci_dev(hwif->dev);
1282 struct hpt_info *info = pci_get_drvdata(dev); 1287 struct hpt_info *info = pci_get_drvdata(dev);
1283 int serialize = HPT_SERIALIZE_IO; 1288 int serialize = HPT_SERIALIZE_IO;
1284 u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02; 1289 u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02;
@@ -1393,7 +1398,7 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif)
1393 1398
1394static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase) 1399static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase)
1395{ 1400{
1396 struct pci_dev *dev = hwif->pci_dev; 1401 struct pci_dev *dev = to_pci_dev(hwif->dev);
1397 u8 masterdma = 0, slavedma = 0; 1402 u8 masterdma = 0, slavedma = 0;
1398 u8 dma_new = 0, dma_old = 0; 1403 u8 dma_new = 0, dma_old = 0;
1399 unsigned long flags; 1404 unsigned long flags;