Skip to content

Commit 2661dc2

Browse files
author
Bartosz Golaszewski
committed
gpio: cros-ec: 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: Tzung-Bi Shih <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 68f5b74 commit 2661dc2

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

drivers/gpio/gpio-cros-ec.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,21 @@
2424
static const char cros_ec_gpio_prefix[] = "EC:";
2525

2626
/* Setting gpios is only supported when the system is unlocked */
27-
static void cros_ec_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
27+
static int cros_ec_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
2828
{
2929
const char *name = gc->names[gpio] + strlen(cros_ec_gpio_prefix);
3030
struct cros_ec_device *cros_ec = gpiochip_get_data(gc);
3131
struct ec_params_gpio_set params = {
3232
.val = val,
3333
};
34-
int ret;
3534
ssize_t copied;
3635

3736
copied = strscpy(params.name, name, sizeof(params.name));
3837
if (copied < 0)
39-
return;
38+
return copied;
4039

41-
ret = cros_ec_cmd(cros_ec, 0, EC_CMD_GPIO_SET, &params,
42-
sizeof(params), NULL, 0);
43-
if (ret < 0)
44-
dev_err(gc->parent, "error setting gpio%d (%s) on EC: %d\n", gpio, name, ret);
40+
return cros_ec_cmd(cros_ec, 0, EC_CMD_GPIO_SET, &params,
41+
sizeof(params), NULL, 0);
4542
}
4643

4744
static int cros_ec_gpio_get(struct gpio_chip *gc, unsigned int gpio)
@@ -191,7 +188,7 @@ static int cros_ec_gpio_probe(struct platform_device *pdev)
191188
gc->can_sleep = true;
192189
gc->label = dev_name(dev);
193190
gc->base = -1;
194-
gc->set = cros_ec_gpio_set;
191+
gc->set_rv = cros_ec_gpio_set;
195192
gc->get = cros_ec_gpio_get;
196193
gc->get_direction = cros_ec_gpio_get_direction;
197194

0 commit comments

Comments
 (0)