]> err.no Git - linux-2.6/blobdiff - drivers/ata/pata_it821x.c
libata: PCI device should be powered up before being accessed
[linux-2.6] / drivers / ata / pata_it821x.c
index 109ddd42c266ba0447b42b801dbee853b9ca16a5..6bdbb7140dfa522daf5b7bcccb1d0b290e7c79d1 100644 (file)
@@ -564,7 +564,7 @@ static int it821x_check_atapi_dma(struct ata_queued_cmd *qc)
        struct it821x_dev *itdev = ap->private_data;
 
        /* Only use dma for transfers to/from the media. */
-       if (qc->nbytes < 2048)
+       if (ata_qc_raw_nbytes(qc) < 2048)
                return -EOPNOTSUPP;
 
        /* No ATAPI DMA in smart mode */
@@ -759,6 +759,11 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 
        const struct ata_port_info *ppi[] = { NULL, NULL };
        static char *mode[2] = { "pass through", "smart" };
+       int rc;
+
+       rc = pcim_enable_device(pdev);
+       if (rc)
+               return rc;
 
        /* Force the card into bypass mode if so requested */
        if (it8212_noraid) {
@@ -780,10 +785,17 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 #ifdef CONFIG_PM
 static int it821x_reinit_one(struct pci_dev *pdev)
 {
+       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       int rc;
+
+       rc = ata_pci_device_do_resume(pdev);
+       if (rc)
+               return rc;
        /* Resume - turn raid back off if need be */
        if (it8212_noraid)
                it821x_disable_raid(pdev);
-       return ata_pci_device_resume(pdev);
+       ata_host_resume(host);
+       return rc;
 }
 #endif