summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2010-07-22 12:00:07 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2010-09-01 15:26:49 +1000
commitb55ac354afa0f16f71bb4f2d3d4277c887082520 (patch)
treeb01209aad0a601b323ef71480f9293aadd53c135
parentd2a5f4166417b9d4a02a219b28470e41b6cfe012 (diff)
xfree86: move xf86AllocateInput and xf86DeleteInput to xf86Xinput.c
Make xf86AllocateInput static in the process, this function is only called from one location. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
-rw-r--r--hw/xfree86/common/xf86Helper.c90
-rw-r--r--hw/xfree86/common/xf86Xinput.c89
-rw-r--r--hw/xfree86/common/xf86Xinput.h1
3 files changed, 89 insertions, 91 deletions
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 897aaf352..8eccb22b6 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -274,96 +274,6 @@ xf86AllocateScrnInfoPrivateIndex(void)
return idx;
}
-/* Allocate a new InputInfoRec and append it to the tail of xf86InputDevs. */
-InputInfoPtr
-xf86AllocateInput(InputDriverPtr drv, IDevPtr idev)
-{
- InputInfoPtr new, *prev = NULL;
-
- if (!(new = calloc(sizeof(InputInfoRec), 1)))
- return NULL;
-
- new->drv = drv;
- drv->refCount++;
- new->module = DuplicateModule(drv->module, NULL);
-
- for (prev = &xf86InputDevs; *prev; prev = &(*prev)->next)
- ;
-
- *prev = new;
- new->next = NULL;
-
- new->fd = -1;
- new->name = idev->identifier;
- new->type_name = "UNKNOWN";
- new->device_control = NULL;
- new->read_input = NULL;
- new->history_size = 0;
- new->control_proc = NULL;
- new->close_proc = NULL;
- new->switch_mode = NULL;
- new->conversion_proc = NULL;
- new->reverse_conversion_proc = NULL;
- new->dev = NULL;
- new->private_flags = 0;
- new->always_core_feedback = NULL;
- new->private = NULL;
- new->conf_idev = idev;
-
- xf86CollectInputOptions(new, (const char**)drv->default_options, NULL);
- xf86ProcessCommonOptions(new, new->options);
-
- return new;
-}
-
-
-/*
- * Remove an entry from xf86InputDevs. Ideally it should free all allocated
- * data. To do this properly may require a driver hook.
- */
-
-void
-xf86DeleteInput(InputInfoPtr pInp, int flags)
-{
- InputInfoPtr p;
-
- /* First check if the inputdev is valid. */
- if (pInp == NULL)
- return;
-
-#if 0
- /* If a free function is defined, call it here. */
- if (pInp->free)
- pInp->free(pInp, 0);
-#endif
-
- if (pInp->module)
- UnloadModule(pInp->module);
-
- if (pInp->drv)
- pInp->drv->refCount--;
-
- /* 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 */
- free(pInp->private);
-
- FreeInputAttributes(pInp->attrs);
-
- /* Remove the entry from the list. */
- if (pInp == xf86InputDevs)
- xf86InputDevs = pInp->next;
- else {
- p = xf86InputDevs;
- while (p && p->next != pInp)
- p = p->next;
- if (p)
- p->next = pInp->next;
- /* Else the entry wasn't in the xf86InputDevs list (ignore this). */
- }
- free(pInp);
-}
-
Bool
xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad)
{
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 4513b99b0..90f0b5d8a 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -705,6 +705,95 @@ IgnoreInputClass(const IDevPtr idev, const InputAttributes *attrs)
return ignore;
}
+/* Allocate a new InputInfoRec and append it to the tail of xf86InputDevs. */
+static InputInfoPtr
+xf86AllocateInput(InputDriverPtr drv, IDevPtr idev)
+{
+ InputInfoPtr new, *prev = NULL;
+
+ if (!(new = calloc(sizeof(InputInfoRec), 1)))
+ return NULL;
+
+ new->drv = drv;
+ drv->refCount++;
+ new->module = DuplicateModule(drv->module, NULL);
+
+ for (prev = &xf86InputDevs; *prev; prev = &(*prev)->next)
+ ;
+
+ *prev = new;
+ new->next = NULL;
+
+ new->fd = -1;
+ new->name = idev->identifier;
+ new->type_name = "UNKNOWN";
+ new->device_control = NULL;
+ new->read_input = NULL;
+ new->history_size = 0;
+ new->control_proc = NULL;
+ new->close_proc = NULL;
+ new->switch_mode = NULL;
+ new->conversion_proc = NULL;
+ new->reverse_conversion_proc = NULL;
+ new->dev = NULL;
+ new->private_flags = 0;
+ new->always_core_feedback = NULL;
+ new->private = NULL;
+ new->conf_idev = idev;
+
+ xf86CollectInputOptions(new, (const char**)drv->default_options, NULL);
+ xf86ProcessCommonOptions(new, new->options);
+
+ return new;
+}
+
+/*
+ * Remove an entry from xf86InputDevs. Ideally it should free all allocated
+ * data. To do this properly may require a driver hook.
+ */
+
+void
+xf86DeleteInput(InputInfoPtr pInp, int flags)
+{
+ InputInfoPtr p;
+
+ /* First check if the inputdev is valid. */
+ if (pInp == NULL)
+ return;
+
+#if 0
+ /* If a free function is defined, call it here. */
+ if (pInp->free)
+ pInp->free(pInp, 0);
+#endif
+
+ if (pInp->module)
+ UnloadModule(pInp->module);
+
+ if (pInp->drv)
+ pInp->drv->refCount--;
+
+ /* 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 */
+ free(pInp->private);
+
+ FreeInputAttributes(pInp->attrs);
+
+ /* Remove the entry from the list. */
+ if (pInp == xf86InputDevs)
+ xf86InputDevs = pInp->next;
+ else {
+ p = xf86InputDevs;
+ while (p && p->next != pInp)
+ p = p->next;
+ if (p)
+ p->next = pInp->next;
+ /* Else the entry wasn't in the xf86InputDevs list (ignore this). */
+ }
+ free(pInp);
+}
+
/**
* Create a new input device, activate and enable it.
*
diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
index 8ca912ecb..4851f8b85 100644
--- a/hw/xfree86/common/xf86Xinput.h
+++ b/hw/xfree86/common/xf86Xinput.h
@@ -188,7 +188,6 @@ int xf86NewInputDevice(IDevPtr idev, DeviceIntPtr *pdev, BOOL is_auto);
/* xf86Helper.c */
extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
extern _X_EXPORT void xf86DeleteInputDriver(int drvIndex);
-extern _X_INTERNAL InputInfoPtr xf86AllocateInput(InputDriverPtr drv, IDevPtr idev);
extern _X_EXPORT InputDriverPtr xf86LookupInputDriver(const char *name);
extern _X_EXPORT InputInfoPtr xf86LookupInput(const char *name);
extern _X_EXPORT void xf86DeleteInput(InputInfoPtr pInp, int flags);