[PATCH xf86-video-amdgpu 03/19] Use ODEV_ATTRIB_PATH where possible for the device node.

Michel Dänzer michel at daenzer.net
Tue Apr 10 08:27:52 UTC 2018


On 2018-04-04 04:29 PM, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
> 
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
>  src/amdgpu_probe.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/src/amdgpu_probe.c b/src/amdgpu_probe.c
> index e65c83b..78cc005 100644
> --- a/src/amdgpu_probe.c
> +++ b/src/amdgpu_probe.c
> @@ -33,6 +33,8 @@
>  #include <errno.h>
>  #include <string.h>
>  #include <stdlib.h>
> +#include <sys/stat.h>
> +#include <fcntl.h>
>  
>  /*
>   * Authors:
> @@ -117,18 +119,28 @@ static int amdgpu_kernel_open_fd(ScrnInfoPtr pScrn,
>  				 struct xf86_platform_device *platform_dev)
>  {
>  	struct pci_device *dev;
> +	const char *path;
>  	char *busid;
>  	int fd;
>  
> -#ifdef ODEV_ATTRIB_FD
>  	if (platform_dev) {
> +#ifdef ODEV_ATTRIB_FD
>  		fd = xf86_get_platform_device_int_attrib(platform_dev,
>  							 ODEV_ATTRIB_FD, -1);
>  		if (fd != -1)
>  			return fd;
> -	}
>  #endif
>  
> +#ifdef ODEV_ATTRIB_PATH

This guard is superfluous: ODEV_ATTRIB_PATH was added in xserver 1.13,
and we require >= 1.13.


> +		path = xf86_get_platform_device_attrib(platform_dev,
> +						       ODEV_ATTRIB_PATH);
> +
> +		fd = open(path, O_RDWR | O_CLOEXEC);
> +		if (fd != -1)
> +			return fd;
> +#endif
> +	}
> +
>  	if (platform_dev)
>  		dev = platform_dev->pdev;
>  	else
> 


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the amd-gfx mailing list