Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: tc6393xb: 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: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Linus Walleij and committed by
Lee Jones
4e125f62 3a504105

+7 -7
+7 -7
drivers/mfd/tc6393xb.c
··· 24 24 #include <linux/mfd/core.h> 25 25 #include <linux/mfd/tmio.h> 26 26 #include <linux/mfd/tc6393xb.h> 27 - #include <linux/gpio.h> 27 + #include <linux/gpio/driver.h> 28 28 #include <linux/slab.h> 29 29 30 30 #define SCR_REVID 0x08 /* b Revision ID */ ··· 434 434 static int tc6393xb_gpio_get(struct gpio_chip *chip, 435 435 unsigned offset) 436 436 { 437 - struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); 437 + struct tc6393xb *tc6393xb = gpiochip_get_data(chip); 438 438 439 439 /* XXX: does dsr also represent inputs? */ 440 440 return !!(tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8)) ··· 444 444 static void __tc6393xb_gpio_set(struct gpio_chip *chip, 445 445 unsigned offset, int value) 446 446 { 447 - struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); 447 + struct tc6393xb *tc6393xb = gpiochip_get_data(chip); 448 448 u8 dsr; 449 449 450 450 dsr = tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8)); ··· 459 459 static void tc6393xb_gpio_set(struct gpio_chip *chip, 460 460 unsigned offset, int value) 461 461 { 462 - struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); 462 + struct tc6393xb *tc6393xb = gpiochip_get_data(chip); 463 463 unsigned long flags; 464 464 465 465 spin_lock_irqsave(&tc6393xb->lock, flags); ··· 472 472 static int tc6393xb_gpio_direction_input(struct gpio_chip *chip, 473 473 unsigned offset) 474 474 { 475 - struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); 475 + struct tc6393xb *tc6393xb = gpiochip_get_data(chip); 476 476 unsigned long flags; 477 477 u8 doecr; 478 478 ··· 490 490 static int tc6393xb_gpio_direction_output(struct gpio_chip *chip, 491 491 unsigned offset, int value) 492 492 { 493 - struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); 493 + struct tc6393xb *tc6393xb = gpiochip_get_data(chip); 494 494 unsigned long flags; 495 495 u8 doecr; 496 496 ··· 517 517 tc6393xb->gpio.direction_input = tc6393xb_gpio_direction_input; 518 518 tc6393xb->gpio.direction_output = tc6393xb_gpio_direction_output; 519 519 520 - return gpiochip_add(&tc6393xb->gpio); 520 + return gpiochip_add_data(&tc6393xb->gpio, tc6393xb); 521 521 } 522 522 523 523 /*--------------------------------------------------------------------------*/