/* Called from Libertas to transfer some data to the WLAN device We can't sleep here.  */
static int if_spi_host_to_card(struct lbs_private *priv, u8 type, u8 *buf, u16 nb)
/* Called from Libertas to transfer some data to the WLAN device We can't sleep here.  */
static int if_spi_host_to_card(struct lbs_private *priv, u8 type, u8 *buf, u16 nb)
{
	int err = 0;
	struct if_spi_card *card = priv->card;
	lbs_deb_enter_args(LBS_DEB_SPI, "type %d, bytes %d", type, nb);
	nb = ALIGN(nb, 4);
	switch (type) {
	case MVMS_CMD:
		err = spu_write(card, IF_SPI_CMD_RDWRPORT_REG, buf, nb);
		break;
	case MVMS_DAT:
		err = spu_write(card, IF_SPI_DATA_RDWRPORT_REG, buf, nb);
		break;
	default:
		lbs_pr_err("can't transfer buffer of type %d", type);
		err = -EINVAL;
		break;
	}
	lbs_deb_leave_args(LBS_DEB_SPI, "err=%d", err);
	return err;
}