[PATCH 6/7] xfree86: unload unused input drivers
Michal Suchanek
hramrach at gmail.com
Mon Jul 23 08:14:33 PDT 2012
Signed-off-by: Michal Suchanek <hramrach at gmail.com>
---
hw/xfree86/common/xf86Helper.c | 7 +++++++
hw/xfree86/common/xf86Xinput.c | 4 ++++
2 files changed, 11 insertions(+)
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 187cf1f..350b089 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -130,6 +130,13 @@ xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags)
void
xf86DeleteInputDriver(InputDriverPtr driver)
{
+ /* Maybe should check that the driver is non-null and in the list. */
+
+ /* The loader does not return error from UnloadModule so check that the
+ * driver can be unloaded. */
+ if (driver->module && !CanUnloadModule(driver->module))
+ return; /* cannot unload (yet) */
+
UnloadModule(driver->module);
xorg_list_del(&driver->entry);
free(driver);
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 7b368fe..8b29198 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -752,6 +752,10 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
if (pInp->module)
UnloadModule(pInp->module);
+ /* Attempt to unload the driver */
+ if (pInp->drv)
+ xf86DeleteInputDriver(pInp->drv);
+
/* This should *really* be handled in drv->UnInit(dev) call instead, but
* if the driver forgets about it make sure we free it or at least crash
* with flying colors */
--
1.7.10.4
More information about the xorg-devel
mailing list