Skip to content

Commit 241d79f

Browse files
Bartosz Golaszewskiandy-shev
authored andcommitted
pinctrl: intel: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski <[email protected]> Acked-by: Mika Westerberg <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent 83ab731 commit 241d79f

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

drivers/pinctrl/intel/pinctrl-intel.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,8 +1033,8 @@ static int intel_gpio_get(struct gpio_chip *chip, unsigned int offset)
10331033
return !!(padcfg0 & PADCFG0_GPIORXSTATE);
10341034
}
10351035

1036-
static void intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
1037-
int value)
1036+
static int intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
1037+
int value)
10381038
{
10391039
struct intel_pinctrl *pctrl = gpiochip_get_data(chip);
10401040
void __iomem *reg;
@@ -1043,11 +1043,11 @@ static void intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
10431043

10441044
pin = intel_gpio_to_pin(pctrl, offset, NULL, NULL);
10451045
if (pin < 0)
1046-
return;
1046+
return -EINVAL;
10471047

10481048
reg = intel_get_padcfg(pctrl, pin, PADCFG0);
10491049
if (!reg)
1050-
return;
1050+
return -EINVAL;
10511051

10521052
guard(raw_spinlock_irqsave)(&pctrl->lock);
10531053

@@ -1057,6 +1057,8 @@ static void intel_gpio_set(struct gpio_chip *chip, unsigned int offset,
10571057
else
10581058
padcfg0 &= ~PADCFG0_GPIOTXSTATE;
10591059
writel(padcfg0, reg);
1060+
1061+
return 0;
10601062
}
10611063

10621064
static int intel_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
@@ -1094,7 +1096,12 @@ static int intel_gpio_direction_input(struct gpio_chip *chip, unsigned int offse
10941096
static int intel_gpio_direction_output(struct gpio_chip *chip, unsigned int offset,
10951097
int value)
10961098
{
1097-
intel_gpio_set(chip, offset, value);
1099+
int ret;
1100+
1101+
ret = intel_gpio_set(chip, offset, value);
1102+
if (ret)
1103+
return ret;
1104+
10981105
return pinctrl_gpio_direction_output(chip, offset);
10991106
}
11001107

@@ -1106,7 +1113,7 @@ static const struct gpio_chip intel_gpio_chip = {
11061113
.direction_input = intel_gpio_direction_input,
11071114
.direction_output = intel_gpio_direction_output,
11081115
.get = intel_gpio_get,
1109-
.set = intel_gpio_set,
1116+
.set_rv = intel_gpio_set,
11101117
.set_config = gpiochip_generic_config,
11111118
};
11121119

0 commit comments

Comments
 (0)