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]
Message-ID: <BANLkTi=qjFtWeavDZbzY5bQR5vdnwAfnqw@mail.gmail.com>
Date:	Thu, 14 Apr 2011 13:53:26 -0600
From:	Grant Likely <grant.likely@...retlab.ca>
To:	Linus Walleij <linus.walleij@...aro.org>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] gpio: expose gpio_to_chip()

On Thu, Apr 14, 2011 at 1:20 PM, Linus Walleij <linus.walleij@...aro.org> wrote:
> This makes the gpio_to_chip() function available to drivers. The
> usecase is when you want to add a few chip-specific operations
> apart from the ones exposed in struct gpio_chip.

Similar to interrupt handling, it probably isn't a good idea to expose
the gpio_chip directly.  Go ahead and add the ops you need and see
what it looks like.

g.

>
> Signed-off-by: Linus Walleij <linus.walleij@...aro.org>
> ---
> Grant, would be great to have your input on this.
>
> I will need this for enabling/disabling IRQ in certain pins
> and setting pullup/pulldown mode, setting sleep modes for pins
> etc when migrating arch/arm/mach-u300/gpio.c and
> arch/arm/plat-nomadik/gpio.c out from the arch/arm hierarchy
> and into drivers/gpio where they belong.
>
> An alternative solution is to implement generic function pointers
> for these things in struct gpio_chip, which I'm happy to do.
> Beware that it'll be quite a number of enumerators for all the
> funky pullup/pulldown modes people have, and for the sleep modes
> alike.
>
> Yours,
> Linus Walleij
> ---
>  drivers/gpio/gpiolib.c     |    2 +-
>  include/asm-generic/gpio.h |    1 +
>  2 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 36a2974..af219bd 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -112,7 +112,7 @@ static int gpio_ensure_requested(struct gpio_desc *desc, unsigned offset)
>  }
>
>  /* caller holds gpio_lock *OR* gpio is marked as requested */
> -static inline struct gpio_chip *gpio_to_chip(unsigned gpio)
> +struct gpio_chip *gpio_to_chip(unsigned gpio)
>  {
>        return gpio_desc[gpio].chip;
>  }
> diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
> index ff5c660..5a4d219 100644
> --- a/include/asm-generic/gpio.h
> +++ b/include/asm-generic/gpio.h
> @@ -132,6 +132,7 @@ struct gpio_chip {
>  #endif
>  };
>
> +extern struct gpio_chip *gpio_to_chip(unsigned gpio);
>  extern const char *gpiochip_is_requested(struct gpio_chip *chip,
>                        unsigned offset);
>  extern int __must_check gpiochip_reserve(int start, int ngpio);
> --
> 1.7.4.4
>
>



-- 
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