Re: [PATCH] gpio: Make gpio_{request,free}_array gpio array parameter const

From: Eric Miao
Date: Sat Jan 29 2011 - 11:26:18 EST


On Saturday, January 29, 2011, Lars-Peter Clausen <lars@xxxxxxxxxx> wrote:
> gpio_{request,free}_array should not (and do not) modify the passed gpio array,
> so make the parameter const.
>
> Signed-off-by: Lars-Peter Clausen <lars@xxxxxxxxxx>

Acked-by: Eric Miao <eric.y.miao@xxxxxxxxx>

> ---
> Âdrivers/gpio/gpiolib.c   |  Â4 ++--
> Âinclude/asm-generic/gpio.h | Â Â4 ++--
> Âinclude/linux/gpio.h    |  Â4 ++--
> Â3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 649550e..27016c4 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -1293,7 +1293,7 @@ EXPORT_SYMBOL_GPL(gpio_request_one);
> Â* @array: Â Â array of the 'struct gpio'
> Â* @num: Â Â Â how many GPIOs in the array
> Â*/
> -int gpio_request_array(struct gpio *array, size_t num)
> +int gpio_request_array(const struct gpio *array, size_t num)
> Â{
> Â Â Â Âint i, err;
>
> @@ -1316,7 +1316,7 @@ EXPORT_SYMBOL_GPL(gpio_request_array);
> Â* @array: Â Â array of the 'struct gpio'
> Â* @num: Â Â Â how many GPIOs in the array
> Â*/
> -void gpio_free_array(struct gpio *array, size_t num)
> +void gpio_free_array(const struct gpio *array, size_t num)
> Â{
> Â Â Â Âwhile (num--)
> Â Â Â Â Â Â Â Âgpio_free((array++)->gpio);
> diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
> index ff5c660..05119e7 100644
> --- a/include/asm-generic/gpio.h
> +++ b/include/asm-generic/gpio.h
> @@ -193,8 +193,8 @@ struct gpio {
> Â};
>
> Âextern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
> -extern int gpio_request_array(struct gpio *array, size_t num);
> -extern void gpio_free_array(struct gpio *array, size_t num);
> +extern int gpio_request_array(const struct gpio *array, size_t num);
> +extern void gpio_free_array(const struct gpio *array, size_t num);
>
> Â#ifdef CONFIG_GPIO_SYSFS
>
> diff --git a/include/linux/gpio.h b/include/linux/gpio.h
> index 32720ba..b2b610f 100644
> --- a/include/linux/gpio.h
> +++ b/include/linux/gpio.h
> @@ -41,7 +41,7 @@ static inline int gpio_request_one(unsigned gpio,
> Â Â Â Âreturn -ENOSYS;
> Â}
>
> -static inline int gpio_request_array(struct gpio *array, size_t num)
> +static inline int gpio_request_array(const struct gpio *array, size_t num)
> Â{
> Â Â Â Âreturn -ENOSYS;
> Â}
> @@ -54,7 +54,7 @@ static inline void gpio_free(unsigned gpio)
> Â Â Â ÂWARN_ON(1);
> Â}
>
> -static inline void gpio_free_array(struct gpio *array, size_t num)
> +static inline void gpio_free_array(const struct gpio *array, size_t num)
> Â{
> Â Â Â Âmight_sleep();
>
> --
> 1.7.2.3
>
>
--
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/