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

Emil Velikov emil.l.velikov at gmail.com
Tue Apr 24 18:13:48 UTC 2018


On 10 April 2018 at 09:27, Michel Dänzer <michel at daenzer.net> wrote:
> 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.
>
Was respinning the patches and noticed that the guard is needed. Namely:

The ODEV_ATTRIB_FD macro is set in xf86platformBus.h which is included
only as XSERVER_PLATFORM_BUS is set.
We can use either macro as a guard, yet the former seems more natural/obvious.

What do you think?

-Emil


More information about the amd-gfx mailing list