Skip to content

Commit acd4692

Browse files
committed
Merge tag 'usb-serial-6.17-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-next
Johan writes: USB serial updates for 6.17-rc1 Here are the USB serial updates for 6.17-rc1, including - switch to new gpiolib interface that can return errors All have been in linux-next with no reported issues. * tag 'usb-serial-6.17-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial: USB: serial: cp210x: use new GPIO line value setter callbacks USB: serial: ftdi_sio: use new GPIO line value setter callbacks
2 parents 8d1b02e + bdf2ab1 commit acd4692

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
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;

drivers/usb/serial/ftdi_sio.c

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

1862-
static void ftdi_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value)
1862+
static int ftdi_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value)
18631863
{
18641864
struct usb_serial_port *port = gpiochip_get_data(gc);
18651865
struct ftdi_private *priv = usb_get_serial_port_data(port);
1866+
int result;
18661867

18671868
mutex_lock(&priv->gpio_lock);
18681869

@@ -1871,9 +1872,11 @@ static void ftdi_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value)
18711872
else
18721873
priv->gpio_value &= ~BIT(gpio);
18731874

1874-
ftdi_set_cbus_pins(port);
1875+
result = ftdi_set_cbus_pins(port);
18751876

18761877
mutex_unlock(&priv->gpio_lock);
1878+
1879+
return result;
18771880
}
18781881

18791882
static int ftdi_gpio_get_multiple(struct gpio_chip *gc, unsigned long *mask,
@@ -1891,19 +1894,22 @@ static int ftdi_gpio_get_multiple(struct gpio_chip *gc, unsigned long *mask,
18911894
return 0;
18921895
}
18931896

1894-
static void ftdi_gpio_set_multiple(struct gpio_chip *gc, unsigned long *mask,
1897+
static int ftdi_gpio_set_multiple(struct gpio_chip *gc, unsigned long *mask,
18951898
unsigned long *bits)
18961899
{
18971900
struct usb_serial_port *port = gpiochip_get_data(gc);
18981901
struct ftdi_private *priv = usb_get_serial_port_data(port);
1902+
int result;
18991903

19001904
mutex_lock(&priv->gpio_lock);
19011905

19021906
priv->gpio_value &= ~(*mask);
19031907
priv->gpio_value |= *bits & *mask;
1904-
ftdi_set_cbus_pins(port);
1908+
result = ftdi_set_cbus_pins(port);
19051909

19061910
mutex_unlock(&priv->gpio_lock);
1911+
1912+
return result;
19071913
}
19081914

19091915
static int ftdi_gpio_direction_get(struct gpio_chip *gc, unsigned int gpio)
@@ -2144,9 +2150,9 @@ static int ftdi_gpio_init(struct usb_serial_port *port)
21442150
priv->gc.direction_output = ftdi_gpio_direction_output;
21452151
priv->gc.init_valid_mask = ftdi_gpio_init_valid_mask;
21462152
priv->gc.get = ftdi_gpio_get;
2147-
priv->gc.set = ftdi_gpio_set;
2153+
priv->gc.set_rv = ftdi_gpio_set;
21482154
priv->gc.get_multiple = ftdi_gpio_get_multiple;
2149-
priv->gc.set_multiple = ftdi_gpio_set_multiple;
2155+
priv->gc.set_multiple_rv = ftdi_gpio_set_multiple;
21502156
priv->gc.owner = THIS_MODULE;
21512157
priv->gc.parent = &serial->interface->dev;
21522158
priv->gc.base = -1;

0 commit comments

Comments
 (0)