aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/sh-pfc/pinctrl.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/pinctrl.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/pinctrl.c')
-rw-r--r--drivers/pinctrl/sh-pfc/pinctrl.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/pinctrl/sh-pfc/pinctrl.c b/drivers/pinctrl/sh-pfc/pinctrl.c
index b4960df6aa2d..c15091096f65 100644
--- a/drivers/pinctrl/sh-pfc/pinctrl.c
+++ b/drivers/pinctrl/sh-pfc/pinctrl.c
@@ -114,18 +114,16 @@ static int sh_pfc_func_enable(struct pinctrl_dev *pctldev, unsigned selector,
114 const struct sh_pfc_pin_group *grp = &pfc->info->groups[group]; 114 const struct sh_pfc_pin_group *grp = &pfc->info->groups[group];
115 unsigned long flags; 115 unsigned long flags;
116 unsigned int i; 116 unsigned int i;
117 int ret = -EINVAL; 117 int ret = 0;
118 118
119 spin_lock_irqsave(&pfc->lock, flags); 119 spin_lock_irqsave(&pfc->lock, flags);
120 120
121 for (i = 0; i < grp->nr_pins; ++i) { 121 for (i = 0; i < grp->nr_pins; ++i) {
122 if (sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION)) 122 ret = sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION);
123 goto done; 123 if (ret < 0)
124 break;
124 } 125 }
125 126
126 ret = 0;
127
128done:
129 spin_unlock_irqrestore(&pfc->lock, flags); 127 spin_unlock_irqrestore(&pfc->lock, flags);
130 return ret; 128 return ret;
131} 129}
@@ -144,7 +142,7 @@ static int sh_pfc_reconfig_pin(struct sh_pfc_pinctrl *pmx, unsigned offset,
144 const struct sh_pfc_pin *pin = &pfc->info->pins[idx]; 142 const struct sh_pfc_pin *pin = &pfc->info->pins[idx];
145 unsigned int mark = pin->enum_id; 143 unsigned int mark = pin->enum_id;
146 unsigned long flags; 144 unsigned long flags;
147 int ret = -EINVAL; 145 int ret;
148 146
149 spin_lock_irqsave(&pfc->lock, flags); 147 spin_lock_irqsave(&pfc->lock, flags);
150 148
@@ -156,17 +154,17 @@ static int sh_pfc_reconfig_pin(struct sh_pfc_pinctrl *pmx, unsigned offset,
156 case PINMUX_TYPE_INPUT_PULLDOWN: 154 case PINMUX_TYPE_INPUT_PULLDOWN:
157 break; 155 break;
158 default: 156 default:
159 goto err; 157 ret = -EINVAL;
158 goto done;
160 } 159 }
161 160
162 if (sh_pfc_config_mux(pfc, mark, new_type) != 0) 161 ret = sh_pfc_config_mux(pfc, mark, new_type);
163 goto err; 162 if (ret < 0)
163 goto done;
164 164
165 cfg->type = new_type; 165 cfg->type = new_type;
166 166
167 ret = 0; 167done:
168
169err:
170 spin_unlock_irqrestore(&pfc->lock, flags); 168 spin_unlock_irqrestore(&pfc->lock, flags);
171 169
172 return ret; 170 return ret;