[PATCH 18/19] xfree86: Remove driver entity hooks and private

Mark Kettenis mark.kettenis at xs4all.nl
Thu Sep 25 14:25:25 PDT 2014


> From: Adam Jackson <ajax at redhat.com>
> Date: Thu, 25 Sep 2014 13:37:34 -0400
> 
> No driver is using these, as far as I know.

The xf86-video-mga driver uses these, but only if DISABLE_VGA_IO is
defined, and by default it isn't, and there is no configure option to
turn it on.

I'm a bit worried about silently ignoring the arguments passed to
xf86ConfigFbEntity* and xf86ConfigPciEntity*.  Perhaps throw a fatal
error if any of the function pointers is non-NULL?

> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  hw/xfree86/common/xf86.h       |  3 ---
>  hw/xfree86/common/xf86Bus.c    | 41 -----------------------------------------
>  hw/xfree86/common/xf86Bus.h    |  4 ----
>  hw/xfree86/common/xf86Events.c |  4 ----
>  hw/xfree86/common/xf86Helper.c |  3 ---
>  hw/xfree86/common/xf86Init.c   |  3 ---
>  hw/xfree86/common/xf86PM.c     |  3 ---
>  hw/xfree86/common/xf86Priv.h   |  2 --
>  hw/xfree86/common/xf86pciBus.c |  5 -----
>  hw/xfree86/doc/ddxDesign.xml   | 22 ++--------------------
>  10 files changed, 2 insertions(+), 88 deletions(-)
> 
> diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
> index 49ff35b..25e2190 100644
> --- a/hw/xfree86/common/xf86.h
> +++ b/hw/xfree86/common/xf86.h
> @@ -156,9 +156,6 @@ extern _X_EXPORT GDevPtr xf86GetDevFromEntity(int entityIndex, int instance);
>  extern _X_EXPORT void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn,
>                                                   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 ScrnInfoPtr xf86FindScreenForEntity(int entityIndex);
>  
> diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
> index bd3e4e3..a520e12 100644
> --- a/hw/xfree86/common/xf86Bus.c
> +++ b/hw/xfree86/common/xf86Bus.c
> @@ -290,19 +290,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
>  xf86DriverHasEntities(DriverPtr drvp)
>  {
>      int i;
> @@ -519,30 +506,6 @@ xf86GetDevFromEntity(int entityIndex, int instance)
>  }
>  
>  /*
> - * 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
>   * This function gets called by xf86Init().
>   */
> @@ -566,10 +529,6 @@ xf86PostProbe(void)
>          ))
>          FatalError("Cannot run in framebuffer mode. Please specify busIDs "
>                     "       for all framebuffer devices\n");
> -
> -    for (i = 0; i < xf86NumEntities; i++)
> -        if (xf86Entities[i]->entityInit)
> -            xf86Entities[i]->entityInit(i, xf86Entities[i]->private);
>  }
>  
>  int
> diff --git a/hw/xfree86/common/xf86Bus.h b/hw/xfree86/common/xf86Bus.h
> index c59625d..52b497a 100644
> --- a/hw/xfree86/common/xf86Bus.h
> +++ b/hw/xfree86/common/xf86Bus.h
> @@ -48,10 +48,6 @@ typedef struct {
>      DriverPtr driver;
>      int chipset;
>      int entityProp;
> -    EntityProc entityInit;
> -    EntityProc entityEnter;
> -    EntityProc entityLeave;
> -    void *private;
>      Bool active;
>      Bool inUse;
>      BusRec bus;
> diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
> index 16b3e28..27206d9 100644
> --- a/hw/xfree86/common/xf86Events.c
> +++ b/hw/xfree86/common/xf86Events.c
> @@ -492,8 +492,6 @@ xf86VTLeave(void)
>      for (i = 0; i < xf86NumGPUScreens; i++)
>          xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]);
>  
> -    xf86AccessLeave();      /* We need this here, otherwise */
> -
>      if (!xf86VTSwitchAway())
>          goto switch_failed;
>  
> @@ -519,7 +517,6 @@ xf86VTLeave(void)
>  
>  switch_failed:
>      DebugF("xf86VTSwitch: Leave failed\n");
> -    xf86AccessEnter();
>      for (i = 0; i < xf86NumScreens; i++) {
>          if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
>              FatalError("EnterVT failed for screen %d\n", i);
> @@ -564,7 +561,6 @@ xf86VTEnter(void)
>  
>      if (xorgHWAccess)
>          xf86EnableIO();
> -    xf86AccessEnter();
>      for (i = 0; i < xf86NumScreens; i++) {
>          xf86Screens[i]->vtSema = TRUE;
>          if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
> diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
> index e2b32a0..eebf182 100644
> --- a/hw/xfree86/common/xf86Helper.c
> +++ b/hw/xfree86/common/xf86Helper.c
> @@ -1764,7 +1764,6 @@ xf86ConfigFbEntityInactive(EntityInfoPtr pEnt, EntityProc init,
>  
>      if ((pScrn = xf86FindScreenForEntity(pEnt->index)))
>          xf86RemoveEntityFromScreen(pScrn, pEnt->index);
> -    xf86SetEntityFuncs(pEnt->index, init, enter, leave, private);
>  }
>  
>  ScrnInfoPtr
> @@ -1792,8 +1791,6 @@ xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
>          pScrn = xf86AllocateScreen(pEnt->driver, scrnFlag);
>      xf86AddEntityToScreen(pScrn, entityIndex);
>  
> -    xf86SetEntityFuncs(entityIndex, init, enter, leave, private);
> -
>      free(pEnt);
>      return pScrn;
>  }
> diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
> index 017dcb6..f1d03a6 100644
> --- a/hw/xfree86/common/xf86Init.c
> +++ b/hw/xfree86/common/xf86Init.c
> @@ -822,7 +822,6 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
>  #ifdef HAS_USL_VTS
>              ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ);
>  #endif
> -            xf86AccessEnter();
>              OsBlockSIGIO();
>              sigio_blocked = TRUE;
>          }
> @@ -1100,8 +1099,6 @@ AbortDDX(enum ExitCode error)
>              }
>      }
>  
> -    xf86AccessLeave();
> -
>      /*
>       * 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)
> diff --git a/hw/xfree86/common/xf86PM.c b/hw/xfree86/common/xf86PM.c
> index 9e49e8e..3cb227d 100644
> --- a/hw/xfree86/common/xf86PM.c
> +++ b/hw/xfree86/common/xf86PM.c
> @@ -116,8 +116,6 @@ suspend(pmEvent event, Bool undo)
>              xf86Screens[i]->vtSema = FALSE;
>          }
>      }
> -    xf86AccessLeave();
> -
>  }
>  
>  static void
> @@ -126,7 +124,6 @@ resume(pmEvent event, Bool undo)
>      int i;
>      InputInfoPtr pInfo;
>  
> -    xf86AccessEnter();
>      for (i = 0; i < xf86NumScreens; i++) {
>          if (xf86Screens[i]->PMEvent)
>              xf86Screens[i]->PMEvent(xf86Screens[i], event, undo);
> diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
> index 6e374eb..f50f471 100644
> --- a/hw/xfree86/common/xf86Priv.h
> +++ b/hw/xfree86/common/xf86Priv.h
> @@ -112,8 +112,6 @@ extern int xf86NumGPUScreens;
>  /* xf86Bus.c */
>  extern _X_EXPORT Bool xf86BusConfig(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 xf86ClearEntityListForScreen(ScrnInfoPtr pScrn);
>  extern _X_EXPORT void xf86AddDevToEntity(int entityIndex, GDevPtr dev);
> diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
> index e86ecb9..7c0b4f9 100644
> --- a/hw/xfree86/common/xf86pciBus.c
> +++ b/hw/xfree86/common/xf86pciBus.c
> @@ -1019,9 +1019,6 @@ xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets * p_chip,
>  
>      if ((pScrn = xf86FindScreenForEntity(pEnt->index)))
>          xf86RemoveEntityFromScreen(pScrn, pEnt->index);
> -
> -    /* shared resources are only needed when entity is active: remove */
> -    xf86SetEntityFuncs(pEnt->index, init, enter, leave, private);
>  }
>  
>  ScrnInfoPtr
> @@ -1056,8 +1053,6 @@ xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
>      }
>      free(pEnt);
>  
> -    xf86SetEntityFuncs(entityIndex, init, enter, leave, private);
> -
>      return pScrn;
>  }
>  
> diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml
> index 6a9de9e..bf11f79 100644
> --- a/hw/xfree86/doc/ddxDesign.xml
> +++ b/hw/xfree86/doc/ddxDesign.xml
> @@ -835,13 +835,8 @@ Here is what <function>InitOutput()</function> does:
>        the driver will fail immediately.  This is usually best done with
>        the <function>xf86ConfigPciEntity()</function> helper function
>        for PCI and <function>xf86ConfigIsaEntity()</function> for ISA
> -      (see the <link linkend="rac">RAC</link> section).  It is possible to
> -      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>
> +      (see the <link linkend="rac">RAC</link> section).
> +        </para>
>  
>  	<para>
>        If a chipset is specified in an active device section which the
> @@ -2756,19 +2751,6 @@ available at the driver level:
>  
>  	  <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>
> -	      <programlisting>
>      void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex);
>  	      </programlisting>
>  	      <blockquote><para>
> -- 
> 1.9.3
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list