/* The intended use of this function (transfer of data items several bytes in size) allows us to just copy the value between request structure and user supplied buffer.  */
void memstick_init_req(struct memstick_request *mrq, unsigned char tpc, const void *buf, size_t length)
/* The intended use of this function (transfer of data items several bytes in size) allows us to just copy the value between request structure and user supplied buffer.  */
void memstick_init_req(struct memstick_request *mrq, unsigned char tpc, const void *buf, size_t length)
{
	mrq->tpc = tpc;
	if (tpc & 8)
		mrq->data_dir = WRITE;
	else
		mrq->data_dir = READ;
	mrq->data_len = length > sizeof(mrq->data) ? sizeof(mrq->data) : length;
	if (mrq->data_dir == WRITE)
		memcpy(mrq->data, buf, mrq->data_len);
	mrq->long_data = 0;
	if (tpc == MS_TPC_SET_CMD || tpc == MS_TPC_EX_SET_CMD)
		mrq->need_card_int = 1;
	else
		mrq->need_card_int = 0;
}