Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe725697 authored by Gertjan van Wingerde's avatar Gertjan van Wingerde Committed by John W. Linville
Browse files

rt2x00: Move filling of TX URB to rt2x00usb_kick_tx_entry function.



There is no need to fill the TX URB this early, and moving it to the
rt2x00usb_kick_tx_entry function allows us to merge the PCI and USB
variants of the write_tx_data function.

Signed-off-by: default avatarGertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 398ab9ea
Loading
Loading
Loading
Loading
+17 −16
Original line number Diff line number Diff line
@@ -211,9 +211,6 @@ int rt2x00usb_write_tx_data(struct queue_entry *entry,
			    struct txentry_desc *txdesc)
{
	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
	struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
	struct queue_entry_priv_usb *entry_priv = entry->priv_data;
	u32 length;

	/*
	 * Add the descriptor in front of the skb.
@@ -221,18 +218,6 @@ int rt2x00usb_write_tx_data(struct queue_entry *entry,
	skb_push(entry->skb, entry->queue->desc_size);
	memset(entry->skb->data, 0, entry->queue->desc_size);

	/*
	 * USB devices cannot blindly pass the skb->len as the
	 * length of the data to usb_fill_bulk_urb. Pass the skb
	 * to the driver to determine what the length should be.
	 */
	length = rt2x00dev->ops->lib->get_tx_data_len(entry);

	usb_fill_bulk_urb(entry_priv->urb, usb_dev,
			  usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint),
			  entry->skb->data, length,
			  rt2x00usb_interrupt_txdone, entry);

	/*
	 * Call the driver's write_tx_datadesc function, if it exists.
	 */
@@ -245,11 +230,27 @@ EXPORT_SYMBOL_GPL(rt2x00usb_write_tx_data);

static inline void rt2x00usb_kick_tx_entry(struct queue_entry *entry)
{
	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
	struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
	struct queue_entry_priv_usb *entry_priv = entry->priv_data;
	u32 length;

	if (test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags)) {
		/*
		 * USB devices cannot blindly pass the skb->len as the
		 * length of the data to usb_fill_bulk_urb. Pass the skb
		 * to the driver to determine what the length should be.
		 */
		length = rt2x00dev->ops->lib->get_tx_data_len(entry);

		usb_fill_bulk_urb(entry_priv->urb, usb_dev,
				  usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint),
				  entry->skb->data, length,
				  rt2x00usb_interrupt_txdone, entry);

	if (test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags))
		usb_submit_urb(entry_priv->urb, GFP_ATOMIC);
	}
}

void rt2x00usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
			     const enum data_queue_qid qid)