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, 9 Feb 2010 10:08:00 -0700
From:	Grant Likely <grant.likely@...retlab.ca>
To:	Anton Vorontsov <avorontsov@...mvista.com>
Cc:	David Brownell <dbrownell@...rs.sourceforge.net>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Bill Gatliff <bgat@...lgatliff.com>,
	Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	linuxppc-dev@...abs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] of/gpio: Implement GPIOLIB notifier hooks

On Fri, Feb 5, 2010 at 1:32 PM, Anton Vorontsov
<avorontsov@...mvista.com> wrote:
> This patch implements GPIOLIB notifier hooks, and thus makes device-enabled
> GPIO chips (i.e. the ones that have gpio_chip->dev specified) automatically
> attached to the OpenFirmware subsystem. Which means that now we can handle
> I2C and SPI GPIO chips almost* transparently.
>
> * "Almost" because some chips still require platform data, and for these
>  chips OF-glue is still needed, though with this support the glue will
>  be much smaller.
>
> Signed-off-by: Anton Vorontsov <avorontsov@...mvista.com>
> ---
>  drivers/of/gpio.c |  100 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 100 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/of/gpio.c b/drivers/of/gpio.c
> index 12c4af0..9d8df77 100644
> --- a/drivers/of/gpio.c
> +++ b/drivers/of/gpio.c
> @@ -13,6 +13,7 @@
>
>  #include <linux/kernel.h>
>  #include <linux/errno.h>
> +#include <linux/notifier.h>
>  #include <linux/io.h>
>  #include <linux/of.h>
>  #include <linux/of_gpio.h>
> @@ -236,3 +237,102 @@ err0:
>        return ret;
>  }
>  EXPORT_SYMBOL(of_mm_gpiochip_add);
> +
> +/**
> + * of_gpiochip_register_simple - Register a chip with the OF GPIO subsystem
> + * @chip       pointer to a GPIO chip
> + * @np:                device node to register the GPIO chip with
> + *
> + * This function registers a GPIO chip with the OF infrastructure. It is
> + * assumed that the chip was previsously allocated and added to a generic
> + * GPIOLIB framework (using gpiochip_add() function).
> + *
> + * The `simple' name means that the chip is using simple two-cells scheme for
> + * the gpio-specifier.
> + */
> +static int of_gpiochip_register_simple(struct gpio_chip *chip,
> +                                      struct device_node *np)
> +{
> +       struct of_gpio_chip *of_gc;
> +
> +       if (np->data) {
> +               WARN_ON(1);
> +               return -EBUSY;
> +       }
> +
> +       of_gc = kzalloc(sizeof(*of_gc), GFP_KERNEL);
> +       if (!of_gc)
> +               return -ENOMEM;
> +
> +       of_gc->gpio_cells = 2;
> +       of_gc->xlate = of_gpio_simple_xlate;
> +       of_gc->chip = chip;

One concern.

How does an OF-aware GPIO driver override these settings?  What is to
be done when a GPIO chip requires a different xlate hook?  Or a
different number of gpio_cells?

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
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