aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-mcp23s08.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-12-07 04:09:36 -0500
committerLinus Walleij <linus.walleij@linaro.org>2016-01-05 05:21:08 -0500
commit9e03cf0b12f19ef5dd8f113350e26b6d425ebbcb (patch)
tree2a6e76764d15b2f25c1769206b266d9d3c6e21ff /drivers/gpio/gpio-mcp23s08.c
parentcf90c9e35be883d8ebcca3d4a2b1044a234f24d8 (diff)
gpio: mcp: 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: Sonic Zhang <sonic.zhang@analog.com> Acked-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-mcp23s08.c')
-rw-r--r--drivers/gpio/gpio-mcp23s08.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
index 13cace0ca6f7..c767879e4dd9 100644
--- a/drivers/gpio/gpio-mcp23s08.c
+++ b/drivers/gpio/gpio-mcp23s08.c
@@ -269,7 +269,7 @@ static const struct mcp23s08_ops mcp23s17_ops = {
269 269
270static int mcp23s08_direction_input(struct gpio_chip *chip, unsigned offset) 270static int mcp23s08_direction_input(struct gpio_chip *chip, unsigned offset)
271{ 271{
272 struct mcp23s08 *mcp = container_of(chip, struct mcp23s08, chip); 272 struct mcp23s08 *mcp = gpiochip_get_data(chip);
273 int status; 273 int status;
274 274
275 mutex_lock(&mcp->lock); 275 mutex_lock(&mcp->lock);
@@ -281,7 +281,7 @@ static int mcp23s08_direction_input(struct gpio_chip *chip, unsigned offset)
281 281
282static int mcp23s08_get(struct gpio_chip *chip, unsigned offset) 282static int mcp23s08_get(struct gpio_chip *chip, unsigned offset)
283{ 283{
284 struct mcp23s08 *mcp = container_of(chip, struct mcp23s08, chip); 284 struct mcp23s08 *mcp = gpiochip_get_data(chip);
285 int status; 285 int status;
286 286
287 mutex_lock(&mcp->lock); 287 mutex_lock(&mcp->lock);
@@ -312,7 +312,7 @@ static int __mcp23s08_set(struct mcp23s08 *mcp, unsigned mask, int value)
312 312
313static void mcp23s08_set(struct gpio_chip *chip, unsigned offset, int value) 313static void mcp23s08_set(struct gpio_chip *chip, unsigned offset, int value)
314{ 314{
315 struct mcp23s08 *mcp = container_of(chip, struct mcp23s08, chip); 315 struct mcp23s08 *mcp = gpiochip_get_data(chip);
316 unsigned mask = 1 << offset; 316 unsigned mask = 1 << offset;
317 317
318 mutex_lock(&mcp->lock); 318 mutex_lock(&mcp->lock);
@@ -323,7 +323,7 @@ static void mcp23s08_set(struct gpio_chip *chip, unsigned offset, int value)
323static int 323static int
324mcp23s08_direction_output(struct gpio_chip *chip, unsigned offset, int value) 324mcp23s08_direction_output(struct gpio_chip *chip, unsigned offset, int value)
325{ 325{
326 struct mcp23s08 *mcp = container_of(chip, struct mcp23s08, chip); 326 struct mcp23s08 *mcp = gpiochip_get_data(chip);
327 unsigned mask = 1 << offset; 327 unsigned mask = 1 << offset;
328 int status; 328 int status;
329 329
@@ -377,7 +377,7 @@ static irqreturn_t mcp23s08_irq(int irq, void *data)
377 377
378static int mcp23s08_gpio_to_irq(struct gpio_chip *chip, unsigned offset) 378static int mcp23s08_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
379{ 379{
380 struct mcp23s08 *mcp = container_of(chip, struct mcp23s08, chip); 380 struct mcp23s08 *mcp = gpiochip_get_data(chip);
381 381
382 return irq_find_mapping(mcp->irq_domain, offset); 382 return irq_find_mapping(mcp->irq_domain, offset);
383} 383}
@@ -544,7 +544,7 @@ static void mcp23s08_dbg_show(struct seq_file *s, struct gpio_chip *chip)
544 int t; 544 int t;
545 unsigned mask; 545 unsigned mask;
546 546
547 mcp = container_of(chip, struct mcp23s08, chip); 547 mcp = gpiochip_get_data(chip);
548 548
549 /* NOTE: we only handle one bank for now ... */ 549 /* NOTE: we only handle one bank for now ... */
550 bank = '0' + ((mcp->addr >> 1) & 0x7); 550 bank = '0' + ((mcp->addr >> 1) & 0x7);
@@ -704,7 +704,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
704 goto fail; 704 goto fail;
705 } 705 }
706 706
707 status = gpiochip_add(&mcp->chip); 707 status = gpiochip_add_data(&mcp->chip, mcp);
708 if (status < 0) 708 if (status < 0)
709 goto fail; 709 goto fail;
710 710