diff options
author | Alexandre Courbot <acourbot@nvidia.com> | 2014-11-25 17:16:31 +0900 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-11-28 14:43:36 +0100 |
commit | 8e53b0f190af2954309bbad76a78177ead15d824 (patch) | |
tree | 51c650de7dbdb9672c3cba25a6bf03baaf033137 /include/linux/gpio | |
parent | 14e85c0e69d5c7fdbd963edbbec1dc5cdd385200 (diff) | |
download | lwn-8e53b0f190af2954309bbad76a78177ead15d824.tar.gz lwn-8e53b0f190af2954309bbad76a78177ead15d824.zip |
gpio: remove const modifier from gpiod_get_direction()
Although gpiod_get_direction() can be considered side-effect free for
consumers, its internals involve setting or clearing bits in the
affected GPIO descriptor, for which we need to force-cast the const
descriptor variable to non-const. This could lead to incorrect behavior
if the compiler decides to optimize here, so remove this const
attribute. The intent is to make gpiod_get_direction() private anyway,
so it does not really matter.
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'include/linux/gpio')
-rw-r--r-- | include/linux/gpio/consumer.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index 83c0a61c605d..d54d158ca327 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -66,7 +66,7 @@ __devm_gpiod_get_index_optional(struct device *dev, const char *con_id, unsigned int index, enum gpiod_flags flags); void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); -int gpiod_get_direction(const struct gpio_desc *desc); +int gpiod_get_direction(struct gpio_desc *desc); int gpiod_direction_input(struct gpio_desc *desc); int gpiod_direction_output(struct gpio_desc *desc, int value); int gpiod_direction_output_raw(struct gpio_desc *desc, int value); |