[PATCH 2/2] xfree86: delete devices probe code (-probe and -probeonly options)

Tiago Vignatti tiago.vignatti at nokia.com
Fri Jul 24 05:38:33 PDT 2009


Inside a windowing system, it's not the place to probe for devices. Goodbye
-probe and -probeonly.

Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
 hw/xfree86/common/xf86.h                 |    1 -
 hw/xfree86/common/xf86Configure.c        |    2 +-
 hw/xfree86/common/xf86Globals.c          |    2 -
 hw/xfree86/common/xf86Helper.c           |   13 +---
 hw/xfree86/common/xf86Init.c             |  129 +-----------------------------
 hw/xfree86/common/xf86Priv.h             |    2 -
 hw/xfree86/common/xf86sbusBus.c          |    5 -
 hw/xfree86/doc/man/Xorg.man.pre          |    5 -
 hw/xfree86/os-support/solaris/sun_init.c |    2 +-
 9 files changed, 6 insertions(+), 155 deletions(-)

diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index d17ba28..9828e71 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -261,7 +261,6 @@ extern _X_EXPORT Bool xf86ServerIsExiting(void);
 extern _X_EXPORT Bool xf86ServerIsResetting(void);
 extern _X_EXPORT Bool xf86ServerIsInitialising(void);
 extern _X_EXPORT Bool xf86ServerIsOnlyDetecting(void);
-extern _X_EXPORT Bool xf86ServerIsOnlyProbing(void);
 extern _X_EXPORT Bool xf86CaughtSignal(void);
 extern _X_EXPORT Bool xf86GetVidModeAllowNonLocal(void);
 extern _X_EXPORT Bool xf86GetVidModeEnabled(void);
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 307e0c4..46572b0 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -99,7 +99,7 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
     struct pci_device * pVideo = NULL;
     Bool isPrimary = FALSE;
 
-    if (xf86DoProbe || !xf86DoConfigure || !xf86DoConfigurePass1)
+    if (!xf86DoConfigure || !xf86DoConfigurePass1)
 	return NULL;
 
     /* Check for duplicates */
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 140e380..df0470c 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -150,7 +150,6 @@ confDRIRec xf86ConfigDRI = {0, };
 XF86ConfigPtr xf86configptr = NULL;
 Bool xf86Resetting = FALSE;
 Bool xf86Initialising = FALSE;
-Bool xf86DoProbe = FALSE;
 Bool xf86DoConfigure = FALSE;
 Bool xf86DoShowOptions = FALSE;
 DriverPtr *xf86DriverList = NULL;
@@ -183,7 +182,6 @@ char *xf86LayoutName = NULL;
 char *xf86ScreenName = NULL;
 char *xf86PointerName = NULL;
 char *xf86KeyboardName = NULL;
-Bool xf86ProbeOnly = FALSE;
 int xf86Verbose = DEFAULT_VERBOSE;
 int xf86LogVerbose = DEFAULT_LOG_VERBOSE;
 int xf86FbBpp = -1;
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index eb9e46e..aa09372 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1452,8 +1452,6 @@ xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
     if (sectlist)
 	*sectlist = NULL;
 
-    if (xf86DoProbe) return 1;
-
     if (xf86DoConfigure && xf86DoConfigurePass1) return 1;
 
     /*
@@ -1599,7 +1597,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
      * Do this calculation and memory allocation once now to eliminate the
      * need for realloc calls inside the loop.
      */
-    if ( !xf86DoProbe && !(xf86DoConfigure && xf86DoConfigurePass1) ) {
+    if (!(xf86DoConfigure && xf86DoConfigurePass1)) {
 	unsigned max_entries = numDevs;
 
 	iter = pci_slot_match_iterator_create(NULL);
@@ -2102,14 +2100,7 @@ xf86ServerIsInitialising(void)
 Bool
 xf86ServerIsOnlyDetecting(void)
 {
-    return xf86DoProbe || xf86DoConfigure;
-}
-
-
-Bool
-xf86ServerIsOnlyProbing(void)
-{
-    return xf86ProbeOnly;
+    return xf86DoConfigure;
 }
 
 
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index be3bb7a..b51ec0f 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -92,7 +92,6 @@
 /* forward declarations */
 static Bool probe_devices_from_device_sections(DriverPtr drvp);
 static Bool add_matching_devices_to_configure_list(DriverPtr drvp);
-static Bool check_for_matching_devices(DriverPtr drvp);
 
 #ifdef XF86PM
 void (*xf86OSPMClose)(void) = NULL;
@@ -475,32 +474,6 @@ add_matching_devices_to_configure_list(DriverPtr drvp)
     return (numFound != 0);
 }
 
-
-Bool
-check_for_matching_devices(DriverPtr drvp)
-{
-    const struct pci_id_match * const devices = drvp->supported_devices;
-    int j;
-
-
-    for (j = 0; ! END_OF_MATCHES(devices[j]); j++) {
-	struct pci_device_iterator *iter;
-	struct pci_device *dev;
-
-	iter = pci_id_match_iterator_create(& devices[j]);
-	dev = pci_device_next(iter);
-	pci_iterator_destroy(iter);
-
-	if (dev != NULL) {
-	    return TRUE;
-	}
-    }
-
-
-    return FALSE;
-}
-
-
 /**
  * Call the driver's correct probe function.
  *
@@ -522,11 +495,7 @@ xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
     Bool     foundScreen = FALSE;
 
     if ( drv->PciProbe != NULL ) {
-	if ( xf86DoProbe ) {
-	    assert( detect_only );
-	    foundScreen = check_for_matching_devices( drv );
-	}
-	else if ( xf86DoConfigure && xf86DoConfigurePass1 ) {
+	if ( xf86DoConfigure && xf86DoConfigurePass1 ) {
 	    assert( detect_only );
 	    foundScreen = add_matching_devices_to_configure_list( drv );
 	}
@@ -546,76 +515,6 @@ xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
     return foundScreen;
 }
 
-static void
-DoProbe(void)
-{
-    int i;
-    Bool probeResult;
-    Bool ioEnableFailed = FALSE;
-    
-    /* Find the list of video driver modules. */
-    char **list = xf86DriverlistFromCompile();
-    char **l;
-
-    if (list) {
-	ErrorF("List of video driver modules:\n");
-	for (l = list; *l; l++)
-	    ErrorF("\t%s\n", *l);
-    } else {
-	ErrorF("No video driver modules found\n");
-    }
-
-    /* Load all the drivers that were found. */
-    xf86LoadModules(list, NULL);
-
-    /* Disable PCI devices */
-    xf86AccessInit();
-
-    /* Call all of the probe functions, reporting the results. */
-    for (i = 0; i < xf86NumDrivers; i++) {
-	DriverRec * const drv = xf86DriverList[i];
-
-	if (!xorgHWAccess) {
-	    xorgHWFlags flags;
-	    if (!drv->driverFunc
-		|| !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags )
-		|| NEED_IO_ENABLED(flags)) {
-		if (ioEnableFailed)
-		    continue;
-		if (!xf86EnableIO()) {
-		    ioEnableFailed = TRUE;
-		    continue;
-		}
-		xorgHWAccess = TRUE;
-	    }
-	}
-	    
-
-	xf86MsgVerb(X_INFO, 3, "Probing in driver %s\n",  drv->driverName);
-
-	probeResult = xf86CallDriverProbe( drv, TRUE );
-	if (!probeResult) {
-	    xf86ErrorF("Probe in driver `%s' returns FALSE\n",
-		drv->driverName);
-	} else {
-	    xf86ErrorF("Probe in driver `%s' returns TRUE\n",
-		drv->driverName);
-
-	    /* If we have a result, then call driver's Identify function */
-	    if (drv->Identify != NULL) {
-		const int verbose = xf86SetVerbosity(1);
-		(*drv->Identify)(0);
-		xf86SetVerbosity(verbose);
-	    }
-	}
-    }
-
-    OsCleanup(TRUE);
-    AbortDDX();
-    fflush(stderr);
-    exit(0);
-}
-
 /*
  * InitOutput --
  *	Initialize screenInfo for all actually accessible framebuffers.
@@ -658,7 +557,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
 	}
 
     /* Read and parse the config file */
-    if (!xf86DoProbe && !xf86DoConfigure && !xf86DoShowOptions) {
+    if (!xf86DoConfigure && !xf86DoShowOptions) {
       switch (xf86HandleConfigFile(FALSE)) {
       case CONFIG_OK:
 	break;
@@ -691,9 +590,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
     /* Do a general bus probe.  This will be a PCI probe for x86 platforms */
     xf86BusProbe();
 
-    if (xf86DoProbe)
-	DoProbe();
-
     if (xf86DoConfigure)
 	DoConfigure();
 
@@ -930,15 +826,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
       }
     }
 
-    /* XXX Should this be before or after loading dependent modules? */
-    if (xf86ProbeOnly)
-    {
-      OsCleanup(TRUE);
-      AbortDDX();
-      fflush(stderr);
-      exit(0);
-    }
-
     /* Remove (unload) drivers that are not required */
     for (i = 0; i < xf86NumDrivers; i++)
 	if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0)
@@ -954,7 +841,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
     /*
      * Collect all pixmap formats and check for conflicts at the display
      * level.  Should we die here?  Or just delete the offending screens?
-     * Also, should this be done for -probeonly?
      */
     screenpix24 = Pix24DontCare;
     for (i = 0; i < xf86NumScreens; i++) {
@@ -1472,11 +1358,6 @@ ddxProcessArgument(int argc, char **argv, int i)
     xf86ConfigFile = argv[i + 1];
     return 2;
   }
-  if (!strcmp(argv[i],"-probeonly"))
-  {
-    xf86ProbeOnly = TRUE;
-    return 1;
-  }
   if (!strcmp(argv[i],"-flipPixels"))
   {
     xf86FlipPixels = TRUE;
@@ -1692,11 +1573,6 @@ ddxProcessArgument(int argc, char **argv, int i)
     return 1;
   }
 #endif
-  if (!strcmp(argv[i], "-probe"))
-  {
-    xf86DoProbe = TRUE;
-    return 1;
-  }
   if (!strcmp(argv[i], "-configure"))
   {
     if (getuid() != 0 && geteuid() == 0) {
@@ -1765,7 +1641,6 @@ ddxUseMsg(void)
   }
   ErrorF("-config file           specify a configuration file, relative to the\n");
   ErrorF("                       "__XCONFIGFILE__" search path, only root can use absolute\n");
-  ErrorF("-probeonly             probe for devices, then exit\n");
   ErrorF("-verbose [n]           verbose startup messages\n");
   ErrorF("-logverbose [n]        verbose log messages\n");
   ErrorF("-quiet                 minimal startup messages\n");
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index f4ed8c0..333ba8c 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -92,8 +92,6 @@ extern _X_EXPORT  xf86CurrentAccessRec xf86CurrentAccess;
 extern _X_EXPORT  const char *xf86VisualNames[];
 extern _X_EXPORT  int xf86Verbose;                 /* verbosity level */
 extern _X_EXPORT  int xf86LogVerbose;		/* log file verbosity level */
-extern _X_EXPORT  Bool xf86ProbeOnly;
-extern _X_EXPORT  Bool xf86DoProbe;
 extern _X_EXPORT  Bool xorgHWAccess;
 
 extern _X_EXPORT  RootWinPropPtr *xf86RegisteredPropertiesTable;
diff --git a/hw/xfree86/common/xf86sbusBus.c b/hw/xfree86/common/xf86sbusBus.c
index 4936e75..783d93b 100644
--- a/hw/xfree86/common/xf86sbusBus.c
+++ b/hw/xfree86/common/xf86sbusBus.c
@@ -406,11 +406,6 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId,
 	return 0;
     }
 
-    if (xf86DoProbe) {
-	xfree(instances);
-	return numFound;
-    }
-
     if (sparcPromInit() >= 0)
 	useProm = 1;
 
diff --git a/hw/xfree86/doc/man/Xorg.man.pre b/hw/xfree86/doc/man/Xorg.man.pre
index ce61fdd..ac48979 100644
--- a/hw/xfree86/doc/man/Xorg.man.pre
+++ b/hw/xfree86/doc/man/Xorg.man.pre
@@ -352,11 +352,6 @@ section and this option, the first relevant
 .B InputDevice
 section is used for the core pointer.
 .TP 8
-.B \-probeonly
-Causes the server to exit after the device probing stage.  The
-__xconfigfile__(__filemansuffix__) file is still used when this option is
-given, so information that can be auto-detected should be commented out.
-.TP 8
 .B \-quiet
 Suppress most informational messages at startup.  The verbosity level
 is set to zero.
diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c
index 795b0c1..2889f19 100644
--- a/hw/xfree86/os-support/solaris/sun_init.c
+++ b/hw/xfree86/os-support/solaris/sun_init.c
@@ -218,7 +218,7 @@ xf86CloseConsole(void)
 
 #if !defined(__i386__) && !defined(__i386) && !defined(__x86)
 
-    if (!xf86DoProbe && !xf86DoConfigure) {
+    if (!xf86DoConfigure) {
 	int fd;
 
 	/*
-- 
1.5.6.3



More information about the xorg-devel mailing list