Re: [PATCH 17/20] libata: make ata_pci_acquire_resources() handle iomap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tejun Heo wrote:
@@ -181,6 +183,28 @@ int ata_pci_acquire_resources(struct ata
 	if (rc)
 		goto err;
+ /* iomap PCI BARs */
+	for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
+		if (!(bar_mask & (1 << i)))
+			continue;
+
+		WARN_ON(iomap[i]);
+
+		if (!pci_resource_start(pdev, i) ||
+		    !pci_resource_len(pdev, i)) {
+			reason = "iomap requested for null PCI BAR";
+			rc = -EIO;
+			goto err;
+		}
+
+		iomap[i] = pci_iomap(pdev, i, 0);
+		if (!iomap[i]) {
+			rc = -ENOMEM;
+			reason = "failed to iomap PCI BAR";
+			goto err;
+		}
+	}
+
 	return 0;
err:
@@ -202,6 +226,14 @@ int ata_pci_acquire_resources(struct ata
 void ata_pci_release_resources(struct ata_host *host)
 {
 	struct pci_dev *pdev = to_pci_dev(host->dev);
+	void __iomem **iomap = host->iomap;
+	int i;
+
+	for (i = 0; i < DEVICE_COUNT_RESOURCE; i++)
+		if (iomap[i]) {
+			pci_iounmap(pdev, iomap[i]);
+			iomap[i] = NULL;
+		}


NAK, you only should map the stuff you are going to use.

Mapped resources is finite, and you definitely don't want to map certain resources on certain controllers -- sometimes they are a memory area that's too large to be mapped, even.

-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux