/* gameport_disconnect_port() unbinds a port from its driver. As a side effect all child ports are unbound and destroyed.  */
static void gameport_disconnect_port(struct gameport *gameport)
/* gameport_disconnect_port() unbinds a port from its driver. As a side effect all child ports are unbound and destroyed.  */
static void gameport_disconnect_port(struct gameport *gameport)
{
	struct gameport *s, *parent;
	if (gameport->child) {
		for (s = gameport; s->child; s = s->child);
		do {
			parent = s->parent;
			device_release_driver(&s->dev);
			gameport_destroy_port(s);
		} while ((s = parent) != gameport);
	}
	device_release_driver(&gameport->dev);
}