[PATCH 9/9] linux: Remove pre-2.6 PCI interface support

Tiago Vignatti tiago.vignatti at nokia.com
Wed Sep 22 05:57:48 PDT 2010


On Wed, Sep 22, 2010 at 01:28:39AM +0200, ext Adam Jackson wrote:
> If you haven't ported 2.6 to your architecture in the intervening seven
> years, you can keep running older servers.
> 
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  hw/xfree86/os-support/bus/linuxPci.c |   32 ++------------------------------
>  1 files changed, 2 insertions(+), 30 deletions(-)
> 
> diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
> index 003f104..084aa12 100644
> --- a/hw/xfree86/os-support/bus/linuxPci.c
> +++ b/hw/xfree86/os-support/bus/linuxPci.c
> @@ -67,47 +67,19 @@ linuxPciOpenFile(struct pci_device *dev, Bool write)
>      static struct pci_device *last_dev = NULL;
>      static int	fd = -1,is_write = 0;
>      char		file[64];
> -    struct stat	ignored;
> -    static int is26 = -1;
>  
>      if (dev == NULL) {
>  	return -1;
>      }
>  
> -    if (is26 == -1) {
> -	is26 = (stat("/sys/bus/pci", &ignored) < 0) ? 0 : 1;
> -    }
> -	
>      if (fd == -1 || (write && (!is_write)) || (last_dev != dev)) {
>  	if (fd != -1) {
>  	    close(fd);
>  	    fd = -1;
>  	}
>  
> -	if (is26) {
> -	    sprintf(file,"/sys/bus/pci/devices/%04u:%02x:%02x.%01x/config",
> -		    dev->domain, dev->bus, dev->dev, dev->func);
> -	} else {
> -	    if (dev->domain == 0) {
> -		sprintf(file,"/proc/bus/pci/%02x", dev->bus);
> -		if (stat(file, &ignored) < 0) {
> -		    sprintf(file, "/proc/bus/pci/0000:%02x/%02x.%1x",
> -			    dev->bus, dev->dev, dev->func);
> -		} else {
> -		    sprintf(file, "/proc/bus/pci/%02x/%02x.%1x",
> -			    dev->bus, dev->dev, dev->func);
> -		}
> -	    } else {
> -		sprintf(file,"/proc/bus/pci/%02x%02x", dev->domain, dev->bus);
> -		if (stat(file, &ignored) < 0) {
> -		    sprintf(file, "/proc/bus/pci/%04x:%04x/%02x.%1x",
> -			    dev->domain, dev->bus, dev->dev, dev->func);
> -		} else {
> -		    sprintf(file, "/proc/bus/pci/%02x%02x/%02x.%1x",
> -			    dev->domain, dev->bus, dev->dev, dev->func);
> -		}
> -	    }
> -	}
> +	sprintf(file,"/sys/bus/pci/devices/%04u:%02x:%02x.%01x/config",
> +		dev->domain, dev->bus, dev->dev, dev->func);
>  
>  	if (write) {
>  	    fd = open(file,O_RDWR);
> -- 

but I guess some time soon we'll remove all PCI mapping routines from the
server, right?

Reviewed-by: Tiago Vignatti <tiago.vignatti at nokia.com>

             Tiago


More information about the xorg-devel mailing list