diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-12-03 09:31:48 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-01-05 05:21:01 -0500 |
commit | 1f36bec53f045c72707b40723d70d39ba1099122 (patch) | |
tree | c09600722a1f7fbfe32317c97bb22c30c3b56452 /drivers/gpio/gpio-104-idi-48.c | |
parent | 0f4630f3720e7e6e921bf525c8357fea7ef3dbab (diff) |
gpio: 104-idi-48: 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().
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-104-idi-48.c')
-rw-r--r-- | drivers/gpio/gpio-104-idi-48.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/gpio/gpio-104-idi-48.c b/drivers/gpio/gpio-104-idi-48.c index 296dbd4cadd9..52eed328ce99 100644 --- a/drivers/gpio/gpio-104-idi-48.c +++ b/drivers/gpio/gpio-104-idi-48.c | |||
@@ -64,14 +64,9 @@ static int idi_48_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | |||
64 | return 0; | 64 | return 0; |
65 | } | 65 | } |
66 | 66 | ||
67 | static struct idi_48_gpio *to_idi48gpio(struct gpio_chip *gc) | ||
68 | { | ||
69 | return container_of(gc, struct idi_48_gpio, chip); | ||
70 | } | ||
71 | |||
72 | static int idi_48_gpio_get(struct gpio_chip *chip, unsigned offset) | 67 | static int idi_48_gpio_get(struct gpio_chip *chip, unsigned offset) |
73 | { | 68 | { |
74 | struct idi_48_gpio *const idi48gpio = to_idi48gpio(chip); | 69 | struct idi_48_gpio *const idi48gpio = gpiochip_get_data(chip); |
75 | unsigned i; | 70 | unsigned i; |
76 | const unsigned register_offset[6] = { 0, 1, 2, 4, 5, 6 }; | 71 | const unsigned register_offset[6] = { 0, 1, 2, 4, 5, 6 }; |
77 | unsigned base_offset; | 72 | unsigned base_offset; |
@@ -96,7 +91,7 @@ static void idi_48_irq_ack(struct irq_data *data) | |||
96 | static void idi_48_irq_mask(struct irq_data *data) | 91 | static void idi_48_irq_mask(struct irq_data *data) |
97 | { | 92 | { |
98 | struct gpio_chip *chip = irq_data_get_irq_chip_data(data); | 93 | struct gpio_chip *chip = irq_data_get_irq_chip_data(data); |
99 | struct idi_48_gpio *const idi48gpio = to_idi48gpio(chip); | 94 | struct idi_48_gpio *const idi48gpio = gpiochip_get_data(chip); |
100 | const unsigned offset = irqd_to_hwirq(data); | 95 | const unsigned offset = irqd_to_hwirq(data); |
101 | unsigned i; | 96 | unsigned i; |
102 | unsigned mask; | 97 | unsigned mask; |
@@ -127,7 +122,7 @@ static void idi_48_irq_mask(struct irq_data *data) | |||
127 | static void idi_48_irq_unmask(struct irq_data *data) | 122 | static void idi_48_irq_unmask(struct irq_data *data) |
128 | { | 123 | { |
129 | struct gpio_chip *chip = irq_data_get_irq_chip_data(data); | 124 | struct gpio_chip *chip = irq_data_get_irq_chip_data(data); |
130 | struct idi_48_gpio *const idi48gpio = to_idi48gpio(chip); | 125 | struct idi_48_gpio *const idi48gpio = gpiochip_get_data(chip); |
131 | const unsigned offset = irqd_to_hwirq(data); | 126 | const unsigned offset = irqd_to_hwirq(data); |
132 | unsigned i; | 127 | unsigned i; |
133 | unsigned mask; | 128 | unsigned mask; |
@@ -255,7 +250,7 @@ static int __init idi_48_probe(struct platform_device *pdev) | |||
255 | 250 | ||
256 | dev_set_drvdata(dev, idi48gpio); | 251 | dev_set_drvdata(dev, idi48gpio); |
257 | 252 | ||
258 | err = gpiochip_add(&idi48gpio->chip); | 253 | err = gpiochip_add_data(&idi48gpio->chip, idi48gpio); |
259 | if (err) { | 254 | if (err) { |
260 | dev_err(dev, "GPIO registering failed (%d)\n", err); | 255 | dev_err(dev, "GPIO registering failed (%d)\n", err); |
261 | goto err_gpio_register; | 256 | goto err_gpio_register; |