Skip to content

Commit d5cc728

Browse files
author
Bartosz Golaszewski
committed
gpio: bcm-kona: use new 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. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent cd7d117 commit d5cc728

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/gpio/gpio-bcm-kona.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ static int bcm_kona_gpio_get_dir(struct gpio_chip *chip, unsigned gpio)
149149
return val ? GPIO_LINE_DIRECTION_IN : GPIO_LINE_DIRECTION_OUT;
150150
}
151151

152-
static void bcm_kona_gpio_set(struct gpio_chip *chip, unsigned gpio, int value)
152+
static int bcm_kona_gpio_set(struct gpio_chip *chip, unsigned int gpio,
153+
int value)
153154
{
154155
struct bcm_kona_gpio *kona_gpio;
155156
void __iomem *reg_base;
@@ -164,13 +165,15 @@ static void bcm_kona_gpio_set(struct gpio_chip *chip, unsigned gpio, int value)
164165

165166
/* this function only applies to output pin */
166167
if (bcm_kona_gpio_get_dir(chip, gpio) == GPIO_LINE_DIRECTION_IN)
167-
return;
168+
return 0;
168169

169170
reg_offset = value ? GPIO_OUT_SET(bank_id) : GPIO_OUT_CLEAR(bank_id);
170171

171172
val = readl(reg_base + reg_offset);
172173
val |= BIT(bit);
173174
writel(val, reg_base + reg_offset);
175+
176+
return 0;
174177
}
175178

176179
static int bcm_kona_gpio_get(struct gpio_chip *chip, unsigned gpio)
@@ -336,7 +339,7 @@ static const struct gpio_chip template_chip = {
336339
.direction_input = bcm_kona_gpio_direction_input,
337340
.get = bcm_kona_gpio_get,
338341
.direction_output = bcm_kona_gpio_direction_output,
339-
.set = bcm_kona_gpio_set,
342+
.set_rv = bcm_kona_gpio_set,
340343
.set_config = bcm_kona_gpio_set_config,
341344
.to_irq = bcm_kona_gpio_to_irq,
342345
.base = 0,

0 commit comments

Comments
 (0)