diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-12-08 02:26:34 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-01-05 08:14:50 -0500 |
commit | 827c93dae7275aaf7bfc2f1b41e1e6845751dda9 (patch) | |
tree | eb0071751d2f4b7f79c1ec54fd7d42d48ea3bad1 /drivers/pinctrl | |
parent | acfd4c633aa394ac0323bdb2be95f5b587c0ffbd (diff) |
pinctrl: meson: 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: Beniamino Galvani <b.galvani@gmail.com>
Cc: Carlo Caione <carlo@endlessm.com>
Cc: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/meson/pinctrl-meson.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c index 4b5f6829144d..50cab27c64d4 100644 --- a/drivers/pinctrl/meson/pinctrl-meson.c +++ b/drivers/pinctrl/meson/pinctrl-meson.c | |||
@@ -448,11 +448,6 @@ static const struct pinconf_ops meson_pinconf_ops = { | |||
448 | .is_generic = true, | 448 | .is_generic = true, |
449 | }; | 449 | }; |
450 | 450 | ||
451 | static inline struct meson_domain *to_meson_domain(struct gpio_chip *chip) | ||
452 | { | ||
453 | return container_of(chip, struct meson_domain, chip); | ||
454 | } | ||
455 | |||
456 | static int meson_gpio_request(struct gpio_chip *chip, unsigned gpio) | 451 | static int meson_gpio_request(struct gpio_chip *chip, unsigned gpio) |
457 | { | 452 | { |
458 | return pinctrl_request_gpio(chip->base + gpio); | 453 | return pinctrl_request_gpio(chip->base + gpio); |
@@ -460,14 +455,14 @@ static int meson_gpio_request(struct gpio_chip *chip, unsigned gpio) | |||
460 | 455 | ||
461 | static void meson_gpio_free(struct gpio_chip *chip, unsigned gpio) | 456 | static void meson_gpio_free(struct gpio_chip *chip, unsigned gpio) |
462 | { | 457 | { |
463 | struct meson_domain *domain = to_meson_domain(chip); | 458 | struct meson_domain *domain = gpiochip_get_data(chip); |
464 | 459 | ||
465 | pinctrl_free_gpio(domain->data->pin_base + gpio); | 460 | pinctrl_free_gpio(domain->data->pin_base + gpio); |
466 | } | 461 | } |
467 | 462 | ||
468 | static int meson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) | 463 | static int meson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) |
469 | { | 464 | { |
470 | struct meson_domain *domain = to_meson_domain(chip); | 465 | struct meson_domain *domain = gpiochip_get_data(chip); |
471 | unsigned int reg, bit, pin; | 466 | unsigned int reg, bit, pin; |
472 | struct meson_bank *bank; | 467 | struct meson_bank *bank; |
473 | int ret; | 468 | int ret; |
@@ -485,7 +480,7 @@ static int meson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) | |||
485 | static int meson_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, | 480 | static int meson_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, |
486 | int value) | 481 | int value) |
487 | { | 482 | { |
488 | struct meson_domain *domain = to_meson_domain(chip); | 483 | struct meson_domain *domain = gpiochip_get_data(chip); |
489 | unsigned int reg, bit, pin; | 484 | unsigned int reg, bit, pin; |
490 | struct meson_bank *bank; | 485 | struct meson_bank *bank; |
491 | int ret; | 486 | int ret; |
@@ -507,7 +502,7 @@ static int meson_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, | |||
507 | 502 | ||
508 | static void meson_gpio_set(struct gpio_chip *chip, unsigned gpio, int value) | 503 | static void meson_gpio_set(struct gpio_chip *chip, unsigned gpio, int value) |
509 | { | 504 | { |
510 | struct meson_domain *domain = to_meson_domain(chip); | 505 | struct meson_domain *domain = gpiochip_get_data(chip); |
511 | unsigned int reg, bit, pin; | 506 | unsigned int reg, bit, pin; |
512 | struct meson_bank *bank; | 507 | struct meson_bank *bank; |
513 | int ret; | 508 | int ret; |
@@ -524,7 +519,7 @@ static void meson_gpio_set(struct gpio_chip *chip, unsigned gpio, int value) | |||
524 | 519 | ||
525 | static int meson_gpio_get(struct gpio_chip *chip, unsigned gpio) | 520 | static int meson_gpio_get(struct gpio_chip *chip, unsigned gpio) |
526 | { | 521 | { |
527 | struct meson_domain *domain = to_meson_domain(chip); | 522 | struct meson_domain *domain = gpiochip_get_data(chip); |
528 | unsigned int reg, bit, val, pin; | 523 | unsigned int reg, bit, val, pin; |
529 | struct meson_bank *bank; | 524 | struct meson_bank *bank; |
530 | int ret; | 525 | int ret; |
@@ -575,7 +570,7 @@ static int meson_gpiolib_register(struct meson_pinctrl *pc) | |||
575 | domain->chip.of_node = domain->of_node; | 570 | domain->chip.of_node = domain->of_node; |
576 | domain->chip.of_gpio_n_cells = 2; | 571 | domain->chip.of_gpio_n_cells = 2; |
577 | 572 | ||
578 | ret = gpiochip_add(&domain->chip); | 573 | ret = gpiochip_add_data(&domain->chip, domain); |
579 | if (ret) { | 574 | if (ret) { |
580 | dev_err(pc->dev, "can't add gpio chip %s\n", | 575 | dev_err(pc->dev, "can't add gpio chip %s\n", |
581 | domain->data->name); | 576 | domain->data->name); |