diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-12-08 16:06:23 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-01-05 08:15:06 -0500 |
commit | 11aa679a6a0b20fe105a7a955a82153e255bae74 (patch) | |
tree | 115b7c42a466c20b553c347cf3eb4e402735f241 | |
parent | cff4c7efbc2a1771af431edad6cf1df2a9d9dd46 (diff) |
pinctrl: mediatek: 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: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c index 9ddba444e127..cfba56b43658 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c | |||
@@ -14,7 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/gpio.h> | 17 | #include <linux/gpio/driver.h> |
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/of.h> | 19 | #include <linux/of.h> |
20 | #include <linux/of_address.h> | 20 | #include <linux/of_address.h> |
@@ -95,7 +95,7 @@ static void mtk_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
95 | { | 95 | { |
96 | unsigned int reg_addr; | 96 | unsigned int reg_addr; |
97 | unsigned int bit; | 97 | unsigned int bit; |
98 | struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent); | 98 | struct mtk_pinctrl *pctl = gpiochip_get_data(chip); |
99 | 99 | ||
100 | reg_addr = mtk_get_port(pctl, offset) + pctl->devdata->dout_offset; | 100 | reg_addr = mtk_get_port(pctl, offset) + pctl->devdata->dout_offset; |
101 | bit = BIT(offset & 0xf); | 101 | bit = BIT(offset & 0xf); |
@@ -742,7 +742,7 @@ static int mtk_gpio_get_direction(struct gpio_chip *chip, unsigned offset) | |||
742 | unsigned int bit; | 742 | unsigned int bit; |
743 | unsigned int read_val = 0; | 743 | unsigned int read_val = 0; |
744 | 744 | ||
745 | struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent); | 745 | struct mtk_pinctrl *pctl = gpiochip_get_data(chip); |
746 | 746 | ||
747 | reg_addr = mtk_get_port(pctl, offset) + pctl->devdata->dir_offset; | 747 | reg_addr = mtk_get_port(pctl, offset) + pctl->devdata->dir_offset; |
748 | bit = BIT(offset & 0xf); | 748 | bit = BIT(offset & 0xf); |
@@ -755,7 +755,7 @@ static int mtk_gpio_get(struct gpio_chip *chip, unsigned offset) | |||
755 | unsigned int reg_addr; | 755 | unsigned int reg_addr; |
756 | unsigned int bit; | 756 | unsigned int bit; |
757 | unsigned int read_val = 0; | 757 | unsigned int read_val = 0; |
758 | struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent); | 758 | struct mtk_pinctrl *pctl = gpiochip_get_data(chip); |
759 | 759 | ||
760 | reg_addr = mtk_get_port(pctl, offset) + | 760 | reg_addr = mtk_get_port(pctl, offset) + |
761 | pctl->devdata->din_offset; | 761 | pctl->devdata->din_offset; |
@@ -768,7 +768,7 @@ static int mtk_gpio_get(struct gpio_chip *chip, unsigned offset) | |||
768 | static int mtk_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | 768 | static int mtk_gpio_to_irq(struct gpio_chip *chip, unsigned offset) |
769 | { | 769 | { |
770 | const struct mtk_desc_pin *pin; | 770 | const struct mtk_desc_pin *pin; |
771 | struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent); | 771 | struct mtk_pinctrl *pctl = gpiochip_get_data(chip); |
772 | int irq; | 772 | int irq; |
773 | 773 | ||
774 | pin = pctl->devdata->pins + offset; | 774 | pin = pctl->devdata->pins + offset; |
@@ -1348,7 +1348,7 @@ int mtk_pctrl_init(struct platform_device *pdev, | |||
1348 | pctl->chip->parent = &pdev->dev; | 1348 | pctl->chip->parent = &pdev->dev; |
1349 | pctl->chip->base = -1; | 1349 | pctl->chip->base = -1; |
1350 | 1350 | ||
1351 | ret = gpiochip_add(pctl->chip); | 1351 | ret = gpiochip_add_data(pctl->chip, pctl); |
1352 | if (ret) { | 1352 | if (ret) { |
1353 | ret = -EINVAL; | 1353 | ret = -EINVAL; |
1354 | goto pctrl_error; | 1354 | goto pctrl_error; |