gpio: remove const modifier from gpiod_get_direction()
authorAlexandre Courbot <acourbot@nvidia.com>
Tue, 25 Nov 2014 08:16:31 +0000 (17:16 +0900)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 28 Nov 2014 13:43:36 +0000 (14:43 +0100)
commit8e53b0f190af2954309bbad76a78177ead15d824
tree51c650de7dbdb9672c3cba25a6bf03baaf033137
parent14e85c0e69d5c7fdbd963edbbec1dc5cdd385200
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>
drivers/gpio/gpiolib-sysfs.c
drivers/gpio/gpiolib.c
include/linux/gpio/consumer.h