debuggers.hg

changeset 22793:7bc5e072d986

pv-drivers: use PCI interfaces to request IO and MEM resources on platform device

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).

pci_request_region() has been available since at least Linux 2.6.5.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir@xen.org>
date Fri Jan 14 08:02:26 2011 +0000 (2011-01-14)
parents f1a5ac39c15e
children 47713825a3f9
files unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
line diff
     1.1 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c	Thu Jan 13 16:00:59 2011 +0000
     1.2 +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c	Fri Jan 14 08:02:26 2011 +0000
     1.3 @@ -377,18 +377,13 @@ static int __devinit platform_pci_init(s
     1.4  		return -ENOENT;
     1.5  	}
     1.6  
     1.7 -	if (request_mem_region(mmio_addr, mmio_len, DRV_NAME) == NULL) {
     1.8 -		printk(KERN_ERR ":MEM I/O resource 0x%lx @ 0x%lx busy\n",
     1.9 -		       mmio_addr, mmio_len);
    1.10 -		return -EBUSY;
    1.11 -	}
    1.12 +	ret = pci_request_region(pdev, 1, DRV_NAME);
    1.13 +	if (ret < 0)
    1.14 +		return ret;
    1.15  
    1.16 -	if (request_region(ioaddr, iolen, DRV_NAME) == NULL) {
    1.17 -		printk(KERN_ERR DRV_NAME ":I/O resource 0x%lx @ 0x%lx busy\n",
    1.18 -		       iolen, ioaddr);
    1.19 -		release_mem_region(mmio_addr, mmio_len);
    1.20 -		return -EBUSY;
    1.21 -	}
    1.22 +	ret = pci_request_region(pdev, 0, DRV_NAME);
    1.23 +	if (ret < 0)
    1.24 +		goto mem_out;
    1.25  
    1.26  	platform_mmio = mmio_addr;
    1.27  	platform_mmiolen = mmio_len;
    1.28 @@ -424,8 +419,9 @@ static int __devinit platform_pci_init(s
    1.29  
    1.30   out:
    1.31  	if (ret) {
    1.32 -		release_mem_region(mmio_addr, mmio_len);
    1.33 -		release_region(ioaddr, iolen);
    1.34 +		pci_release_region(pdev, 0);
    1.35 +mem_out:
    1.36 +		pci_release_region(pdev, 1);
    1.37  	}
    1.38  
    1.39  	return ret;