aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2016-03-30 04:48:06 -0400
committerLee Jones <lee.jones@linaro.org>2016-04-19 02:58:44 -0400
commit4e125f62b73dffde17f4c53155654623ab2a9855 (patch)
tree57c7683c54f39022467657c3e0886fcf06727a78 /drivers/mfd
parent3a504105f0e4cf32464d596f3b30d23dbfd76520 (diff)
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>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/tc6393xb.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
index 1ecbfa40d1b3..d42d322ac7ca 100644
--- a/drivers/mfd/tc6393xb.c
+++ b/drivers/mfd/tc6393xb.c
@@ -24,7 +24,7 @@
24#include <linux/mfd/core.h> 24#include <linux/mfd/core.h>
25#include <linux/mfd/tmio.h> 25#include <linux/mfd/tmio.h>
26#include <linux/mfd/tc6393xb.h> 26#include <linux/mfd/tc6393xb.h>
27#include <linux/gpio.h> 27#include <linux/gpio/driver.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29 29
30#define SCR_REVID 0x08 /* b Revision ID */ 30#define SCR_REVID 0x08 /* b Revision ID */
@@ -434,7 +434,7 @@ static struct mfd_cell tc6393xb_cells[] = {
434static int tc6393xb_gpio_get(struct gpio_chip *chip, 434static int tc6393xb_gpio_get(struct gpio_chip *chip,
435 unsigned offset) 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 /* XXX: does dsr also represent inputs? */ 439 /* XXX: does dsr also represent inputs? */
440 return !!(tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8)) 440 return !!(tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8))
@@ -444,7 +444,7 @@ static int tc6393xb_gpio_get(struct gpio_chip *chip,
444static void __tc6393xb_gpio_set(struct gpio_chip *chip, 444static void __tc6393xb_gpio_set(struct gpio_chip *chip,
445 unsigned offset, int value) 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 u8 dsr; 448 u8 dsr;
449 449
450 dsr = tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8)); 450 dsr = tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8));
@@ -459,7 +459,7 @@ static void __tc6393xb_gpio_set(struct gpio_chip *chip,
459static void tc6393xb_gpio_set(struct gpio_chip *chip, 459static void tc6393xb_gpio_set(struct gpio_chip *chip,
460 unsigned offset, int value) 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 unsigned long flags; 463 unsigned long flags;
464 464
465 spin_lock_irqsave(&tc6393xb->lock, flags); 465 spin_lock_irqsave(&tc6393xb->lock, flags);
@@ -472,7 +472,7 @@ static void tc6393xb_gpio_set(struct gpio_chip *chip,
472static int tc6393xb_gpio_direction_input(struct gpio_chip *chip, 472static int tc6393xb_gpio_direction_input(struct gpio_chip *chip,
473 unsigned offset) 473 unsigned offset)
474{ 474{
475 struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); 475 struct tc6393xb *tc6393xb = gpiochip_get_data(chip);
476 unsigned long flags; 476 unsigned long flags;
477 u8 doecr; 477 u8 doecr;
478 478
@@ -490,7 +490,7 @@ static int tc6393xb_gpio_direction_input(struct gpio_chip *chip,
490static int tc6393xb_gpio_direction_output(struct gpio_chip *chip, 490static int tc6393xb_gpio_direction_output(struct gpio_chip *chip,
491 unsigned offset, int value) 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 unsigned long flags; 494 unsigned long flags;
495 u8 doecr; 495 u8 doecr;
496 496
@@ -517,7 +517,7 @@ static int tc6393xb_register_gpio(struct tc6393xb *tc6393xb, int gpio_base)
517 tc6393xb->gpio.direction_input = tc6393xb_gpio_direction_input; 517 tc6393xb->gpio.direction_input = tc6393xb_gpio_direction_input;
518 tc6393xb->gpio.direction_output = tc6393xb_gpio_direction_output; 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/*--------------------------------------------------------------------------*/