Skip to content

Commit bdf2ab1

Browse files
Bartosz Golaszewskijhovold
authored andcommitted
USB: serial: cp210x: 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]> Signed-off-by: Johan Hovold <[email protected]>
1 parent 83e927b commit bdf2ab1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/usb/serial/cp210x.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@ static int cp210x_gpio_get(struct gpio_chip *gc, unsigned int gpio)
15041504
return !!(mask & BIT(gpio));
15051505
}
15061506

1507-
static void cp210x_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value)
1507+
static int cp210x_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value)
15081508
{
15091509
struct usb_serial *serial = gpiochip_get_data(gc);
15101510
struct cp210x_serial_private *priv = usb_get_serial_data(serial);
@@ -1559,7 +1559,10 @@ static void cp210x_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value)
15591559
if (result < 0) {
15601560
dev_err(&serial->interface->dev, "failed to set GPIO value: %d\n",
15611561
result);
1562+
return result;
15621563
}
1564+
1565+
return 0;
15631566
}
15641567

15651568
static int cp210x_gpio_direction_get(struct gpio_chip *gc, unsigned int gpio)
@@ -1599,9 +1602,8 @@ static int cp210x_gpio_direction_output(struct gpio_chip *gc, unsigned int gpio,
15991602
struct cp210x_serial_private *priv = usb_get_serial_data(serial);
16001603

16011604
priv->gpio_input &= ~BIT(gpio);
1602-
cp210x_gpio_set(gc, gpio, value);
16031605

1604-
return 0;
1606+
return cp210x_gpio_set(gc, gpio, value);
16051607
}
16061608

16071609
static int cp210x_gpio_set_config(struct gpio_chip *gc, unsigned int gpio,
@@ -1960,7 +1962,7 @@ static int cp210x_gpio_init(struct usb_serial *serial)
19601962
priv->gc.direction_input = cp210x_gpio_direction_input;
19611963
priv->gc.direction_output = cp210x_gpio_direction_output;
19621964
priv->gc.get = cp210x_gpio_get;
1963-
priv->gc.set = cp210x_gpio_set;
1965+
priv->gc.set_rv = cp210x_gpio_set;
19641966
priv->gc.set_config = cp210x_gpio_set_config;
19651967
priv->gc.init_valid_mask = cp210x_gpio_init_valid_mask;
19661968
priv->gc.owner = THIS_MODULE;

0 commit comments

Comments
 (0)