[1/2] evdev: Add a remove callback to the evdev_dispatch_interface

Submitted by Hans de Goede on Dec. 5, 2014, 11:59 a.m.

Details

Message ID 1417780762-21335-1-git-send-email-hdegoede@redhat.com
State Not Applicable
Headers show

Not browsing as part of any series.

Commit Message

Hans de Goede Dec. 5, 2014, 11:59 a.m.
Some dispatchers may want to do some cleanup at remove time, rather then at
destroy time.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 src/evdev-mt-touchpad.c | 1 +
 src/evdev.c             | 1 +
 src/evdev.h             | 3 +++
 3 files changed, 5 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index ad6b377..5af0062 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -863,6 +863,7 @@  tp_tag_device(struct evdev_device *device,
 
 static struct evdev_dispatch_interface tp_interface = {
 	tp_process,
+	NULL, /* remove */
 	tp_destroy,
 	tp_device_added,
 	tp_device_removed,
diff --git a/src/evdev.c b/src/evdev.c
index fbfbcd3..0e47d1d 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -737,6 +737,7 @@  evdev_calibration_get_default_matrix(struct libinput_device *libinput_device,
 
 struct evdev_dispatch_interface fallback_interface = {
 	fallback_process,
+	NULL, /* remove */
 	fallback_destroy,
 	NULL, /* device_added */
 	NULL, /* device_removed */
diff --git a/src/evdev.h b/src/evdev.h
index 033d455..820fdcc 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -166,6 +166,9 @@  struct evdev_dispatch_interface {
 			struct input_event *event,
 			uint64_t time);
 
+	/* Device is being removed (may be NULL) */
+	void (*remove)(struct evdev_dispatch *dispatch);
+
 	/* Destroy an event dispatch handler and free all its resources. */
 	void (*destroy)(struct evdev_dispatch *dispatch);
 

Comments

Hi,

On 12/05/2014 12:59 PM, Hans de Goede wrote:
> Some dispatchers may want to do some cleanup at remove time, rather then at
> destroy time.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Self-nak, this patch misses the bits actually calling the remove callback.

Regards,

Hans

> ---
>   src/evdev-mt-touchpad.c | 1 +
>   src/evdev.c             | 1 +
>   src/evdev.h             | 3 +++
>   3 files changed, 5 insertions(+)
>
> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
> index ad6b377..5af0062 100644
> --- a/src/evdev-mt-touchpad.c
> +++ b/src/evdev-mt-touchpad.c
> @@ -863,6 +863,7 @@ tp_tag_device(struct evdev_device *device,
>
>   static struct evdev_dispatch_interface tp_interface = {
>   	tp_process,
> +	NULL, /* remove */
>   	tp_destroy,
>   	tp_device_added,
>   	tp_device_removed,
> diff --git a/src/evdev.c b/src/evdev.c
> index fbfbcd3..0e47d1d 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -737,6 +737,7 @@ evdev_calibration_get_default_matrix(struct libinput_device *libinput_device,
>
>   struct evdev_dispatch_interface fallback_interface = {
>   	fallback_process,
> +	NULL, /* remove */
>   	fallback_destroy,
>   	NULL, /* device_added */
>   	NULL, /* device_removed */
> diff --git a/src/evdev.h b/src/evdev.h
> index 033d455..820fdcc 100644
> --- a/src/evdev.h
> +++ b/src/evdev.h
> @@ -166,6 +166,9 @@ struct evdev_dispatch_interface {
>   			struct input_event *event,
>   			uint64_t time);
>
> +	/* Device is being removed (may be NULL) */
> +	void (*remove)(struct evdev_dispatch *dispatch);
> +
>   	/* Destroy an event dispatch handler and free all its resources. */
>   	void (*destroy)(struct evdev_dispatch *dispatch);
>
>