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>
This commit is contained in:
Helmut Schaa
2011-04-18 15:27:43 +02:00
committed by John W. Linville
parent 7dab73b37f
commit 10e11568ca
3 changed files with 49 additions and 21 deletions

View File

@@ -580,16 +580,22 @@ struct data_queue_desc {
* @queue: Pointer to @data_queue
* @start: &enum queue_index Pointer to start index
* @end: &enum queue_index Pointer to end index
* @data: Data to pass to the callback function
* @fn: The function to call for each &struct queue_entry
*
* This will walk through all entries in the queue, in chronological
* order. This means it will start at the current @start pointer
* and will walk through the queue until it reaches the @end pointer.
*
* If fn returns true for an entry rt2x00queue_for_each_entry will stop
* processing and return true as well.
*/
void rt2x00queue_for_each_entry(struct data_queue *queue,
bool rt2x00queue_for_each_entry(struct data_queue *queue,
enum queue_index start,
enum queue_index end,
void (*fn)(struct queue_entry *entry));
void *data,
bool (*fn)(struct queue_entry *entry,
void *data));
/**
* rt2x00queue_empty - Check if the queue is empty.