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

Michel Dänzer michel at daenzer.net
Wed Apr 25 09:55:47 UTC 2018


On 2018-04-24 08:13 PM, Emil Velikov wrote:
> 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.

I see, yeah makes sense.


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


More information about the amd-gfx mailing list