diff options
author | Mark Hounschell <markh@compro.net> | 2014-05-28 16:17:55 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-28 14:35:09 -0700 |
commit | 0be048cbc66e0cc98e9578769afede9fe103806b (patch) | |
tree | 035c19d4762de18cc17516ce6a810acc03a7dd86 /drivers/staging | |
parent | 9a133a9039bf8f65d79937ec05db74d7dd0a069b (diff) | |
download | lwn-0be048cbc66e0cc98e9578769afede9fe103806b.tar.gz lwn-0be048cbc66e0cc98e9578769afede9fe103806b.zip |
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>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/dgap/dgap.c | 84 |
1 files changed, 43 insertions, 41 deletions
diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c index 7912d9865e22..09e247855c91 100644 --- a/drivers/staging/dgap/dgap.c +++ b/drivers/staging/dgap/dgap.c @@ -7354,51 +7354,53 @@ static struct cnode *dgap_find_config(int type, int bus, int slot) prev = p; 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 && - p->u.board.pcibus != bus) - continue; - if (p->u.board.v_pcislot && - p->u.board.pcislot != slot) - continue; + if (p->u.board.v_pcibus && + p->u.board.pcibus != bus) + continue; - found = p; - /* - * Keep walking thru the list till we - * find the next board. - */ - while (p->next) { - prev2 = p; - p = p->next; - if (p->type == BNODE) { - - /* - * Mark the end of our 1 board - * chain of configs. - */ - prev2->next = NULL; - - /* - * 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; - } + if (p->u.board.v_pcislot && + p->u.board.pcislot != slot) + continue; + + found = p; + /* + * Keep walking thru the list till we + * find the next board. + */ + while (p->next) { + prev2 = p; + p = p->next; + + if (p->type != BNODE) + continue; + + /* + * Mark the end of our 1 board + * chain of configs. + */ + prev2->next = NULL; + + /* + * 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; } |