]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
leds: tca6507: use gpiochip data pointer
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 8 Dec 2015 15:42:58 +0000 (16:42 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 6 Jan 2016 23:11:20 +0000 (00:11 +0100)
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: Riku Voipio <riku.voipio@iki.fi>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: linux-leds@vger.kernel.org
Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/leds/leds-tca6507.c

index 75529a24a61525d5705b1d2b4c37e6da48a1788b..c548ea10f0f036648d1d357f998641551ff3f2a6 100644 (file)
@@ -603,7 +603,7 @@ static int tca6507_blink_set(struct led_classdev *led_cdev,
 static void tca6507_gpio_set_value(struct gpio_chip *gc,
                                   unsigned offset, int val)
 {
-       struct tca6507_chip *tca = container_of(gc, struct tca6507_chip, gpio);
+       struct tca6507_chip *tca = gpiochip_get_data(gc);
        unsigned long flags;
 
        spin_lock_irqsave(&tca->lock, flags);
@@ -655,7 +655,7 @@ static int tca6507_probe_gpios(struct i2c_client *client,
 #ifdef CONFIG_OF_GPIO
        tca->gpio.of_node = of_node_get(client->dev.of_node);
 #endif
-       err = gpiochip_add(&tca->gpio);
+       err = gpiochip_add_data(&tca->gpio, tca);
        if (err) {
                tca->gpio.ngpio = 0;
                return err;