Messages in this thread |  | | | Date | Sat, 29 Dec 2007 08:10:23 +0100 | | From | Sam Ravnborg <> | | Subject | Re: [patch 2.6.24-rc6-mm 2/9] gpiolib: add gpio provider infrastructure |
Hi David.
> +/* Warn when drivers omit gpio_request() calls -- legal but ill-advised
> + * when setting direction, and otherwise illegal. Until board setup code
> + * and drivers use explicit requests everywhere (which won't happen when
> + * those calls have no teeth) we can't avoid autorequesting. This nag
> + * message should motivate switching to explicit requests...
> + */
> +static void gpio_ensure_requested(struct gpio_desc *desc)
> +{
> + if (test_and_set_bit(FLAG_REQUESTED, &desc->flags) == 0) {
> + pr_warning("GPIO-%d autorequested\n", (int)(desc - gpio_desc));
> +#ifdef CONFIG_DEBUG_FS
> + desc->label = "[auto]";
> +#endif
> + }
For this an the other setters of desc->label a small helper function
would be better. The helper function could then contain the necessary
ifdef in only one place.
> --- at91.orig/include/asm-generic/gpio.h
> +++ at91/include/asm-generic/gpio.h
> +
> +extern const char *gpiochip_is_requested(struct gpio_chip *chip,
> + unsigned offset);
> +
> +/* add/remove chips */
> +extern int gpiochip_add(struct gpio_chip *chip);
> +extern int __must_check gpiochip_remove(struct gpio_chip *chip);
The use of "extern" is not needed in .h files for function prototypes.
Sam
|  |