From 11ee0ae9390a608a232ff94abcc0cbcf9ed7b70a Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 14 Jul 2008 10:20:11 +0930 Subject: [PATCH] xfree86: append, not prepent, new input devices to xf86InputDevs. If devices are prepended to the list, their wake-up order on resume is not the same as the original initialisation order. Hot-plugged devices, originally inited last, are re-enabled before the xorg.conf devices and in some cases may steal the device files. Result: we have different devices before and after suspend/resume. RedHat Bug 439386 --- hw/xfree86/common/xf86Helper.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index d58ce9326..41181b066 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -308,12 +308,11 @@ xf86AllocateScrnInfoPrivateIndex(void) return idx; } -/* Allocate a new InputInfoRec and add it to the head xf86InputDevs. */ - +/* Allocate a new InputInfoRec and append it to the tail of xf86InputDevs. */ _X_EXPORT InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags) { - InputInfoPtr new; + InputInfoPtr new, *prev = NULL; if (!(new = xcalloc(sizeof(InputInfoRec), 1))) return NULL; @@ -321,8 +320,13 @@ xf86AllocateInput(InputDriverPtr drv, int flags) new->drv = drv; drv->refCount++; new->module = DuplicateModule(drv->module, NULL); - new->next = xf86InputDevs; - xf86InputDevs = new; + + for (prev = &xf86InputDevs; *prev; prev = &(*prev)->next) + ; + + *prev = new; + new->next = NULL; + return new; }