Skip to content

Commit 2560c68

Browse files
mwalleLinus Walleij
authored andcommitted
pinctrl: microchip-sgpio: return error in spgio_output_set()
Make sgpio_output_set() return an error value. Don't just ignore the return value of any regmap access but propagate it to our callers. Even if the accesses never fail, this is a preparation patch to add single shot mode where we need to poll a bit and thus we might get -ETIMEDOUT. Signed-off-by: Michael Walle <michael@walle.cc> Link: https://lore.kernel.org/r/20220226204507.2511633-5-michael@walle.cc Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 0e68328 commit 2560c68

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

drivers/pinctrl/pinctrl-microchip-sgpio.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ static inline void sgpio_configure_clock(struct sgpio_priv *priv, u32 clkfrq)
224224
sgpio_clrsetbits(priv, REG_SIO_CLOCK, 0, clr, set);
225225
}
226226

227-
static void sgpio_output_set(struct sgpio_priv *priv,
228-
struct sgpio_port_addr *addr,
229-
int value)
227+
static int sgpio_output_set(struct sgpio_priv *priv,
228+
struct sgpio_port_addr *addr,
229+
int value)
230230
{
231231
unsigned int bit = SGPIO_SRC_BITS * addr->bit;
232232
u32 clr, set;
@@ -245,10 +245,12 @@ static void sgpio_output_set(struct sgpio_priv *priv,
245245
set = FIELD_PREP(SGPIO_SPARX5_BIT_SOURCE, value << bit);
246246
break;
247247
default:
248-
return;
248+
return -EINVAL;
249249
}
250250

251251
sgpio_clrsetbits(priv, REG_PORT_CONFIG, addr->port, clr, set);
252+
253+
return 0;
252254
}
253255

254256
static int sgpio_output_get(struct sgpio_priv *priv,
@@ -334,7 +336,7 @@ static int sgpio_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
334336
case PIN_CONFIG_OUTPUT:
335337
if (bank->is_input)
336338
return -EINVAL;
337-
sgpio_output_set(priv, &addr, arg);
339+
err = sgpio_output_set(priv, &addr, arg);
338340
break;
339341

340342
default:
@@ -474,9 +476,7 @@ static int microchip_sgpio_direction_output(struct gpio_chip *gc,
474476

475477
sgpio_pin_to_addr(priv, gpio, &addr);
476478

477-
sgpio_output_set(priv, &addr, value);
478-
479-
return 0;
479+
return sgpio_output_set(priv, &addr, value);
480480
}
481481

482482
static int microchip_sgpio_get_direction(struct gpio_chip *gc, unsigned int gpio)

0 commit comments

Comments
 (0)