/* Implements the set_socket() operation for the in-kernel PCMCIA service (formerly SS_SetSocket in Card Services). We more or less punt all of this work and let the kernel handle the details of power configuration, reset, &c. We also record the value of  */
static int bcm63xx_pcmcia_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
/* Implements the set_socket() operation for the in-kernel PCMCIA service (formerly SS_SetSocket in Card Services). We more or less punt all of this work and let the kernel handle the details of power configuration, reset, &c. We also record the value of  */
static int bcm63xx_pcmcia_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
{
	struct bcm63xx_pcmcia_socket *skt;
	unsigned long flags;
	u32 val;
	skt = sock->driver_data;
	spin_lock_irqsave(&skt->lock, flags);
	val = pcmcia_readl(skt, PCMCIA_C1_REG);
	if (state->flags & SS_RESET)
		val |= PCMCIA_C1_RESET_MASK;
	else
		val &= ~PCMCIA_C1_RESET_MASK;
	if (skt->card_detected && (skt->card_type & CARD_CARDBUS))
		val ^= PCMCIA_C1_RESET_MASK;
	pcmcia_writel(skt, val, PCMCIA_C1_REG);
	skt->requested_state = *state;
	spin_unlock_irqrestore(&skt->lock, flags);
	return 0;
}