Skip to content

Commit 83e927b

Browse files
Bartosz Golaszewskijhovold
authored andcommitted
USB: serial: ftdi_sio: 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 e04c78d commit 83e927b

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

drivers/usb/serial/ftdi_sio.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,10 +1857,11 @@ static int ftdi_gpio_get(struct gpio_chip *gc, unsigned int gpio)
18571857
return !!(result & BIT(gpio));
18581858
}
18591859

1860-
static void ftdi_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value)
1860+
static int ftdi_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value)
18611861
{
18621862
struct usb_serial_port *port = gpiochip_get_data(gc);
18631863
struct ftdi_private *priv = usb_get_serial_port_data(port);
1864+
int result;
18641865

18651866
mutex_lock(&priv->gpio_lock);
18661867

@@ -1869,9 +1870,11 @@ static void ftdi_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value)
18691870
else
18701871
priv->gpio_value &= ~BIT(gpio);
18711872

1872-
ftdi_set_cbus_pins(port);
1873+
result = ftdi_set_cbus_pins(port);
18731874

18741875
mutex_unlock(&priv->gpio_lock);
1876+
1877+
return result;
18751878
}
18761879

18771880
static int ftdi_gpio_get_multiple(struct gpio_chip *gc, unsigned long *mask,
@@ -1889,19 +1892,22 @@ static int ftdi_gpio_get_multiple(struct gpio_chip *gc, unsigned long *mask,
18891892
return 0;
18901893
}
18911894

1892-
static void ftdi_gpio_set_multiple(struct gpio_chip *gc, unsigned long *mask,
1895+
static int ftdi_gpio_set_multiple(struct gpio_chip *gc, unsigned long *mask,
18931896
unsigned long *bits)
18941897
{
18951898
struct usb_serial_port *port = gpiochip_get_data(gc);
18961899
struct ftdi_private *priv = usb_get_serial_port_data(port);
1900+
int result;
18971901

18981902
mutex_lock(&priv->gpio_lock);
18991903

19001904
priv->gpio_value &= ~(*mask);
19011905
priv->gpio_value |= *bits & *mask;
1902-
ftdi_set_cbus_pins(port);
1906+
result = ftdi_set_cbus_pins(port);
19031907

19041908
mutex_unlock(&priv->gpio_lock);
1909+
1910+
return result;
19051911
}
19061912

19071913
static int ftdi_gpio_direction_get(struct gpio_chip *gc, unsigned int gpio)
@@ -2142,9 +2148,9 @@ static int ftdi_gpio_init(struct usb_serial_port *port)
21422148
priv->gc.direction_output = ftdi_gpio_direction_output;
21432149
priv->gc.init_valid_mask = ftdi_gpio_init_valid_mask;
21442150
priv->gc.get = ftdi_gpio_get;
2145-
priv->gc.set = ftdi_gpio_set;
2151+
priv->gc.set_rv = ftdi_gpio_set;
21462152
priv->gc.get_multiple = ftdi_gpio_get_multiple;
2147-
priv->gc.set_multiple = ftdi_gpio_set_multiple;
2153+
priv->gc.set_multiple_rv = ftdi_gpio_set_multiple;
21482154
priv->gc.owner = THIS_MODULE;
21492155
priv->gc.parent = &serial->interface->dev;
21502156
priv->gc.base = -1;

0 commit comments

Comments
 (0)