modesetting: cleanup pci device open

Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Qiang Yu 2017-01-10 18:51:57 +08:00 committed by Peter Hutterer
parent 555e0a42d1
commit 436da935bd
2 changed files with 11 additions and 19 deletions

View File

@ -812,7 +812,6 @@ ms_get_drm_master_fd(ScrnInfoPtr pScrn)
EntityInfoPtr pEnt; EntityInfoPtr pEnt;
modesettingPtr ms; modesettingPtr ms;
modesettingEntPtr ms_ent; modesettingEntPtr ms_ent;
char *BusID = NULL;
ms = modesettingPTR(pScrn); ms = modesettingPTR(pScrn);
ms_ent = ms_ent_priv(pScrn); ms_ent = ms_ent_priv(pScrn);
@ -845,25 +844,24 @@ ms_get_drm_master_fd(ScrnInfoPtr pScrn)
} }
else else
#endif #endif
#if XSERVER_LIBPCIACCESS
if (pEnt->location.type == BUS_PCI) { if (pEnt->location.type == BUS_PCI) {
ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index); char *BusID = NULL;
if (ms->PciInfo) { struct pci_device *PciInfo;
PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index);
if (PciInfo) {
BusID = XNFalloc(64); BusID = XNFalloc(64);
sprintf(BusID, "PCI:%d:%d:%d", sprintf(BusID, "PCI:%d:%d:%d",
#if XSERVER_LIBPCIACCESS ((PciInfo->domain << 8) | PciInfo->bus),
((ms->PciInfo->domain << 8) | ms->PciInfo->bus), PciInfo->dev, PciInfo->func);
ms->PciInfo->dev, ms->PciInfo->func
#else
((pciConfigPtr) ms->PciInfo->thisCard)->busnum,
((pciConfigPtr) ms->PciInfo->thisCard)->devnum,
((pciConfigPtr) ms->PciInfo->thisCard)->funcnum
#endif
);
} }
ms->fd = drmOpen(NULL, BusID); ms->fd = drmOpen(NULL, BusID);
free(BusID); free(BusID);
} }
else { else
#endif
{
const char *devicename; const char *devicename;
devicename = xf86FindOptionValue(ms->pEnt->device->options, "kmsdev"); devicename = xf86FindOptionValue(ms->pEnt->device->options, "kmsdev");
ms->fd = open_hw(devicename); ms->fd = open_hw(devicename);

View File

@ -89,12 +89,6 @@ typedef struct _modesettingRec {
int Chipset; int Chipset;
EntityInfoPtr pEnt; EntityInfoPtr pEnt;
#if XSERVER_LIBPCIACCESS
struct pci_device *PciInfo;
#else
pciVideoPtr PciInfo;
PCITAG PciTag;
#endif
Bool noAccel; Bool noAccel;
CloseScreenProcPtr CloseScreen; CloseScreenProcPtr CloseScreen;