aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/sh-pfc/core.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-03-10 11:38:23 -0400
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-03-15 08:33:54 -0400
commitb705c054255ae3264aa02d46347e9cfbcf26523a (patch)
treec2f379c90d286ebcdac9eaed849f40083dbded23 /drivers/pinctrl/sh-pfc/core.c
parentcd3c1beecfeb757b16904386ea474d3c272de4ee (diff)
sh-pfc: Use proper error codes
Return proper error codes instead of -1, and propagate the error codes. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/sh-pfc/core.c')
-rw-r--r--drivers/pinctrl/sh-pfc/core.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
index 3a949465e88e..a04c497deccd 100644
--- a/drivers/pinctrl/sh-pfc/core.c
+++ b/drivers/pinctrl/sh-pfc/core.c
@@ -93,7 +93,7 @@ int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin)
93 offset += range->end - range->begin + 1; 93 offset += range->end - range->begin + 1;
94 } 94 }
95 95
96 return -1; 96 return -EINVAL;
97} 97}
98 98
99static int sh_pfc_enum_in_range(pinmux_enum_t enum_id, 99static int sh_pfc_enum_in_range(pinmux_enum_t enum_id,
@@ -233,7 +233,7 @@ static int sh_pfc_get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id,
233 k++; 233 k++;
234 } 234 }
235 235
236 return -1; 236 return -EINVAL;
237} 237}
238 238
239static int sh_pfc_mark_to_enum(struct sh_pfc *pfc, pinmux_enum_t mark, int pos, 239static int sh_pfc_mark_to_enum(struct sh_pfc *pfc, pinmux_enum_t mark, int pos,
@@ -255,7 +255,7 @@ static int sh_pfc_mark_to_enum(struct sh_pfc *pfc, pinmux_enum_t mark, int pos,
255 } 255 }
256 256
257 pr_err("cannot locate data/mark enum_id for mark %d\n", mark); 257 pr_err("cannot locate data/mark enum_id for mark %d\n", mark);
258 return -1; 258 return -EINVAL;
259} 259}
260 260
261int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) 261int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type)
@@ -264,6 +264,7 @@ int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type)
264 pinmux_enum_t enum_id; 264 pinmux_enum_t enum_id;
265 const struct pinmux_range *range; 265 const struct pinmux_range *range;
266 int in_range, pos, field, value; 266 int in_range, pos, field, value;
267 int ret;
267 268
268 switch (pinmux_type) { 269 switch (pinmux_type) {
269 270
@@ -288,7 +289,7 @@ int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type)
288 break; 289 break;
289 290
290 default: 291 default:
291 return -1; 292 return -EINVAL;
292 } 293 }
293 294
294 pos = 0; 295 pos = 0;
@@ -297,8 +298,8 @@ int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type)
297 value = 0; 298 value = 0;
298 while (1) { 299 while (1) {
299 pos = sh_pfc_mark_to_enum(pfc, mark, pos, &enum_id); 300 pos = sh_pfc_mark_to_enum(pfc, mark, pos, &enum_id);
300 if (pos <= 0) 301 if (pos < 0)
301 return -1; 302 return pos;
302 303
303 if (!enum_id) 304 if (!enum_id)
304 break; 305 break;
@@ -341,9 +342,9 @@ int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type)
341 if (!in_range) 342 if (!in_range)
342 continue; 343 continue;
343 344
344 if (sh_pfc_get_config_reg(pfc, enum_id, &cr, 345 ret = sh_pfc_get_config_reg(pfc, enum_id, &cr, &field, &value);
345 &field, &value) != 0) 346 if (ret < 0)
346 return -1; 347 return ret;
347 348
348 sh_pfc_write_config_reg(pfc, cr, field, value); 349 sh_pfc_write_config_reg(pfc, cr, field, value);
349 } 350 }