Re: [PATCH v6] USB: serial: ftdi_sio: implement GPIO support for FT-X devices

From: Johan Hovold
Date: Tue Sep 25 2018 - 06:15:29 EST


On Tue, Sep 25, 2018 at 12:06:35PM +0200, Johan Hovold wrote:
> On Mon, Sep 24, 2018 at 04:31:51PM +0200, Karoly Pados wrote:

> > +static void ftdi_gpio_set_multiple(struct gpio_chip *gc,
> > + unsigned long *mask, unsigned long *bits)
> > +{
> > + struct usb_serial_port *port = gpiochip_get_data(gc);
> > + struct ftdi_private *priv = usb_get_serial_port_data(port);
> > +
> > + mutex_lock(&priv->gpio_lock);
> > +
> > + priv->gpio_value &= ~(*mask);
> > + priv->gpio_value |= *bits;
>
> gpiolib doesn't clear bits not in mask for you, so you need to OR with
> *mask here to avoid setting random other bits.

That was of course meant to be: *AND* with *mask.

Johan