drop superfluous getAMDGPUEntityIndex() and _X_EXPORT

a) instead of duplicated extern declarations of gAMDGPUEntityIndex in
   several source files, just move this into amdgpu_drv.h header.
b) no need to _X_EXPORT this field (no other modul using it ever).
c) no need for extra getter function, just use the field directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-08-04 12:27:13 +02:00
committed by Joseph Crowell
parent 60020bc22e
commit fb4912cd4a
3 changed files with 6 additions and 11 deletions

View File

@@ -351,4 +351,6 @@ extern RRCrtcPtr amdgpu_randr_crtc_covering_drawable(DrawablePtr pDraw);
extern AMDGPUEntPtr AMDGPUEntPriv(ScrnInfoPtr pScrn);
extern int gAMDGPUEntityIndex;
#endif /* _AMDGPU_DRV_H_ */

View File

@@ -217,18 +217,11 @@ amdgpu_unwrap_property_requests(ScrnInfoPtr scrn)
amdgpu_property_vectors_wrapped = FALSE;
}
extern _X_EXPORT int gAMDGPUEntityIndex;
static int getAMDGPUEntityIndex(void)
{
return gAMDGPUEntityIndex;
}
AMDGPUEntPtr AMDGPUEntPriv(ScrnInfoPtr pScrn)
{
DevUnion *pPriv;
AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
pPriv = xf86GetEntityPrivate(info->pEnt->index, getAMDGPUEntityIndex());
pPriv = xf86GetEntityPrivate(info->pEnt->index, gAMDGPUEntityIndex);
return pPriv->ptr;
}
@@ -269,7 +262,7 @@ static void AMDGPUFreeRec(ScrnInfoPtr pScrn)
DevUnion *pPriv;
AMDGPUEntPtr pAMDGPUEnt;
pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
getAMDGPUEntityIndex());
gAMDGPUEntityIndex);
pAMDGPUEnt = pPriv->ptr;
pAMDGPUEnt->fd_ref--;
@@ -1507,7 +1500,7 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
return FALSE;
pAMDGPUEnt = xf86GetEntityPrivate(pScrn->entityList[0],
getAMDGPUEntityIndex())->ptr;
gAMDGPUEntityIndex)->ptr;
if (!AMDGPUGetRec(pScrn))
return FALSE;

View File

@@ -55,7 +55,7 @@
#include <xf86platformBus.h>
_X_EXPORT int gAMDGPUEntityIndex = -1;
int gAMDGPUEntityIndex = -1;
/* Return the options for supported chipset 'n'; NULL otherwise */
static const OptionInfoRec *AMDGPUAvailableOptions(int chipid, int busid)