[PATCH xserver 4/4] modesetting: cleanup pci device open

Qiang Yu Qiang.Yu at amd.com
Tue Jan 10 10:51:57 UTC 2017


Signed-off-by: Qiang Yu <Qiang.Yu at amd.com>
---
 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 a27b327..d7030e5 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 eee96e5..25e3a54 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;
-- 
2.7.4



More information about the xorg-devel mailing list