diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-12-08 03:49:18 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-01-05 08:14:57 -0500 |
commit | fded3f40bf96d14a8c5bc3e4593e7cdc5709ab88 (patch) | |
tree | aba8c4e3665ffcf73ac800ac1ba15f8d48050b17 /drivers/pinctrl | |
parent | 2e862a7bd63f57fcaa4a3a4929f51c56289f1f80 (diff) |
pinctrl: msm: 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: Stephen Boyd <sboyd@codeaurora.org>
Cc: Björn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/qcom/pinctrl-msm.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c index af2a13040898..8777cf083eef 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c | |||
@@ -69,11 +69,6 @@ struct msm_pinctrl { | |||
69 | void __iomem *regs; | 69 | void __iomem *regs; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | static inline struct msm_pinctrl *to_msm_pinctrl(struct gpio_chip *gc) | ||
73 | { | ||
74 | return container_of(gc, struct msm_pinctrl, chip); | ||
75 | } | ||
76 | |||
77 | static int msm_get_groups_count(struct pinctrl_dev *pctldev) | 72 | static int msm_get_groups_count(struct pinctrl_dev *pctldev) |
78 | { | 73 | { |
79 | struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); | 74 | struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); |
@@ -381,7 +376,7 @@ static struct pinctrl_desc msm_pinctrl_desc = { | |||
381 | static int msm_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | 376 | static int msm_gpio_direction_input(struct gpio_chip *chip, unsigned offset) |
382 | { | 377 | { |
383 | const struct msm_pingroup *g; | 378 | const struct msm_pingroup *g; |
384 | struct msm_pinctrl *pctrl = container_of(chip, struct msm_pinctrl, chip); | 379 | struct msm_pinctrl *pctrl = gpiochip_get_data(chip); |
385 | unsigned long flags; | 380 | unsigned long flags; |
386 | u32 val; | 381 | u32 val; |
387 | 382 | ||
@@ -401,7 +396,7 @@ static int msm_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | |||
401 | static int msm_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value) | 396 | static int msm_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value) |
402 | { | 397 | { |
403 | const struct msm_pingroup *g; | 398 | const struct msm_pingroup *g; |
404 | struct msm_pinctrl *pctrl = container_of(chip, struct msm_pinctrl, chip); | 399 | struct msm_pinctrl *pctrl = gpiochip_get_data(chip); |
405 | unsigned long flags; | 400 | unsigned long flags; |
406 | u32 val; | 401 | u32 val; |
407 | 402 | ||
@@ -428,7 +423,7 @@ static int msm_gpio_direction_output(struct gpio_chip *chip, unsigned offset, in | |||
428 | static int msm_gpio_get(struct gpio_chip *chip, unsigned offset) | 423 | static int msm_gpio_get(struct gpio_chip *chip, unsigned offset) |
429 | { | 424 | { |
430 | const struct msm_pingroup *g; | 425 | const struct msm_pingroup *g; |
431 | struct msm_pinctrl *pctrl = container_of(chip, struct msm_pinctrl, chip); | 426 | struct msm_pinctrl *pctrl = gpiochip_get_data(chip); |
432 | u32 val; | 427 | u32 val; |
433 | 428 | ||
434 | g = &pctrl->soc->groups[offset]; | 429 | g = &pctrl->soc->groups[offset]; |
@@ -440,7 +435,7 @@ static int msm_gpio_get(struct gpio_chip *chip, unsigned offset) | |||
440 | static void msm_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 435 | static void msm_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
441 | { | 436 | { |
442 | const struct msm_pingroup *g; | 437 | const struct msm_pingroup *g; |
443 | struct msm_pinctrl *pctrl = container_of(chip, struct msm_pinctrl, chip); | 438 | struct msm_pinctrl *pctrl = gpiochip_get_data(chip); |
444 | unsigned long flags; | 439 | unsigned long flags; |
445 | u32 val; | 440 | u32 val; |
446 | 441 | ||
@@ -468,7 +463,7 @@ static void msm_gpio_dbg_show_one(struct seq_file *s, | |||
468 | unsigned gpio) | 463 | unsigned gpio) |
469 | { | 464 | { |
470 | const struct msm_pingroup *g; | 465 | const struct msm_pingroup *g; |
471 | struct msm_pinctrl *pctrl = container_of(chip, struct msm_pinctrl, chip); | 466 | struct msm_pinctrl *pctrl = gpiochip_get_data(chip); |
472 | unsigned func; | 467 | unsigned func; |
473 | int is_out; | 468 | int is_out; |
474 | int drive; | 469 | int drive; |
@@ -567,7 +562,7 @@ static void msm_gpio_update_dual_edge_pos(struct msm_pinctrl *pctrl, | |||
567 | static void msm_gpio_irq_mask(struct irq_data *d) | 562 | static void msm_gpio_irq_mask(struct irq_data *d) |
568 | { | 563 | { |
569 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); | 564 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); |
570 | struct msm_pinctrl *pctrl = to_msm_pinctrl(gc); | 565 | struct msm_pinctrl *pctrl = gpiochip_get_data(gc); |
571 | const struct msm_pingroup *g; | 566 | const struct msm_pingroup *g; |
572 | unsigned long flags; | 567 | unsigned long flags; |
573 | u32 val; | 568 | u32 val; |
@@ -588,7 +583,7 @@ static void msm_gpio_irq_mask(struct irq_data *d) | |||
588 | static void msm_gpio_irq_unmask(struct irq_data *d) | 583 | static void msm_gpio_irq_unmask(struct irq_data *d) |
589 | { | 584 | { |
590 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); | 585 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); |
591 | struct msm_pinctrl *pctrl = to_msm_pinctrl(gc); | 586 | struct msm_pinctrl *pctrl = gpiochip_get_data(gc); |
592 | const struct msm_pingroup *g; | 587 | const struct msm_pingroup *g; |
593 | unsigned long flags; | 588 | unsigned long flags; |
594 | u32 val; | 589 | u32 val; |
@@ -613,7 +608,7 @@ static void msm_gpio_irq_unmask(struct irq_data *d) | |||
613 | static void msm_gpio_irq_ack(struct irq_data *d) | 608 | static void msm_gpio_irq_ack(struct irq_data *d) |
614 | { | 609 | { |
615 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); | 610 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); |
616 | struct msm_pinctrl *pctrl = to_msm_pinctrl(gc); | 611 | struct msm_pinctrl *pctrl = gpiochip_get_data(gc); |
617 | const struct msm_pingroup *g; | 612 | const struct msm_pingroup *g; |
618 | unsigned long flags; | 613 | unsigned long flags; |
619 | u32 val; | 614 | u32 val; |
@@ -638,7 +633,7 @@ static void msm_gpio_irq_ack(struct irq_data *d) | |||
638 | static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int type) | 633 | static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int type) |
639 | { | 634 | { |
640 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); | 635 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); |
641 | struct msm_pinctrl *pctrl = to_msm_pinctrl(gc); | 636 | struct msm_pinctrl *pctrl = gpiochip_get_data(gc); |
642 | const struct msm_pingroup *g; | 637 | const struct msm_pingroup *g; |
643 | unsigned long flags; | 638 | unsigned long flags; |
644 | u32 val; | 639 | u32 val; |
@@ -732,7 +727,7 @@ static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int type) | |||
732 | static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on) | 727 | static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on) |
733 | { | 728 | { |
734 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); | 729 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); |
735 | struct msm_pinctrl *pctrl = to_msm_pinctrl(gc); | 730 | struct msm_pinctrl *pctrl = gpiochip_get_data(gc); |
736 | unsigned long flags; | 731 | unsigned long flags; |
737 | 732 | ||
738 | spin_lock_irqsave(&pctrl->lock, flags); | 733 | spin_lock_irqsave(&pctrl->lock, flags); |
@@ -757,7 +752,7 @@ static void msm_gpio_irq_handler(struct irq_desc *desc) | |||
757 | { | 752 | { |
758 | struct gpio_chip *gc = irq_desc_get_handler_data(desc); | 753 | struct gpio_chip *gc = irq_desc_get_handler_data(desc); |
759 | const struct msm_pingroup *g; | 754 | const struct msm_pingroup *g; |
760 | struct msm_pinctrl *pctrl = to_msm_pinctrl(gc); | 755 | struct msm_pinctrl *pctrl = gpiochip_get_data(gc); |
761 | struct irq_chip *chip = irq_desc_get_chip(desc); | 756 | struct irq_chip *chip = irq_desc_get_chip(desc); |
762 | int irq_pin; | 757 | int irq_pin; |
763 | int handled = 0; | 758 | int handled = 0; |
@@ -804,7 +799,7 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl) | |||
804 | chip->owner = THIS_MODULE; | 799 | chip->owner = THIS_MODULE; |
805 | chip->of_node = pctrl->dev->of_node; | 800 | chip->of_node = pctrl->dev->of_node; |
806 | 801 | ||
807 | ret = gpiochip_add(&pctrl->chip); | 802 | ret = gpiochip_add_data(&pctrl->chip, pctrl); |
808 | if (ret) { | 803 | if (ret) { |
809 | dev_err(pctrl->dev, "Failed register gpiochip\n"); | 804 | dev_err(pctrl->dev, "Failed register gpiochip\n"); |
810 | return ret; | 805 | return ret; |