lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 8 Dec 2020 10:58:17 +0100
From:   Johan Hovold <johan@...nel.org>
To:     Linus Walleij <linus.walleij@...aro.org>
Cc:     Johan Hovold <johan@...nel.org>,
        Manivannan Sadhasivam <mani@...nel.org>,
        Greg KH <gregkh@...uxfoundation.org>,
        linux-usb <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        patong.mxl@...il.com,
        Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
        Angelo Dureghello <angelo.dureghello@...esys.com>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>
Subject: Re: [PATCH v5 2/3] usb: serial: xr_serial: Add gpiochip support

On Sat, Dec 05, 2020 at 11:21:09PM +0100, Linus Walleij wrote:
> On Tue, Dec 1, 2020 at 4:50 PM Johan Hovold <johan@...nel.org> wrote:
> > 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@...nel.org> wrote:
> 
> > > 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.
> 
> Hm hm yeah we actually put in a nasty warning there since:
> 
>                 gpio = gpio_name_to_desc(gc->names[i]);
>                 if (gpio)
>                         dev_warn(&gdev->dev,
>                                  "Detected name collision for GPIO name '%s'\n",
>                                  gc->names[i]);
> 
> 
> A better approach might be to create an array of names
> prepended with something device-unique like the USB
> bus topology? Or do we need a helper to help naming the
> GPIOs? What would be helpful here?
> 
> name = kasprintf(GFP_KERNEL, "%s-NAME", topology_str);

Well we started discussing this back when we only had the sysfs
interface which suffered from the same problem. I thought the chardev
interface was supposed to get rid of the assumption of a flat name
space? Perhaps in v3 of the ABI. ;P

If this is too built into the new chardev interface as well to be fixed
up, a unique prefix is the only way to go. Perhaps gpiolib can just
prefix it with the controller name?

	gpiochip508-CBUS0

Based on a hotpluggable bus flag? But what about any other non-pluggable
IC, which provides a few named GPIO lines and of which there could be
more than one in a system?

The topology is already encoded in sysfs and it seems backwards to have
each and every gpio driver reconstruct it.

Johan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ