/* Release_io() releases the I/O ranges allocated by a client. This may be invoked some time after a card ejection has already dumped the actual socket configuration, so if the client is "stale", we don't bother checking the port ranges against the current socket values.  */
static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
/* Release_io() releases the I/O ranges allocated by a client. This may be invoked some time after a card ejection has already dumped the actual socket configuration, so if the client is "stale", we don't bother checking the port ranges against the current socket values.  */
static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
{
	struct pcmcia_socket *s = p_dev->socket;
	config_t *c = p_dev->function_config;
	if (!p_dev->_io)
		return -EINVAL;
	p_dev->_io = 0;
	if ((c->io.BasePort1 != req->BasePort1) ||
	    (c->io.NumPorts1 != req->NumPorts1) ||
	    (c->io.BasePort2 != req->BasePort2) ||
	    (c->io.NumPorts2 != req->NumPorts2))
		return -EINVAL;
	c->state &= ~CONFIG_IO_REQ;
	release_io_space(s, req->BasePort1, req->NumPorts1);
	if (req->NumPorts2)
		release_io_space(s, req->BasePort2, req->NumPorts2);
	return 0;
}