summaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-12-07 16:34:33 +0300
committerLinus Walleij <linus.walleij@linaro.org>2016-01-05 13:21:14 +0300
commitc63b30b08971ad5894061841a2c7f012eea747c0 (patch)
treebd0a9482506322502b20f7008e3982697a665fcc /drivers/gpio
parentb03c04a0aab1715ca8c501d41f9175a9047ef79f (diff)
downloadlinux-c63b30b08971ad5894061841a2c7f012eea747c0.tar.xz
gpio: stp-xway: use gpiochip data pointer
This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-stp-xway.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-stp-xway.c b/drivers/gpio/gpio-stp-xway.c
index c250f21b9e40..d11dd48570b2 100644
--- a/drivers/gpio/gpio-stp-xway.c
+++ b/drivers/gpio/gpio-stp-xway.c
@@ -100,8 +100,7 @@ struct xway_stp {
*/
static void xway_stp_set(struct gpio_chip *gc, unsigned gpio, int val)
{
- struct xway_stp *chip =
- container_of(gc, struct xway_stp, gc);
+ struct xway_stp *chip = gpiochip_get_data(gc);
if (val)
chip->shadow |= BIT(gpio);
@@ -135,8 +134,7 @@ static int xway_stp_dir_out(struct gpio_chip *gc, unsigned gpio, int val)
*/
static int xway_stp_request(struct gpio_chip *gc, unsigned gpio)
{
- struct xway_stp *chip =
- container_of(gc, struct xway_stp, gc);
+ struct xway_stp *chip = gpiochip_get_data(gc);
if ((gpio < 8) && (chip->reserved & BIT(gpio))) {
dev_err(gc->parent, "GPIO %d is driven by hardware\n", gpio);
@@ -260,7 +258,7 @@ static int xway_stp_probe(struct platform_device *pdev)
ret = xway_stp_hw_init(chip);
if (!ret)
- ret = gpiochip_add(&chip->gc);
+ ret = gpiochip_add_data(&chip->gc, chip);
if (!ret)
dev_info(&pdev->dev, "Init done\n");