[PATCH:xserver] Revert "modesetting: Remove #ifdefs XF86_PDEV_SERVER_FD"

Submitted by Alan Coopersmith on March 4, 2018, 9 p.m.

Details

Message ID 20180304210005.14854-1-alan.coopersmith@oracle.com
State Accepted
Commit 7fc89251ef5e7363dfbf6d831ed448bbcd8519b8
Headers show
Series "Revert "modesetting: Remove #ifdefs XF86_PDEV_SERVER_FD"" ( rev: 1 ) in X.org (DEPRECATED - USE GITLAB)

Not browsing as part of any series.

Commit Message

Alan Coopersmith March 4, 2018, 9 p.m.
This reverts commit 8c455db0ebb6e5313ca81428bb6dd75ef12aaa15.

Since xf86platformBus.h is only included when XSERVER_PLATFORM_BUS is
defined, and configure.ac only defines that on systems with udev, this
commit breaks the build on non-udev systems like Solaris.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
---

Alternatively, you could remove the #ifdef XSERVER_PLATFORM_BUS around the
#include "xf86platformBus.h" since that header defines XF86_PDEV_SERVER_FD
before checking #ifdef XSERVER_PLATFORM_BUS itself.

 hw/xfree86/drivers/modesetting/driver.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Patch hide | download patch | download mbox

diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index 380dbbe17..91d850427 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -244,12 +244,14 @@  probe_hw(const char *dev, struct xf86_platform_device *platform_dev)
 {
     int fd;
 
+#ifdef XF86_PDEV_SERVER_FD
     if (platform_dev && (platform_dev->flags & XF86_PDEV_SERVER_FD)) {
         fd = xf86_platform_device_odev_attributes(platform_dev)->fd;
         if (fd == -1)
             return FALSE;
         return check_outputs(fd, NULL);
     }
+#endif
 
     fd = open_hw(dev);
     if (fd != -1) {
@@ -710,8 +712,10 @@  FreeRec(ScrnInfoPtr pScrn)
             if (ms->pEnt->location.type == BUS_PCI)
                 ret = drmClose(ms->fd);
             else
+#ifdef XF86_PDEV_SERVER_FD
                 if (!(ms->pEnt->location.type == BUS_PLATFORM &&
                       (ms->pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD)))
+#endif
                     ret = close(ms->fd);
             (void) ret;
             ms_ent->fd = 0;
@@ -824,11 +828,13 @@  ms_get_drm_master_fd(ScrnInfoPtr pScrn)
 
 #ifdef XSERVER_PLATFORM_BUS
     if (pEnt->location.type == BUS_PLATFORM) {
+#ifdef XF86_PDEV_SERVER_FD
         if (pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD)
             ms->fd =
                 xf86_platform_device_odev_attributes(pEnt->location.id.plat)->
                 fd;
         else
+#endif
         {
             char *path =
                 xf86_platform_device_odev_attributes(pEnt->location.id.plat)->
@@ -1490,9 +1496,11 @@  SetMaster(ScrnInfoPtr pScrn)
     modesettingPtr ms = modesettingPTR(pScrn);
     int ret;
 
+#ifdef XF86_PDEV_SERVER_FD
     if (ms->pEnt->location.type == BUS_PLATFORM &&
         (ms->pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD))
         return TRUE;
+#endif
 
     ret = drmSetMaster(ms->fd);
     if (ret)
@@ -1741,9 +1749,11 @@  LeaveVT(ScrnInfoPtr pScrn)
 
     pScrn->vtSema = FALSE;
 
+#ifdef XF86_PDEV_SERVER_FD
     if (ms->pEnt->location.type == BUS_PLATFORM &&
         (ms->pEnt->location.id.plat->flags & XF86_PDEV_SERVER_FD))
         return;
+#endif
 
     drmDropMaster(ms->fd);
 }

Comments

On 03/ 4/18 01:00 PM, Alan Coopersmith wrote:
> Alternatively, you could remove the #ifdef XSERVER_PLATFORM_BUS around the
> #include "xf86platformBus.h" since that header defines XF86_PDEV_SERVER_FD
> before checking #ifdef XSERVER_PLATFORM_BUS itself.

Sorry, spoke too soon - alternative doesn't work either:

driver.c: In function ‘probe_hw’:
driver.c:246:14: error: implicit declaration of function
‘xf86_platform_device_odev_attributes’; did you mean
‘xf86platformAddGPUDevices’? [-Werror=implicit-function-declaration]
         fd = xf86_platform_device_odev_attributes(platform_dev)->fd;
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              xf86platformAddGPUDevices
driver.c:246:14: warning: nested extern declaration of
‘xf86_platform_device_odev_attributes’ [-Wnested-externs]
driver.c:246:64: error: invalid type argument of ‘->’ (have ‘int’)
         fd = xf86_platform_device_odev_attributes(platform_dev)->fd;
                                                                ^~