[PATCH] dix: move config_init into the DDX.

Peter Hutterer peter.hutterer at who-t.net
Thu Feb 4 17:27:35 PST 2010


The only DDX currently using hotplugging is the xfree86 one and it looks
like it'll stay that way for a bit. Move the initialization to the DDX,
since Xephyr, Xnest, and friends don't need HAL or udev notifications.

There's no counterpart to InitInput, so config_fini() still resides in the
dix. Doesn't matter much, make config_fini a noop if it wasn't initialized.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 config/config.c              |    6 ++++++
 dix/main.c                   |    1 -
 hw/xfree86/common/xf86Init.c |    4 ++++
 3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/config/config.c b/config/config.c
index 7bf5e41..0f744ad 100644
--- a/config/config.c
+++ b/config/config.c
@@ -32,9 +32,11 @@
 #include "hotplug.h"
 #include "config-backends.h"
 
+static int config_initialized = 0;
 void
 config_init(void)
 {
+    config_initialized = 1;
 #ifdef CONFIG_UDEV
     if (!config_udev_init())
         ErrorF("[config] failed to initialise udev\n");
@@ -58,6 +60,10 @@ config_init(void)
 void
 config_fini(void)
 {
+    if (!config_initialized)
+        return;
+    config_initialized = 0;
+
 #if defined(CONFIG_UDEV)
     config_udev_fini();
 #elif defined(CONFIG_NEED_DBUS)
diff --git a/dix/main.c b/dix/main.c
index da910fe..d7bc9d2 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -257,7 +257,6 @@ int main(int argc, char *argv[], char *envp[])
         InitCoreDevices();
 	InitInput(argc, argv);
 	InitAndStartDevices();
-	config_init();
 
 	dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
 
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 6707448..4ad7053 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -90,6 +90,8 @@
 #include "Pci.h"
 #include "xf86Bus.h"
 
+#include <hotplug.h>
+
 /* forward declarations */
 static Bool probe_devices_from_device_sections(DriverPtr drvp);
 static Bool add_matching_devices_to_configure_list(DriverPtr drvp);
@@ -1138,6 +1140,8 @@ InitInput(int argc, char **argv)
         if (xf86NewInputDevice(*pDev, &dev, TRUE) == BadAlloc)
             break;
     }
+
+    config_init();
 }
 
 /*
-- 
1.6.6



More information about the xorg-devel mailing list