aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00usb.c
diff options
context:
space:
mode:
authorGertjan van Wingerde <gwingerde@gmail.com>2010-06-29 15:40:34 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-06-30 15:00:49 -0400
commitfe7256971fbaeac868c35c2dbd34a7bbbdc0622b (patch)
tree78b4b4c37c5b0578813810fc8a3c60162d9c67d6 /drivers/net/wireless/rt2x00/rt2x00usb.c
parent398ab9ea74f06eb98e4b28c2e9b43bf43e8730ab (diff)
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: Gertjan van Wingerde <gwingerde@gmail.com> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00usb.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 97597543c70b..1c91812df173 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -211,9 +211,6 @@ int rt2x00usb_write_tx_data(struct queue_entry *entry,
211 struct txentry_desc *txdesc) 211 struct txentry_desc *txdesc)
212{ 212{
213 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 213 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
214 struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
215 struct queue_entry_priv_usb *entry_priv = entry->priv_data;
216 u32 length;
217 214
218 /* 215 /*
219 * Add the descriptor in front of the skb. 216 * Add the descriptor in front of the skb.
@@ -222,18 +219,6 @@ int rt2x00usb_write_tx_data(struct queue_entry *entry,
222 memset(entry->skb->data, 0, entry->queue->desc_size); 219 memset(entry->skb->data, 0, entry->queue->desc_size);
223 220
224 /* 221 /*
225 * USB devices cannot blindly pass the skb->len as the
226 * length of the data to usb_fill_bulk_urb. Pass the skb
227 * to the driver to determine what the length should be.
228 */
229 length = rt2x00dev->ops->lib->get_tx_data_len(entry);
230
231 usb_fill_bulk_urb(entry_priv->urb, usb_dev,
232 usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint),
233 entry->skb->data, length,
234 rt2x00usb_interrupt_txdone, entry);
235
236 /*
237 * Call the driver's write_tx_datadesc function, if it exists. 222 * Call the driver's write_tx_datadesc function, if it exists.
238 */ 223 */
239 if (rt2x00dev->ops->lib->write_tx_datadesc) 224 if (rt2x00dev->ops->lib->write_tx_datadesc)
@@ -245,10 +230,26 @@ EXPORT_SYMBOL_GPL(rt2x00usb_write_tx_data);
245 230
246static inline void rt2x00usb_kick_tx_entry(struct queue_entry *entry) 231static inline void rt2x00usb_kick_tx_entry(struct queue_entry *entry)
247{ 232{
233 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
234 struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
248 struct queue_entry_priv_usb *entry_priv = entry->priv_data; 235 struct queue_entry_priv_usb *entry_priv = entry->priv_data;
236 u32 length;
237
238 if (test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags)) {
239 /*
240 * USB devices cannot blindly pass the skb->len as the
241 * length of the data to usb_fill_bulk_urb. Pass the skb
242 * to the driver to determine what the length should be.
243 */
244 length = rt2x00dev->ops->lib->get_tx_data_len(entry);
245
246 usb_fill_bulk_urb(entry_priv->urb, usb_dev,
247 usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint),
248 entry->skb->data, length,
249 rt2x00usb_interrupt_txdone, entry);
249 250
250 if (test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags))
251 usb_submit_urb(entry_priv->urb, GFP_ATOMIC); 251 usb_submit_urb(entry_priv->urb, GFP_ATOMIC);
252 }
252} 253}
253 254
254void rt2x00usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, 255void rt2x00usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev,