From 76af81bdf8ade158d7cef718ff6cf31cbf641a9a Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 3 Mar 2014 16:07:16 +0100 Subject: [PATCH] xf86platformBus: Make doPlatformProbe accept a NULL gdev argument And use it from xf86platformAddDevice too, instead of directly calling drvp->platformProbe. Signed-off-by: Hans de Goede Reviewed-by: Dave Airlie --- hw/xfree86/common/xf86platformBus.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c index 4447e19df..564567efc 100644 --- a/hw/xfree86/common/xf86platformBus.c +++ b/hw/xfree86/common/xf86platformBus.c @@ -312,13 +312,13 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp, Bool foundScreen = FALSE; int entity; - if (gdev->screen == 0 && !xf86_check_platform_slot(dev)) + if (gdev && gdev->screen == 0 && !xf86_check_platform_slot(dev)) return FALSE; entity = xf86ClaimPlatformSlot(dev, drvp, 0, - gdev, gdev->active); + gdev, gdev ? gdev->active : 0); - if ((entity == -1) && (gdev->screen > 0)) { + if ((entity == -1) && gdev && (gdev->screen > 0)) { unsigned nent; for (nent = 0; nent < xf86NumEntities; nent++) { @@ -420,7 +420,6 @@ xf86platformAddDevice(int index) { int i, old_screens, scr_index; DriverPtr drvp = NULL; - int entity; screenLayoutPtr layout; static const char *hotplug_driver_name = "modesetting"; @@ -440,11 +439,8 @@ xf86platformAddDevice(int index) return -1; old_screens = xf86NumGPUScreens; - entity = xf86ClaimPlatformSlot(&xf86_platform_devices[index], - drvp, 0, 0, 0); - if (!drvp->platformProbe(drvp, entity, PLATFORM_PROBE_GPU_SCREEN, &xf86_platform_devices[index], 0)) { - xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL); - } + doPlatformProbe(&xf86_platform_devices[index], drvp, NULL, + PLATFORM_PROBE_GPU_SCREEN, 0); if (old_screens == xf86NumGPUScreens) return -1; i = old_screens;