xfree86: swap the list of paused devices to an xorg_list

No functional changes but it makes it easier to remove elements from the
middle of the list (future patch).

We don't have an init call into this file, so the list is manually
initialized.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Peter Hutterer 2016-10-20 15:45:46 +10:00
parent 28d8855cd4
commit 8fcf2fa78f

View File

@ -110,8 +110,16 @@
static int static int
xf86InputDevicePostInit(DeviceIntPtr dev); xf86InputDevicePostInit(DeviceIntPtr dev);
static InputInfoPtr *new_input_devices; typedef struct {
static int new_input_devices_count; struct xorg_list node;
InputInfoPtr pInfo;
} PausedInputDeviceRec;
typedef PausedInputDeviceRec *PausedInputDevicePtr;
static struct xorg_list new_input_devices_list = {
.next = &new_input_devices_list,
.prev = &new_input_devices_list,
};
/** /**
* Eval config and modify DeviceVelocityRec accordingly * Eval config and modify DeviceVelocityRec accordingly
@ -907,11 +915,10 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
if (fd != -1) { if (fd != -1) {
if (paused) { if (paused) {
/* Put on new_input_devices list for delayed probe */ /* Put on new_input_devices list for delayed probe */
new_input_devices = xnfreallocarray(new_input_devices, PausedInputDevicePtr new_device = xnfalloc(sizeof *new_device);
new_input_devices_count + 1, new_device->pInfo = pInfo;
sizeof(pInfo));
new_input_devices[new_input_devices_count] = pInfo; xorg_list_append(&new_device->node, &new_input_devices_list);
new_input_devices_count++;
systemd_logind_release_fd(pInfo->major, pInfo->minor, fd); systemd_logind_release_fd(pInfo->major, pInfo->minor, fd);
free(path); free(path);
return BadMatch; return BadMatch;
@ -1540,11 +1547,12 @@ xf86PostTouchEvent(DeviceIntPtr dev, uint32_t touchid, uint16_t type,
void void
xf86InputEnableVTProbe(void) xf86InputEnableVTProbe(void)
{ {
int i, is_auto = 0; int is_auto = 0;
DeviceIntPtr pdev; DeviceIntPtr pdev;
PausedInputDevicePtr d, tmp;
for (i = 0; i < new_input_devices_count; i++) { xorg_list_for_each_entry_safe(d, tmp, &new_input_devices_list, node) {
InputInfoPtr pInfo = new_input_devices[i]; InputInfoPtr pInfo = d->pInfo;
const char *value = xf86findOptionValue(pInfo->options, "_source"); const char *value = xf86findOptionValue(pInfo->options, "_source");
is_auto = 0; is_auto = 0;
@ -1557,8 +1565,9 @@ xf86InputEnableVTProbe(void)
xf86NewInputDevice(pInfo, &pdev, xf86NewInputDevice(pInfo, &pdev,
(!is_auto || (!is_auto ||
(is_auto && xf86Info.autoEnableDevices))); (is_auto && xf86Info.autoEnableDevices)));
xorg_list_del(&d->node);
free(d);
} }
new_input_devices_count = 0;
} }
/* end of xf86Xinput.c */ /* end of xf86Xinput.c */