* [PATCH] gpio: Make gpio_{request,free}_array gpio array parameter const
@ 2011-01-29 15:21 Lars-Peter Clausen
2011-01-29 16:26 ` Eric Miao
2011-01-30 18:49 ` Wolfram Sang
0 siblings, 2 replies; 4+ messages in thread
From: Lars-Peter Clausen @ 2011-01-29 15:21 UTC (permalink / raw)
To: David Brownell; +Cc: Eric Miao, Andrew Morton, linux-kernel, Lars-Peter Clausen
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@metafoo.de>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: Make gpio_{request,free}_array gpio array parameter const
2011-01-29 15:21 [PATCH] gpio: Make gpio_{request,free}_array gpio array parameter const Lars-Peter Clausen
@ 2011-01-29 16:26 ` Eric Miao
2011-01-30 18:49 ` Wolfram Sang
1 sibling, 0 replies; 4+ messages in thread
From: Eric Miao @ 2011-01-29 16:26 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: David Brownell, Andrew Morton, linux-kernel
On Saturday, January 29, 2011, Lars-Peter Clausen <lars@metafoo.de> 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@metafoo.de>
Acked-by: Eric Miao <eric.y.miao@gmail.com>
> ---
> 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
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: Make gpio_{request,free}_array gpio array parameter const
2011-01-29 15:21 [PATCH] gpio: Make gpio_{request,free}_array gpio array parameter const Lars-Peter Clausen
2011-01-29 16:26 ` Eric Miao
@ 2011-01-30 18:49 ` Wolfram Sang
2011-01-30 19:07 ` Lars-Peter Clausen
1 sibling, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2011-01-30 18:49 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: David Brownell, Eric Miao, Andrew Morton, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 530 bytes --]
On Sat, Jan 29, 2011 at 04:21:21PM +0100, Lars-Peter Clausen 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@metafoo.de>
Looks good to me. What about the users of these calls (luckily there don't seem
to be many)?
Kind regards,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: Make gpio_{request,free}_array gpio array parameter const
2011-01-30 18:49 ` Wolfram Sang
@ 2011-01-30 19:07 ` Lars-Peter Clausen
0 siblings, 0 replies; 4+ messages in thread
From: Lars-Peter Clausen @ 2011-01-30 19:07 UTC (permalink / raw)
To: Wolfram Sang; +Cc: David Brownell, Eric Miao, Andrew Morton, linux-kernel
On 01/30/2011 07:49 PM, Wolfram Sang wrote:
> On Sat, Jan 29, 2011 at 04:21:21PM +0100, Lars-Peter Clausen 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@metafoo.de>
>
> Looks good to me. What about the users of these calls (luckily there don't seem
> to be many)?
>
> Kind regards,
>
> Wolfram
>
Hi
Well, they could, but don't have to, make their gpio array const now, if it is not
otherwise modified. But I guess that is something for a follow-up patch.
- Lars
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-01-30 19:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-29 15:21 [PATCH] gpio: Make gpio_{request,free}_array gpio array parameter const Lars-Peter Clausen
2011-01-29 16:26 ` Eric Miao
2011-01-30 18:49 ` Wolfram Sang
2011-01-30 19:07 ` Lars-Peter Clausen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.