xen-platform: use PCI interfaces to request IO and MEM resources.

This is the correct interface to use and something has broken the use
of the previous incorrect interface (which fails because the request
conflicts with the resources assigned for the PCI device itself
instead of nesting like the PCI interfaces do).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: stable@kernel.org # 2.6.37 only
This commit is contained in:
Ian Campbell 2011-01-11 11:50:28 +00:00 коммит произвёл Konrad Rzeszutek Wilk
Родитель 3c0eee3fe6
Коммит 00f28e4037
1 изменённых файлов: 7 добавлений и 14 удалений

Просмотреть файл

@ -105,7 +105,7 @@ static int __devinit platform_pci_init(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
int i, ret; int i, ret;
long ioaddr, iolen; long ioaddr;
long mmio_addr, mmio_len; long mmio_addr, mmio_len;
unsigned int max_nr_gframes; unsigned int max_nr_gframes;
@ -114,7 +114,6 @@ static int __devinit platform_pci_init(struct pci_dev *pdev,
return i; return i;
ioaddr = pci_resource_start(pdev, 0); ioaddr = pci_resource_start(pdev, 0);
iolen = pci_resource_len(pdev, 0);
mmio_addr = pci_resource_start(pdev, 1); mmio_addr = pci_resource_start(pdev, 1);
mmio_len = pci_resource_len(pdev, 1); mmio_len = pci_resource_len(pdev, 1);
@ -125,19 +124,13 @@ static int __devinit platform_pci_init(struct pci_dev *pdev,
goto pci_out; goto pci_out;
} }
if (request_mem_region(mmio_addr, mmio_len, DRV_NAME) == NULL) { ret = pci_request_region(pdev, 1, DRV_NAME);
dev_err(&pdev->dev, "MEM I/O resource 0x%lx @ 0x%lx busy\n", if (ret < 0)
mmio_addr, mmio_len);
ret = -EBUSY;
goto pci_out; goto pci_out;
}
if (request_region(ioaddr, iolen, DRV_NAME) == NULL) { ret = pci_request_region(pdev, 0, DRV_NAME);
dev_err(&pdev->dev, "I/O resource 0x%lx @ 0x%lx busy\n", if (ret < 0)
iolen, ioaddr);
ret = -EBUSY;
goto mem_out; goto mem_out;
}
platform_mmio = mmio_addr; platform_mmio = mmio_addr;
platform_mmiolen = mmio_len; platform_mmiolen = mmio_len;
@ -169,9 +162,9 @@ static int __devinit platform_pci_init(struct pci_dev *pdev,
return 0; return 0;
out: out:
release_region(ioaddr, iolen); pci_release_region(pdev, 0);
mem_out: mem_out:
release_mem_region(mmio_addr, mmio_len); pci_release_region(pdev, 1);
pci_out: pci_out:
pci_disable_device(pdev); pci_disable_device(pdev);
return ret; return ret;