/* Remove all events that have been submitted for a given object, be it a gameport port or a driver.  */
static void gameport_remove_pending_events(void *object)
/* Remove all events that have been submitted for a given object, be it a gameport port or a driver.  */
static void gameport_remove_pending_events(void *object)
{
	struct list_head *node, *next;
	struct gameport_event *event;
	unsigned long flags;
	spin_lock_irqsave(&gameport_event_lock, flags);
	list_for_each_safe(node, next, &gameport_event_list) {
		event = list_entry(node, struct gameport_event, node);
		if (event->object == object) {
			list_del_init(node);
			gameport_free_event(event);
		}
	}
	spin_unlock_irqrestore(&gameport_event_lock, flags);
}