]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - drivers/ide/pci/serverworks.c
ide: keep pointer to struct device instead of struct pci_dev in ide_hwif_t
[mirror_ubuntu-zesty-kernel.git] / drivers / ide / pci / serverworks.c
index bf01c387739ec81ef7c15b23243f60b389dd708c..cb10dfa71f5c21a94611b9b94ad0d22133aa2eaa 100644 (file)
@@ -67,7 +67,7 @@ static int check_in_drive_lists (ide_drive_t *drive, const char **list)
 
 static u8 svwks_udma_filter(ide_drive_t *drive)
 {
-       struct pci_dev *dev     = HWIF(drive)->pci_dev;
+       struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
        u8 mask = 0;
 
        if (dev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE)
@@ -130,7 +130,7 @@ static void svwks_set_pio_mode(ide_drive_t *drive, const u8 pio)
        static const u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 };
        static const u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 };
 
-       struct pci_dev *dev = drive->hwif->pci_dev;
+       struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
 
        pci_write_config_byte(dev, drive_pci[drive->dn], pio_modes[pio]);
 
@@ -153,7 +153,7 @@ static void svwks_set_dma_mode(ide_drive_t *drive, const u8 speed)
        static const u8 drive_pci2[]            = { 0x45, 0x44, 0x47, 0x46 };
 
        ide_hwif_t *hwif        = HWIF(drive);
-       struct pci_dev *dev     = hwif->pci_dev;
+       struct pci_dev *dev     = to_pci_dev(hwif->dev);
        u8 unit                 = (drive->select.b.unit & 0x01);
 
        u8 ultra_enable  = 0, ultra_timing = 0, dma_timing = 0;
@@ -287,7 +287,8 @@ static u8 __devinit ata66_svwks_svwks(ide_hwif_t *hwif)
  */
 static u8 __devinit ata66_svwks_dell(ide_hwif_t *hwif)
 {
-       struct pci_dev *dev = hwif->pci_dev;
+       struct pci_dev *dev = to_pci_dev(hwif->dev);
+
        if (dev->subsystem_vendor == PCI_VENDOR_ID_DELL &&
            dev->vendor == PCI_VENDOR_ID_SERVERWORKS &&
            (dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE ||
@@ -305,7 +306,8 @@ static u8 __devinit ata66_svwks_dell(ide_hwif_t *hwif)
  */
 static u8 __devinit ata66_svwks_cobalt(ide_hwif_t *hwif)
 {
-       struct pci_dev *dev = hwif->pci_dev;
+       struct pci_dev *dev = to_pci_dev(hwif->dev);
+
        if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN &&
            dev->vendor == PCI_VENDOR_ID_SERVERWORKS &&
            dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE)
@@ -316,7 +318,7 @@ static u8 __devinit ata66_svwks_cobalt(ide_hwif_t *hwif)
 
 static u8 __devinit ata66_svwks(ide_hwif_t *hwif)
 {
-       struct pci_dev *dev = hwif->pci_dev;
+       struct pci_dev *dev = to_pci_dev(hwif->dev);
 
        /* Server Works */
        if (dev->subsystem_vendor == PCI_VENDOR_ID_SERVERWORKS)
@@ -340,6 +342,8 @@ static u8 __devinit ata66_svwks(ide_hwif_t *hwif)
 
 static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
 {
+       struct pci_dev *dev = to_pci_dev(hwif->dev);
+
        hwif->set_pio_mode = &svwks_set_pio_mode;
        hwif->set_dma_mode = &svwks_set_dma_mode;
        hwif->udma_filter = &svwks_udma_filter;
@@ -347,7 +351,7 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
        if (!hwif->dma_base)
                return;
 
-       if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) {
+       if (dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) {
                if (hwif->cbl != ATA_CBL_PATA40_SHORT)
                        hwif->cbl = ata66_svwks(hwif);
        }