/* Note that we rely on the fact that port can have only one child and therefore only one child registration request can be pending. Additionally, children are registered by driver's connect() handler so there can't be a grandchild pending registration together with a child.  */
static struct serio* serio_get_pending_child(struct serio *parent)
/* Note that we rely on the fact that port can have only one child and therefore only one child registration request can be pending. Additionally, children are registered by driver's connect() handler so there can't be a grandchild pending registration together with a child.  */
static struct serio* serio_get_pending_child(struct serio *parent)
{
	struct serio_event *event;
	struct serio *serio, *child = NULL;
	unsigned long flags;
	spin_lock_irqsave(&serio_event_lock, flags);
	list_for_each_entry(event, &serio_event_list, node) {
		if (event->type == SERIO_REGISTER_PORT) {
			serio = event->object;
			if (serio->parent == parent) {
				child = serio;
				break;
			}
		}
	}
	spin_unlock_irqrestore(&serio_event_lock, flags);
	return child;
}