max3421_transfer_out(struct usb_hcd *hcd, struct urb *urb, int fast_retransmit)
{
	struct spi_device *spi = to_spi_device(hcd->self.controller);
	struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
	int epnum = usb_pipeendpoint(urb->pipe);
	u32 max_packet;
	void *src;

	src = urb->transfer_buffer + urb->actual_length;

	if (fast_retransmit) {
		if (max3421_hcd->rev == 0x12) {
			/* work around rev 0x12 bug: */
			spi_wr8(hcd, MAX3421_REG_SNDBC, 0);
			spi_wr8(hcd, MAX3421_REG_SNDFIFO, ((u8 *) src)[0]);
			spi_wr8(hcd, MAX3421_REG_SNDBC, max3421_hcd->curr_len);
		}
		return MAX3421_HXFR_BULK_OUT(epnum);
	}

	max_packet = usb_maxpacket(urb->dev, urb->pipe, 1);

	if (max_packet > MAX3421_FIFO_SIZE) {
		/*
		 * We do not support isochronous transfers at this
		 * time.
		 */
		dev_err(&spi->dev,
			"%s: packet-size of %u too big (limit is %u bytes)",
			__func__, max_packet, MAX3421_FIFO_SIZE);
		max3421_hcd->urb_done = -EMSGSIZE;
		return -EMSGSIZE;
	}
	max3421_hcd->curr_len = min((urb->transfer_buffer_length -
				     urb->actual_length), max_packet);

	spi_wr_buf(hcd, MAX3421_REG_SNDFIFO, src, max3421_hcd->curr_len);
	spi_wr8(hcd, MAX3421_REG_SNDBC, max3421_hcd->curr_len);
	return MAX3421_HXFR_BULK_OUT(epnum);
}
max3421_transfer_out(struct usb_hcd *hcd, struct urb *urb, int fast_retransmit)
{
	struct spi_device *spi = to_spi_device(hcd->self.controller);
	struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
	int epnum = usb_pipeendpoint(urb->pipe);
	u32 max_packet;
	void *src;

	src = urb->transfer_buffer + urb->actual_length;

	if (fast_retransmit) {
		if (max3421_hcd->rev == 0x12) {
			 
			spi_wr8(hcd, MAX3421_REG_SNDBC, 0);
			spi_wr8(hcd, MAX3421_REG_SNDFIFO, ((u8 *) src)[0]);
			spi_wr8(hcd, MAX3421_REG_SNDBC, max3421_hcd->curr_len);
		}
		return MAX3421_HXFR_BULK_OUT(epnum);
	}

	max_packet = usb_maxpacket(urb->dev, urb->pipe, 1);

	if (max_packet > MAX3421_FIFO_SIZE) {
		 
		dev_err(&spi->dev,
			"%s: packet-size of %u too big (limit is %u bytes)",
			__func__, max_packet, MAX3421_FIFO_SIZE);
		max3421_hcd->urb_done = -EMSGSIZE;
		return -EMSGSIZE;
	}
	max3421_hcd->curr_len = min((urb->transfer_buffer_length -
				     urb->actual_length), max_packet);

	spi_wr_buf(hcd, MAX3421_REG_SNDFIFO, src, max3421_hcd->curr_len);
	spi_wr8(hcd, MAX3421_REG_SNDBC, max3421_hcd->curr_len);
	return MAX3421_HXFR_BULK_OUT(epnum);
}