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:	Mon, 1 Dec 2014 18:27:59 -0600
From:	Benoit Parrot <bparrot@...com>
To:	Maxime Ripard <maxime.ripard@...e-electrons.com>
CC:	Alexandre Courbot <gnurou@...il.com>,
	Pantelis Antoniou <panto@...oniou-consulting.com>,
	Jiri Prchal <jiri.prchal@...ignal.cz>,
	Linus Walleij <linus.walleij@...aro.org>,
	"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>
Subject: Re: [Patch v2 1/2] gpio: add GPIO hogging mechanism

Maxime Ripard <maxime.ripard@...e-electrons.com> wrote on Mon [2014-Dec-01 17:36:39 +0100]:
> Hi,
> 
> On Fri, Nov 28, 2014 at 04:30:01PM +0900, Alexandre Courbot wrote:
> > > +/**
> > > + * do_gpio_hog - Given node is a GPIO hog configuration, handle it
> > > + * @np:                device node to get GPIO from
> > > + *
> > > + * This is only used by of_gpiochip_add to request/set GPIO initial
> > > + * configuration.
> > > + */
> > > +static int do_gpio_hog(struct device_node *np)
> > > +{
> > > +       struct gpio_desc *desc = NULL;
> > > +       int err;
> > > +       const char *name;
> > > +       enum gpio_lookup_flags lflags;
> > > +       enum gpiod_flags dflags;
> > > +
> > > +       desc = of_get_gpio_hog(np, &name, &lflags, &dflags);
> > > +       if (!desc)
> > > +               return -ENOTSUPP;
> > > +       else if (IS_ERR(desc))
> > > +               return PTR_ERR(desc);
> > > +
> > > +       err = gpiod_request(desc, name);
> > 
> > Using this function means that a GPIO chip module cannot be unloaded
> > if it uses GPIO hogs. Is it the intended behavior? If not, please use
> > gpiochip_request_own_desc() instead, and make sure to call
> > gpiochip_free_own_desc() for each hog when the driver is unloaded.
> 
> The only thing I'd like to have would be that the request here would
> be non-exclusive, so that a later driver would still be allowed later
> on to request that GPIO later on and manage it itself (ideally using
> the usual gpiod_request function).

I'll let Linus chime in on this.
But the premise for the hogging mechanism is to have a mechanism to set GPIOs
which do not need to be requested by any other entity.
If a driver needs access to a specific GPIO then it should use the existing
gpiolib API to request it and set it up.

> 
> Maxime
> 
> -- 
> Maxime Ripard, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com

Regards,
Benoit
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ