diff options
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-tps6586x.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/gpio/gpio-tps6586x.c b/drivers/gpio/gpio-tps6586x.c index 89b2249100b0..87de5486a29e 100644 --- a/drivers/gpio/gpio-tps6586x.c +++ b/drivers/gpio/gpio-tps6586x.c | |||
@@ -38,14 +38,9 @@ struct tps6586x_gpio { | |||
38 | struct device *parent; | 38 | struct device *parent; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | static inline struct tps6586x_gpio *to_tps6586x_gpio(struct gpio_chip *chip) | ||
42 | { | ||
43 | return container_of(chip, struct tps6586x_gpio, gpio_chip); | ||
44 | } | ||
45 | |||
46 | static int tps6586x_gpio_get(struct gpio_chip *gc, unsigned offset) | 41 | static int tps6586x_gpio_get(struct gpio_chip *gc, unsigned offset) |
47 | { | 42 | { |
48 | struct tps6586x_gpio *tps6586x_gpio = to_tps6586x_gpio(gc); | 43 | struct tps6586x_gpio *tps6586x_gpio = gpiochip_get_data(gc); |
49 | uint8_t val; | 44 | uint8_t val; |
50 | int ret; | 45 | int ret; |
51 | 46 | ||
@@ -59,7 +54,7 @@ static int tps6586x_gpio_get(struct gpio_chip *gc, unsigned offset) | |||
59 | static void tps6586x_gpio_set(struct gpio_chip *gc, unsigned offset, | 54 | static void tps6586x_gpio_set(struct gpio_chip *gc, unsigned offset, |
60 | int value) | 55 | int value) |
61 | { | 56 | { |
62 | struct tps6586x_gpio *tps6586x_gpio = to_tps6586x_gpio(gc); | 57 | struct tps6586x_gpio *tps6586x_gpio = gpiochip_get_data(gc); |
63 | 58 | ||
64 | tps6586x_update(tps6586x_gpio->parent, TPS6586X_GPIOSET2, | 59 | tps6586x_update(tps6586x_gpio->parent, TPS6586X_GPIOSET2, |
65 | value << offset, 1 << offset); | 60 | value << offset, 1 << offset); |
@@ -68,7 +63,7 @@ static void tps6586x_gpio_set(struct gpio_chip *gc, unsigned offset, | |||
68 | static int tps6586x_gpio_output(struct gpio_chip *gc, unsigned offset, | 63 | static int tps6586x_gpio_output(struct gpio_chip *gc, unsigned offset, |
69 | int value) | 64 | int value) |
70 | { | 65 | { |
71 | struct tps6586x_gpio *tps6586x_gpio = to_tps6586x_gpio(gc); | 66 | struct tps6586x_gpio *tps6586x_gpio = gpiochip_get_data(gc); |
72 | uint8_t val, mask; | 67 | uint8_t val, mask; |
73 | 68 | ||
74 | tps6586x_gpio_set(gc, offset, value); | 69 | tps6586x_gpio_set(gc, offset, value); |
@@ -82,7 +77,7 @@ static int tps6586x_gpio_output(struct gpio_chip *gc, unsigned offset, | |||
82 | 77 | ||
83 | static int tps6586x_gpio_to_irq(struct gpio_chip *gc, unsigned offset) | 78 | static int tps6586x_gpio_to_irq(struct gpio_chip *gc, unsigned offset) |
84 | { | 79 | { |
85 | struct tps6586x_gpio *tps6586x_gpio = to_tps6586x_gpio(gc); | 80 | struct tps6586x_gpio *tps6586x_gpio = gpiochip_get_data(gc); |
86 | 81 | ||
87 | return tps6586x_irq_get_virq(tps6586x_gpio->parent, | 82 | return tps6586x_irq_get_virq(tps6586x_gpio->parent, |
88 | TPS6586X_INT_PLDO_0 + offset); | 83 | TPS6586X_INT_PLDO_0 + offset); |
@@ -122,7 +117,7 @@ static int tps6586x_gpio_probe(struct platform_device *pdev) | |||
122 | else | 117 | else |
123 | tps6586x_gpio->gpio_chip.base = -1; | 118 | tps6586x_gpio->gpio_chip.base = -1; |
124 | 119 | ||
125 | ret = gpiochip_add(&tps6586x_gpio->gpio_chip); | 120 | ret = gpiochip_add_data(&tps6586x_gpio->gpio_chip, tps6586x_gpio); |
126 | if (ret < 0) { | 121 | if (ret < 0) { |
127 | dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret); | 122 | dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret); |
128 | return ret; | 123 | return ret; |