1
0
Fork 0

staging: dgap: Simplify dgap_find_config

Simplify ugly dgap_find_config function

Signed-off-by: Mark Hounschell <markh@compro.net>
Tested-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
wifi-calibration
Mark Hounschell 2014-05-28 16:17:55 -04:00 committed by Greg Kroah-Hartman
parent 9a133a9039
commit 0be048cbc6
1 changed files with 40 additions and 38 deletions

View File

@ -7354,51 +7354,53 @@ static struct cnode *dgap_find_config(int type, int bus, int slot)
prev = p; prev = p;
p = p->next; p = p->next;
if (p->type == BNODE) { if (p->type != BNODE)
continue;
if (p->u.board.type == type) { if (p->u.board.type != type)
continue;
if (p->u.board.v_pcibus && if (p->u.board.v_pcibus &&
p->u.board.pcibus != bus) p->u.board.pcibus != bus)
continue; continue;
if (p->u.board.v_pcislot &&
p->u.board.pcislot != slot)
continue;
found = p; if (p->u.board.v_pcislot &&
/* p->u.board.pcislot != slot)
* Keep walking thru the list till we continue;
* find the next board.
*/
while (p->next) {
prev2 = p;
p = p->next;
if (p->type == BNODE) {
/* found = p;
* Mark the end of our 1 board /*
* chain of configs. * Keep walking thru the list till we
*/ * find the next board.
prev2->next = NULL; */
while (p->next) {
prev2 = p;
p = p->next;
/* if (p->type != BNODE)
* Link the "next" board to the continue;
* previous board, effectively
* "unlinking" our board from
* the main config.
*/
prev->next = p;
return found; /*
} * Mark the end of our 1 board
} * chain of configs.
/* */
* It must be the last board in the list. prev2->next = NULL;
*/
prev->next = NULL; /*
return found; * Link the "next" board to the
} * previous board, effectively
* "unlinking" our board from
* the main config.
*/
prev->next = p;
return found;
} }
/*
* It must be the last board in the list.
*/
prev->next = NULL;
return found;
} }
return NULL; return NULL;
} }