/* Remove all events that have been submitted for a given object, be it serio port or driver.  */
static void serio_remove_pending_events(void *object)
/* Remove all events that have been submitted for a given object, be it serio port or driver.  */
static void serio_remove_pending_events(void *object)
{
	struct list_head *node, *next;
	struct serio_event *event;
	unsigned long flags;
	spin_lock_irqsave(&serio_event_lock, flags);
	list_for_each_safe(node, next, &serio_event_list) {
		event = list_entry(node, struct serio_event, node);
		if (event->object == object) {
			list_del_init(node);
			serio_free_event(event);
		}
	}
	spin_unlock_irqrestore(&serio_event_lock, flags);
}