summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2013-08-21 10:28:50 +0800
committerLinus Walleij <linus.walleij@linaro.org>2013-08-23 08:56:32 +0200
commit1cb95395870d68f9ff679db42fa15ea03201fc08 (patch)
tree7dadcd15a6bd9852cce84f7a384da5f0a9cb61fb
parent1ede12d491cb5bad4f31f0e82443a68eeeeb8ac3 (diff)
downloadblackbird-op-linux-1cb95395870d68f9ff679db42fa15ea03201fc08.tar.gz
blackbird-op-linux-1cb95395870d68f9ff679db42fa15ea03201fc08.zip
pinctrl: rockchip: Simplify for loop iteration
Just return once a match found makes the code simpler and shorter. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/pinctrl/pinctrl-rockchip.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index c22457de0048..64ad0c0a1536 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -167,18 +167,14 @@ static const inline struct rockchip_pin_group *pinctrl_name_to_group(
const struct rockchip_pinctrl *info,
const char *name)
{
- const struct rockchip_pin_group *grp = NULL;
int i;
for (i = 0; i < info->ngroups; i++) {
- if (strcmp(info->groups[i].name, name))
- continue;
-
- grp = &info->groups[i];
- break;
+ if (!strcmp(info->groups[i].name, name))
+ return &info->groups[i];
}
- return grp;
+ return NULL;
}
/*
@@ -204,17 +200,12 @@ static struct rockchip_pin_bank *bank_num_to_bank(
struct rockchip_pin_bank *b = info->ctrl->pin_banks;
int i;
- for (i = 0; i < info->ctrl->nr_banks; i++) {
+ for (i = 0; i < info->ctrl->nr_banks; i++, b++) {
if (b->bank_num == num)
- break;
-
- b++;
+ return b;
}
- if (b->bank_num != num)
- return ERR_PTR(-EINVAL);
-
- return b;
+ return ERR_PTR(-EINVAL);
}
/*
OpenPOWER on IntegriCloud