diff options
author | Axel Lin <axel.lin@ingics.com> | 2013-08-20 22:28:50 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-08-23 02:56:32 -0400 |
commit | 1cb95395870d68f9ff679db42fa15ea03201fc08 (patch) | |
tree | 7dadcd15a6bd9852cce84f7a384da5f0a9cb61fb /drivers/pinctrl/pinctrl-rockchip.c | |
parent | 1ede12d491cb5bad4f31f0e82443a68eeeeb8ac3 (diff) |
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>
Diffstat (limited to 'drivers/pinctrl/pinctrl-rockchip.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-rockchip.c | 21 |
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( | |||
167 | const struct rockchip_pinctrl *info, | 167 | const struct rockchip_pinctrl *info, |
168 | const char *name) | 168 | const char *name) |
169 | { | 169 | { |
170 | const struct rockchip_pin_group *grp = NULL; | ||
171 | int i; | 170 | int i; |
172 | 171 | ||
173 | for (i = 0; i < info->ngroups; i++) { | 172 | for (i = 0; i < info->ngroups; i++) { |
174 | if (strcmp(info->groups[i].name, name)) | 173 | if (!strcmp(info->groups[i].name, name)) |
175 | continue; | 174 | return &info->groups[i]; |
176 | |||
177 | grp = &info->groups[i]; | ||
178 | break; | ||
179 | } | 175 | } |
180 | 176 | ||
181 | return grp; | 177 | return NULL; |
182 | } | 178 | } |
183 | 179 | ||
184 | /* | 180 | /* |
@@ -204,17 +200,12 @@ static struct rockchip_pin_bank *bank_num_to_bank( | |||
204 | struct rockchip_pin_bank *b = info->ctrl->pin_banks; | 200 | struct rockchip_pin_bank *b = info->ctrl->pin_banks; |
205 | int i; | 201 | int i; |
206 | 202 | ||
207 | for (i = 0; i < info->ctrl->nr_banks; i++) { | 203 | for (i = 0; i < info->ctrl->nr_banks; i++, b++) { |
208 | if (b->bank_num == num) | 204 | if (b->bank_num == num) |
209 | break; | 205 | return b; |
210 | |||
211 | b++; | ||
212 | } | 206 | } |
213 | 207 | ||
214 | if (b->bank_num != num) | 208 | return ERR_PTR(-EINVAL); |
215 | return ERR_PTR(-EINVAL); | ||
216 | |||
217 | return b; | ||
218 | } | 209 | } |
219 | 210 | ||
220 | /* | 211 | /* |