Skip to content

Commit 077f873

Browse files
Bartosz Golaszewskimaddy-kerneldev
authored andcommitted
powerpc: 83xx/gpio: 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. Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Christophe Leroy <[email protected]> Signed-off-by: Madhavan Srinivasan <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 54ac723 commit 077f873

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,25 +92,28 @@ static void mcu_power_off(void)
9292
mutex_unlock(&mcu->lock);
9393
}
9494

95-
static void mcu_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
95+
static int mcu_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
9696
{
9797
struct mcu *mcu = gpiochip_get_data(gc);
9898
u8 bit = 1 << (4 + gpio);
99+
int ret;
99100

100101
mutex_lock(&mcu->lock);
101102
if (val)
102103
mcu->reg_ctrl &= ~bit;
103104
else
104105
mcu->reg_ctrl |= bit;
105106

106-
i2c_smbus_write_byte_data(mcu->client, MCU_REG_CTRL, mcu->reg_ctrl);
107+
ret = i2c_smbus_write_byte_data(mcu->client, MCU_REG_CTRL,
108+
mcu->reg_ctrl);
107109
mutex_unlock(&mcu->lock);
110+
111+
return ret;
108112
}
109113

110114
static int mcu_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
111115
{
112-
mcu_gpio_set(gc, gpio, val);
113-
return 0;
116+
return mcu_gpio_set(gc, gpio, val);
114117
}
115118

116119
static int mcu_gpiochip_add(struct mcu *mcu)
@@ -123,7 +126,7 @@ static int mcu_gpiochip_add(struct mcu *mcu)
123126
gc->can_sleep = 1;
124127
gc->ngpio = MCU_NUM_GPIO;
125128
gc->base = -1;
126-
gc->set = mcu_gpio_set;
129+
gc->set_rv = mcu_gpio_set;
127130
gc->direction_output = mcu_gpio_dir_out;
128131
gc->parent = dev;
129132

0 commit comments

Comments
 (0)