xfree86: Remove driver entity hooks and private

No driver is using these, as far as I know.

v2: Tripwire the entity hook arguments to xf86Config*Entity, fix
documentation (Eric Anholt)

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Adam Jackson 2017-03-29 11:35:32 -04:00
parent 3360418767
commit e4d0757fc2
10 changed files with 12 additions and 151 deletions

View File

@ -154,9 +154,6 @@ extern _X_EXPORT GDevPtr xf86GetDevFromEntity(int entityIndex, int instance);
extern _X_EXPORT void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, extern _X_EXPORT void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn,
int entityIndex); int entityIndex);
extern _X_EXPORT EntityInfoPtr xf86GetEntityInfo(int entityIndex); extern _X_EXPORT EntityInfoPtr xf86GetEntityInfo(int entityIndex);
extern _X_EXPORT Bool xf86SetEntityFuncs(int entityIndex, EntityProc init,
EntityProc enter, EntityProc leave,
void *);
extern _X_EXPORT Bool xf86IsEntityPrimary(int entityIndex); extern _X_EXPORT Bool xf86IsEntityPrimary(int entityIndex);
extern _X_EXPORT ScrnInfoPtr xf86FindScreenForEntity(int entityIndex); extern _X_EXPORT ScrnInfoPtr xf86FindScreenForEntity(int entityIndex);

View File

@ -312,19 +312,6 @@ xf86IsEntityPrimary(int entityIndex)
} }
} }
Bool
xf86SetEntityFuncs(int entityIndex, EntityProc init, EntityProc enter,
EntityProc leave, void *private)
{
if (entityIndex >= xf86NumEntities)
return FALSE;
xf86Entities[entityIndex]->entityInit = init;
xf86Entities[entityIndex]->entityEnter = enter;
xf86Entities[entityIndex]->entityLeave = leave;
xf86Entities[entityIndex]->private = private;
return TRUE;
}
Bool Bool
xf86DriverHasEntities(DriverPtr drvp) xf86DriverHasEntities(DriverPtr drvp)
{ {
@ -542,30 +529,6 @@ xf86GetDevFromEntity(int entityIndex, int instance)
return xf86Entities[entityIndex]->devices[i]; return xf86Entities[entityIndex]->devices[i];
} }
/*
* xf86AccessEnter() -- gets called to save the text mode VGA IO
* resources when reentering the server after a VT switch.
*/
void
xf86AccessEnter(void)
{
int i;
for (i = 0; i < xf86NumEntities; i++)
if (xf86Entities[i]->entityEnter)
xf86Entities[i]->entityEnter(i, xf86Entities[i]->private);
}
void
xf86AccessLeave(void)
{
int i;
for (i = 0; i < xf86NumEntities; i++)
if (xf86Entities[i]->entityLeave)
xf86Entities[i]->entityLeave(i, xf86Entities[i]->private);
}
/* /*
* xf86PostProbe() -- Allocate all non conflicting resources * xf86PostProbe() -- Allocate all non conflicting resources
* This function gets called by xf86Init(). * This function gets called by xf86Init().
@ -573,8 +536,6 @@ xf86AccessLeave(void)
void void
xf86PostProbe(void) xf86PostProbe(void)
{ {
int i;
if (fbSlotClaimed && ( if (fbSlotClaimed && (
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
sbusSlotClaimed || sbusSlotClaimed ||
@ -590,10 +551,6 @@ xf86PostProbe(void)
)) ))
FatalError("Cannot run in framebuffer mode. Please specify busIDs " FatalError("Cannot run in framebuffer mode. Please specify busIDs "
" for all framebuffer devices\n"); " for all framebuffer devices\n");
for (i = 0; i < xf86NumEntities; i++)
if (xf86Entities[i]->entityInit)
xf86Entities[i]->entityInit(i, xf86Entities[i]->private);
} }
int int

View File

@ -48,10 +48,6 @@ typedef struct {
DriverPtr driver; DriverPtr driver;
int chipset; int chipset;
int entityProp; int entityProp;
EntityProc entityInit;
EntityProc entityEnter;
EntityProc entityLeave;
void *private;
Bool active; Bool active;
Bool inUse; Bool inUse;
BusRec bus; BusRec bus;

View File

@ -445,8 +445,6 @@ xf86VTLeave(void)
for (i = 0; i < xf86NumGPUScreens; i++) for (i = 0; i < xf86NumGPUScreens; i++)
xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]); xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]);
xf86AccessLeave(); /* We need this here, otherwise */
if (!xf86VTSwitchAway()) if (!xf86VTSwitchAway())
goto switch_failed; goto switch_failed;
@ -472,7 +470,6 @@ xf86VTLeave(void)
switch_failed: switch_failed:
DebugF("xf86VTSwitch: Leave failed\n"); DebugF("xf86VTSwitch: Leave failed\n");
xf86AccessEnter();
for (i = 0; i < xf86NumScreens; i++) { for (i = 0; i < xf86NumScreens; i++) {
if (!xf86Screens[i]->EnterVT(xf86Screens[i])) if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
FatalError("EnterVT failed for screen %d\n", i); FatalError("EnterVT failed for screen %d\n", i);
@ -517,7 +514,6 @@ xf86VTEnter(void)
if (xorgHWAccess) if (xorgHWAccess)
xf86EnableIO(); xf86EnableIO();
xf86AccessEnter();
for (i = 0; i < xf86NumScreens; i++) { for (i = 0; i < xf86NumScreens; i++) {
xf86Screens[i]->vtSema = TRUE; xf86Screens[i]->vtSema = TRUE;
if (!xf86Screens[i]->EnterVT(xf86Screens[i])) if (!xf86Screens[i]->EnterVT(xf86Screens[i]))

View File

@ -1672,7 +1672,6 @@ xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init,
if ((pScrn = xf86FindScreenForEntity(pEnt->index))) if ((pScrn = xf86FindScreenForEntity(pEnt->index)))
xf86RemoveEntityFromScreen(pScrn, pEnt->index); xf86RemoveEntityFromScreen(pScrn, pEnt->index);
xf86SetEntityFuncs(pEnt->index, init, enter, leave, private);
} }
ScrnInfoPtr ScrnInfoPtr
@ -1682,6 +1681,9 @@ xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
{ {
EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex); EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
if (init || enter || leave)
FatalError("Legacy entity access functions are unsupported\n");
if (!pEnt) if (!pEnt)
return pScrn; return pScrn;
@ -1700,8 +1702,6 @@ xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
pScrn = xf86AllocateScreen(pEnt->driver, scrnFlag); pScrn = xf86AllocateScreen(pEnt->driver, scrnFlag);
xf86AddEntityToScreen(pScrn, entityIndex); xf86AddEntityToScreen(pScrn, entityIndex);
xf86SetEntityFuncs(entityIndex, init, enter, leave, private);
free(pEnt); free(pEnt);
return pScrn; return pScrn;
} }

View File

@ -726,7 +726,6 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
#ifdef HAS_USL_VTS #ifdef HAS_USL_VTS
ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ); ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ);
#endif #endif
xf86AccessEnter();
input_lock(); input_lock();
sigio_blocked = TRUE; sigio_blocked = TRUE;
} }
@ -1001,8 +1000,6 @@ AbortDDX(enum ExitCode error)
} }
} }
xf86AccessLeave();
/* /*
* This is needed for an abnormal server exit, since the normal exit stuff * This is needed for an abnormal server exit, since the normal exit stuff
* MUST also be performed (i.e. the vt must be left in a defined state) * MUST also be performed (i.e. the vt must be left in a defined state)

View File

@ -116,8 +116,6 @@ suspend(pmEvent event, Bool undo)
xf86Screens[i]->vtSema = FALSE; xf86Screens[i]->vtSema = FALSE;
} }
} }
xf86AccessLeave();
} }
static void static void
@ -126,7 +124,6 @@ resume(pmEvent event, Bool undo)
int i; int i;
InputInfoPtr pInfo; InputInfoPtr pInfo;
xf86AccessEnter();
for (i = 0; i < xf86NumScreens; i++) { for (i = 0; i < xf86NumScreens; i++) {
if (xf86Screens[i]->PMEvent) if (xf86Screens[i]->PMEvent)
xf86Screens[i]->PMEvent(xf86Screens[i], event, undo); xf86Screens[i]->PMEvent(xf86Screens[i], event, undo);

View File

@ -109,8 +109,6 @@ extern int xf86NumGPUScreens;
/* xf86Bus.c */ /* xf86Bus.c */
extern _X_EXPORT Bool xf86BusConfig(void); extern _X_EXPORT Bool xf86BusConfig(void);
extern _X_EXPORT void xf86BusProbe(void); extern _X_EXPORT void xf86BusProbe(void);
extern _X_EXPORT void xf86AccessEnter(void);
extern _X_EXPORT void xf86AccessLeave(void);
extern _X_EXPORT void xf86PostProbe(void); extern _X_EXPORT void xf86PostProbe(void);
extern _X_EXPORT void xf86ClearEntityListForScreen(ScrnInfoPtr pScrn); extern _X_EXPORT void xf86ClearEntityListForScreen(ScrnInfoPtr pScrn);
extern _X_EXPORT void xf86AddDevToEntity(int entityIndex, GDevPtr dev); extern _X_EXPORT void xf86AddDevToEntity(int entityIndex, GDevPtr dev);

View File

@ -1023,9 +1023,6 @@ xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets * p_chip,
if ((pScrn = xf86FindScreenForEntity(pEnt->index))) if ((pScrn = xf86FindScreenForEntity(pEnt->index)))
xf86RemoveEntityFromScreen(pScrn, pEnt->index); xf86RemoveEntityFromScreen(pScrn, pEnt->index);
/* shared resources are only needed when entity is active: remove */
xf86SetEntityFuncs(pEnt->index, init, enter, leave, private);
} }
ScrnInfoPtr ScrnInfoPtr
@ -1035,6 +1032,9 @@ xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
{ {
EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex); EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex);
if (dummy || init || enter || leave)
FatalError("Legacy entity access functions are unsupported\n");
if (!pEnt) if (!pEnt)
return pScrn; return pScrn;
@ -1060,8 +1060,6 @@ xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
} }
free(pEnt); free(pEnt);
xf86SetEntityFuncs(entityIndex, init, enter, leave, private);
return pScrn; return pScrn;
} }

View File

@ -834,14 +834,8 @@ Here is what <function>InitOutput()</function> does:
stage. If a resource conflict is found between exclusive resources stage. If a resource conflict is found between exclusive resources
the driver will fail immediately. This is usually best done with the driver will fail immediately. This is usually best done with
the <function>xf86ConfigPciEntity()</function> helper function the <function>xf86ConfigPciEntity()</function> helper function
for PCI and <function>xf86ConfigIsaEntity()</function> for ISA for PCI.
(see the <link linkend="rac">RAC</link> section). It is possible to </para>
register some entity specific functions with those helpers. When
not using the helpers, the <function>xf86AddEntityToScreen()</function>
<function>xf86ClaimFixedResources()</function> and
<function>xf86SetEntityFuncs()</function> should be used instead (see
the <link linkend="rac">RAC</link> section).
</para>
<para> <para>
If a chipset is specified in an active device section which the If a chipset is specified in an active device section which the
@ -860,8 +854,7 @@ Here is what <function>InitOutput()</function> does:
Allocate a <structname>ScrnInfoRec</structname> for each active instance of the Allocate a <structname>ScrnInfoRec</structname> for each active instance of the
hardware found, and fill in the basic information, including the hardware found, and fill in the basic information, including the
other driver entry points. This is best done with the other driver entry points. This is best done with the
<function>xf86ConfigIsaEntity()</function> helper function for ISA <function>xf86ConfigPciEntity()</function> for PCI instances.
instances or <function>xf86ConfigPciEntity()</function> for PCI instances.
These functions allocate a <structname>ScrnInfoRec</structname> for active These functions allocate a <structname>ScrnInfoRec</structname> for active
entities. Optionally <function>xf86AllocateScreen()</function> entities. Optionally <function>xf86AllocateScreen()</function>
function may also be used to allocate the <structname>ScrnInfoRec</structname>. function may also be used to allocate the <structname>ScrnInfoRec</structname>.
@ -2681,41 +2674,17 @@ Two helper functions are provided to aid configuring entities:
ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn,
int scrnFlag, int entityIndex, int scrnFlag, int entityIndex,
PciChipsets *p_chip, PciChipsets *p_chip,
resList res, EntityProc init, void *res, EntityProc init,
EntityProc enter, EntityProc leave, EntityProc enter, EntityProc leave,
pointer private); pointer private);
ScrnInfoPtr xf86ConfigIsaEntity(ScrnInfoPtr pScrn,
int scrnFlag, int entityIndex,
IsaChipsets *i_chip,
resList res, EntityProc init,
EntityProc enter, EntityProc leave,
pointer private);
</programlisting> </programlisting>
<blockquote><para> <blockquote><para>
These functions are used to register the non-relocatable resources This functions is used to register the entity. The <parameter>res</parameter>, <parameter>init</parameter>, <parameter>enter</parameter>, and <parameter>leave</parameter> arguments are unused, and should be <constant>NULL</constant>.
for an entity, and the optional entity-specific <parameter>Init</parameter>, <parameter>Enter</parameter> and
<parameter>Leave</parameter> functions. Usually the list of fixed resources is obtained
from the Isa/PciChipsets lists. However an additional list of
resources may be passed. Generally this is not required.
For active entities a <structname>ScrnInfoRec</structname> is allocated For active entities a <structname>ScrnInfoRec</structname> is allocated
if the <parameter>pScrn</parameter> argument is <constant>NULL</constant>. if the <parameter>pScrn</parameter> argument is <constant>NULL</constant>.
The The
return value is <constant>TRUE</constant> when successful. The init, enter, leave return value is <constant>TRUE</constant> when successful.
functions are defined as follows:
<blockquote><para>
<programlisting>
typedef void (*EntityProc)(int entityIndex,
pointer private);
</programlisting>
</para></blockquote>
They are passed the entity index and a pointer to a private scratch
area. This can be set up during <function>Probe()</function> and
its address can be passed to
<function>xf86ConfigIsaEntity()</function> and
<function>xf86ConfigPciEntity()</function> as the last argument.
</para> </para>
</blockquote></para></blockquote> </blockquote></para></blockquote>
@ -2738,19 +2707,6 @@ available at the driver level:
</blockquote></para></blockquote> </blockquote></para></blockquote>
<blockquote><para>
<programlisting>
Bool xf86SetEntityFuncs(int entityIndex, EntityProc init,
EntityProc enter, EntityProc leave, pointer);
</programlisting>
<blockquote><para>
This function registers with an entity the <parameter>init</parameter>,
<parameter>enter</parameter>, <parameter>leave</parameter> functions along
with the pointer to their private area.
</para>
</blockquote></para></blockquote>
<blockquote><para> <blockquote><para>
<programlisting> <programlisting>
void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex); void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex);
@ -8291,37 +8247,6 @@ ZZZProbe(DriverPtr drv, int flags)
xfree(usedChips); xfree(usedChips);
} }
#ifdef HAS_ISA_DEVS
/*
* If the driver supports ISA hardware, the following block
* can be included too.
*/
numUsed = xf86MatchIsaInstances(ZZZ_NAME, ZZZChipsets,
ZZZIsaChipsets, drv, ZZZFindIsaDevice,
devSections, numDevSections, &amp;usedChips);
for (i = 0; i &lt; numUsed; i++) {
ScrnInfoPtr pScrn = NULL;
if ((pScrn = xf86ConfigIsaEntity(pScrn, flags, usedChips[i],
ZZZIsaChipsets, NULL, NULL, NULL,
NULL, NULL))) {
pScrn-&gt;driverVersion = VERSION;
pScrn-&gt;driverName = ZZZ_DRIVER_NAME;
pScrn-&gt;name = ZZZ_NAME;
pScrn-&gt;Probe = ZZZProbe;
pScrn-&gt;PreInit = ZZZPreInit;
pScrn-&gt;ScreenInit = ZZZScreenInit;
pScrn-&gt;SwitchMode = ZZZSwitchMode;
pScrn-&gt;AdjustFrame = ZZZAdjustFrame;
pScrn-&gt;EnterVT = ZZZEnterVT;
pScrn-&gt;LeaveVT = ZZZLeaveVT;
pScrn-&gt;FreeScreen = ZZZFreeScreen;
pScrn-&gt;ValidMode = ZZZValidMode;
foundScreen = TRUE;
}
}
xfree(usedChips);
#endif /* HAS_ISA_DEVS */
xfree(devSections); xfree(devSections);
return foundScreen; return foundScreen;
</programlisting> </programlisting>