From 436da935bde43076f3052a758a463ed080e8a747 Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Tue, 10 Jan 2017 18:51:57 +0800 Subject: [PATCH] modesetting: cleanup pci device open Signed-off-by: Qiang Yu Reviewed-by: Hans de Goede Signed-off-by: Peter Hutterer --- hw/xfree86/drivers/modesetting/driver.c | 24 +++++++++++------------- hw/xfree86/drivers/modesetting/driver.h | 6 ------ 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c index a27b32757..d7030e5c2 100644 --- a/hw/xfree86/drivers/modesetting/driver.c +++ b/hw/xfree86/drivers/modesetting/driver.c @@ -812,7 +812,6 @@ ms_get_drm_master_fd(ScrnInfoPtr pScrn) EntityInfoPtr pEnt; modesettingPtr ms; modesettingEntPtr ms_ent; - char *BusID = NULL; ms = modesettingPTR(pScrn); ms_ent = ms_ent_priv(pScrn); @@ -845,25 +844,24 @@ ms_get_drm_master_fd(ScrnInfoPtr pScrn) } else #endif +#if XSERVER_LIBPCIACCESS if (pEnt->location.type == BUS_PCI) { - ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index); - if (ms->PciInfo) { + char *BusID = NULL; + struct pci_device *PciInfo; + + PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index); + if (PciInfo) { BusID = XNFalloc(64); sprintf(BusID, "PCI:%d:%d:%d", -#if XSERVER_LIBPCIACCESS - ((ms->PciInfo->domain << 8) | ms->PciInfo->bus), - ms->PciInfo->dev, ms->PciInfo->func -#else - ((pciConfigPtr) ms->PciInfo->thisCard)->busnum, - ((pciConfigPtr) ms->PciInfo->thisCard)->devnum, - ((pciConfigPtr) ms->PciInfo->thisCard)->funcnum -#endif - ); + ((PciInfo->domain << 8) | PciInfo->bus), + PciInfo->dev, PciInfo->func); } ms->fd = drmOpen(NULL, BusID); free(BusID); } - else { + else +#endif + { const char *devicename; devicename = xf86FindOptionValue(ms->pEnt->device->options, "kmsdev"); ms->fd = open_hw(devicename); diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h index eee96e50f..25e3a547d 100644 --- a/hw/xfree86/drivers/modesetting/driver.h +++ b/hw/xfree86/drivers/modesetting/driver.h @@ -89,12 +89,6 @@ typedef struct _modesettingRec { int Chipset; EntityInfoPtr pEnt; -#if XSERVER_LIBPCIACCESS - struct pci_device *PciInfo; -#else - pciVideoPtr PciInfo; - PCITAG PciTag; -#endif Bool noAccel; CloseScreenProcPtr CloseScreen;