Re: [patch 2.6.24-rc6-mm 2/9] gpiolib: add gpio provider infrastructure

From: Sam Ravnborg
Date: Sat Dec 29 2007 - 02:10:32 EST


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/