aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00usb.c
diff options
context:
space:
mode:
authorHelmut Schaa <helmut.schaa@googlemail.com>2011-04-18 09:27:43 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-19 15:39:13 -0400
commit10e11568ca8b8a15f7478f6a4ceebabcbdba1018 (patch)
tree9ace4fe0ad5280fc46705aebef9bfa06b7c346ef /drivers/net/wireless/rt2x00/rt2x00usb.c
parent7dab73b37f5e8885cb73efd25e73861f9b4f0246 (diff)
rt2x00: Make rt2x00_queue_entry_for_each more flexible
Allow passing a void pointer to rt2x00_queue_entry_for_each which in turn in provided to the callback function. Furthermore, allow the callback function to stop processing by returning true. And also notify the caller of rt2x00_queue_entry_for_each if the loop was canceled by the callback. No functional changes, just preparation for an upcoming patch. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Acked-by: Gertjan van Wingerde <gwingerde@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.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 94047e9b2ec6..0bc8dccd0f0a 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -230,7 +230,7 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
230 queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work); 230 queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
231} 231}
232 232
233static void rt2x00usb_kick_tx_entry(struct queue_entry *entry) 233static bool rt2x00usb_kick_tx_entry(struct queue_entry *entry, void* data)
234{ 234{
235 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 235 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
236 struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); 236 struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
@@ -240,7 +240,7 @@ static void rt2x00usb_kick_tx_entry(struct queue_entry *entry)
240 240
241 if (!test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags) || 241 if (!test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags) ||
242 test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) 242 test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))
243 return; 243 return true;
244 244
245 /* 245 /*
246 * USB devices cannot blindly pass the skb->len as the 246 * USB devices cannot blindly pass the skb->len as the
@@ -261,6 +261,8 @@ static void rt2x00usb_kick_tx_entry(struct queue_entry *entry)
261 set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); 261 set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
262 rt2x00lib_dmadone(entry); 262 rt2x00lib_dmadone(entry);
263 } 263 }
264
265 return false;
264} 266}
265 267
266/* 268/*
@@ -323,7 +325,7 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
323 queue_work(rt2x00dev->workqueue, &rt2x00dev->rxdone_work); 325 queue_work(rt2x00dev->workqueue, &rt2x00dev->rxdone_work);
324} 326}
325 327
326static void rt2x00usb_kick_rx_entry(struct queue_entry *entry) 328static bool rt2x00usb_kick_rx_entry(struct queue_entry *entry, void* data)
327{ 329{
328 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 330 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
329 struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); 331 struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
@@ -332,7 +334,7 @@ static void rt2x00usb_kick_rx_entry(struct queue_entry *entry)
332 334
333 if (test_and_set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) || 335 if (test_and_set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags) ||
334 test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags)) 336 test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))
335 return; 337 return true;
336 338
337 rt2x00lib_dmastart(entry); 339 rt2x00lib_dmastart(entry);
338 340
@@ -348,6 +350,8 @@ static void rt2x00usb_kick_rx_entry(struct queue_entry *entry)
348 set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); 350 set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
349 rt2x00lib_dmadone(entry); 351 rt2x00lib_dmadone(entry);
350 } 352 }
353
354 return false;
351} 355}
352 356
353void rt2x00usb_kick_queue(struct data_queue *queue) 357void rt2x00usb_kick_queue(struct data_queue *queue)
@@ -358,12 +362,18 @@ void rt2x00usb_kick_queue(struct data_queue *queue)
358 case QID_AC_BE: 362 case QID_AC_BE:
359 case QID_AC_BK: 363 case QID_AC_BK:
360 if (!rt2x00queue_empty(queue)) 364 if (!rt2x00queue_empty(queue))
361 rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, 365 rt2x00queue_for_each_entry(queue,
366 Q_INDEX_DONE,
367 Q_INDEX,
368 NULL,
362 rt2x00usb_kick_tx_entry); 369 rt2x00usb_kick_tx_entry);
363 break; 370 break;
364 case QID_RX: 371 case QID_RX:
365 if (!rt2x00queue_full(queue)) 372 if (!rt2x00queue_full(queue))
366 rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, 373 rt2x00queue_for_each_entry(queue,
374 Q_INDEX_DONE,
375 Q_INDEX,
376 NULL,
367 rt2x00usb_kick_rx_entry); 377 rt2x00usb_kick_rx_entry);
368 break; 378 break;
369 default: 379 default:
@@ -372,14 +382,14 @@ void rt2x00usb_kick_queue(struct data_queue *queue)
372} 382}
373EXPORT_SYMBOL_GPL(rt2x00usb_kick_queue); 383EXPORT_SYMBOL_GPL(rt2x00usb_kick_queue);
374 384
375static void rt2x00usb_flush_entry(struct queue_entry *entry) 385static bool rt2x00usb_flush_entry(struct queue_entry *entry, void* data)
376{ 386{
377 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 387 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
378 struct queue_entry_priv_usb *entry_priv = entry->priv_data; 388 struct queue_entry_priv_usb *entry_priv = entry->priv_data;
379 struct queue_entry_priv_usb_bcn *bcn_priv = entry->priv_data; 389 struct queue_entry_priv_usb_bcn *bcn_priv = entry->priv_data;
380 390
381 if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags)) 391 if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags))
382 return; 392 return true;
383 393
384 usb_kill_urb(entry_priv->urb); 394 usb_kill_urb(entry_priv->urb);
385 395
@@ -389,6 +399,8 @@ static void rt2x00usb_flush_entry(struct queue_entry *entry)
389 if ((entry->queue->qid == QID_BEACON) && 399 if ((entry->queue->qid == QID_BEACON) &&
390 (test_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags))) 400 (test_bit(REQUIRE_BEACON_GUARD, &rt2x00dev->cap_flags)))
391 usb_kill_urb(bcn_priv->guardian_urb); 401 usb_kill_urb(bcn_priv->guardian_urb);
402
403 return false;
392} 404}
393 405
394void rt2x00usb_flush_queue(struct data_queue *queue) 406void rt2x00usb_flush_queue(struct data_queue *queue)
@@ -396,7 +408,7 @@ void rt2x00usb_flush_queue(struct data_queue *queue)
396 struct work_struct *completion; 408 struct work_struct *completion;
397 unsigned int i; 409 unsigned int i;
398 410
399 rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, 411 rt2x00queue_for_each_entry(queue, Q_INDEX_DONE, Q_INDEX, NULL,
400 rt2x00usb_flush_entry); 412 rt2x00usb_flush_entry);
401 413
402 /* 414 /*
@@ -489,7 +501,7 @@ void rt2x00usb_clear_entry(struct queue_entry *entry)
489 entry->flags = 0; 501 entry->flags = 0;
490 502
491 if (entry->queue->qid == QID_RX) 503 if (entry->queue->qid == QID_RX)
492 rt2x00usb_kick_rx_entry(entry); 504 rt2x00usb_kick_rx_entry(entry, NULL);
493} 505}
494EXPORT_SYMBOL_GPL(rt2x00usb_clear_entry); 506EXPORT_SYMBOL_GPL(rt2x00usb_clear_entry);
495 507