lkml.org 
[lkml]   [2020]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 2/3] usb: serial: xr_serial: Add gpiochip support
On Tue, Dec 01, 2020 at 03:37:38PM +0100, Linus Walleij wrote:
> On Sun, Nov 22, 2020 at 6:08 PM Manivannan Sadhasivam <mani@kernel.org> wrote:
>
> > Add gpiochip support for Maxlinear/Exar USB to serial converter
> > for controlling the available gpios.

> One minor notice:
>
> > +enum gpio_pins {
> > + GPIO_RI = 0,
> > + GPIO_CD,
> > + GPIO_DSR,
> > + GPIO_DTR,
> > + GPIO_CTS,
> > + GPIO_RTS,
> > + GPIO_MAX,
> > +};
>
> You know the names of the pins...
>
> > + port_priv->gc.ngpio = 6;
> > + port_priv->gc.label = "xr_gpios";
> > + port_priv->gc.request = xr_gpio_request;
> > + port_priv->gc.free = xr_gpio_free;
> > + port_priv->gc.get_direction = xr_gpio_direction_get;
> > + port_priv->gc.direction_input = xr_gpio_direction_input;
> > + port_priv->gc.direction_output = xr_gpio_direction_output;
> > + port_priv->gc.get = xr_gpio_get;
> > + port_priv->gc.set = xr_gpio_set;
> > + port_priv->gc.owner = THIS_MODULE;
> > + port_priv->gc.parent = &port->dev;
> > + port_priv->gc.base = -1;
> > + port_priv->gc.can_sleep = true;
>
> So assign port_priv->gc.names here as well with an array
> of strings with the names ("RI", "CD", ... etc).
> This makes it look really nice in userspace if you do
> e.g. "lsgpio".

Last time we tried that gpiolib still used a flat namespace so that you
can't have have more than one device using the same names. Unless that
has changed this is a no-go. See

https://lore.kernel.org/r/20180930122703.7115-1-johan@kernel.org

for our previous discussion about this.

Johan

\
 
 \ /
  Last update: 2020-12-01 16:55    [W:0.128 / U:3.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site