Commit 0be048cb authored by Mark Hounschell's avatar Mark Hounschell Committed by Greg Kroah-Hartman

staging: dgap: Simplify dgap_find_config

Simplify ugly dgap_find_config function
Signed-off-by: default avatarMark Hounschell <markh@compro.net>
Tested-by: default avatarMark Hounschell <markh@compro.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9a133a90
...@@ -7354,51 +7354,53 @@ static struct cnode *dgap_find_config(int type, int bus, int slot) ...@@ -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.
*/ found = p;
while (p->next) { /*
prev2 = p; * Keep walking thru the list till we
p = p->next; * find the next board.
if (p->type == BNODE) { */
while (p->next) {
/* prev2 = p;
* Mark the end of our 1 board p = p->next;
* chain of configs.
*/ if (p->type != BNODE)
prev2->next = NULL; continue;
/* /*
* Link the "next" board to the * Mark the end of our 1 board
* previous board, effectively * chain of configs.
* "unlinking" our board from */
* the main config. prev2->next = NULL;
*/
prev->next = p; /*
* Link the "next" board to the
return found; * previous board, effectively
} * "unlinking" our board from
} * the main config.
/* */
* It must be the last board in the list. prev->next = p;
*/
prev->next = NULL; return found;
return found;
}
} }
/*
* It must be the last board in the list.
*/
prev->next = NULL;
return found;
} }
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment