diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-12-08 09:53:39 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-01-05 14:15:01 +0100 |
commit | 064761d1566617018567ed4d18bbb82519c01506 (patch) | |
tree | eb485fb945f5ca601dc22db3d7da628fd9a50aca /drivers/pinctrl | |
parent | pinctrl: spmi: use gpiochip data pointer (diff) | |
download | linux-064761d1566617018567ed4d18bbb82519c01506.tar.xz linux-064761d1566617018567ed4d18bbb82519c01506.zip |
pinctrl: spmi-mpp: 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: Björn Andersson <bjorn.andersson@sonymobile.com>
Cc: Ivan T. Ivanov <ivan.ivanov@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/qcom/pinctrl-spmi-mpp.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c index ea1d2b2f6fd1..f49713d199ca 100644 --- a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c +++ b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c @@ -178,11 +178,6 @@ static const char *const pmic_mpp_functions[] = { "digital", "analog", "sink" }; -static inline struct pmic_mpp_state *to_mpp_state(struct gpio_chip *chip) -{ - return container_of(chip, struct pmic_mpp_state, chip); -}; - static int pmic_mpp_read(struct pmic_mpp_state *state, struct pmic_mpp_pad *pad, unsigned int addr) { @@ -556,7 +551,7 @@ static const struct pinconf_ops pmic_mpp_pinconf_ops = { static int pmic_mpp_direction_input(struct gpio_chip *chip, unsigned pin) { - struct pmic_mpp_state *state = to_mpp_state(chip); + struct pmic_mpp_state *state = gpiochip_get_data(chip); unsigned long config; config = pinconf_to_config_packed(PIN_CONFIG_INPUT_ENABLE, 1); @@ -567,7 +562,7 @@ static int pmic_mpp_direction_input(struct gpio_chip *chip, unsigned pin) static int pmic_mpp_direction_output(struct gpio_chip *chip, unsigned pin, int val) { - struct pmic_mpp_state *state = to_mpp_state(chip); + struct pmic_mpp_state *state = gpiochip_get_data(chip); unsigned long config; config = pinconf_to_config_packed(PIN_CONFIG_OUTPUT, val); @@ -577,7 +572,7 @@ static int pmic_mpp_direction_output(struct gpio_chip *chip, static int pmic_mpp_get(struct gpio_chip *chip, unsigned pin) { - struct pmic_mpp_state *state = to_mpp_state(chip); + struct pmic_mpp_state *state = gpiochip_get_data(chip); struct pmic_mpp_pad *pad; int ret; @@ -596,7 +591,7 @@ static int pmic_mpp_get(struct gpio_chip *chip, unsigned pin) static void pmic_mpp_set(struct gpio_chip *chip, unsigned pin, int value) { - struct pmic_mpp_state *state = to_mpp_state(chip); + struct pmic_mpp_state *state = gpiochip_get_data(chip); unsigned long config; config = pinconf_to_config_packed(PIN_CONFIG_OUTPUT, value); @@ -619,7 +614,7 @@ static int pmic_mpp_of_xlate(struct gpio_chip *chip, static int pmic_mpp_to_irq(struct gpio_chip *chip, unsigned pin) { - struct pmic_mpp_state *state = to_mpp_state(chip); + struct pmic_mpp_state *state = gpiochip_get_data(chip); struct pmic_mpp_pad *pad; pad = state->ctrl->desc->pins[pin].drv_data; @@ -629,7 +624,7 @@ static int pmic_mpp_to_irq(struct gpio_chip *chip, unsigned pin) static void pmic_mpp_dbg_show(struct seq_file *s, struct gpio_chip *chip) { - struct pmic_mpp_state *state = to_mpp_state(chip); + struct pmic_mpp_state *state = gpiochip_get_data(chip); unsigned i; for (i = 0; i < chip->ngpio; i++) { @@ -873,7 +868,7 @@ static int pmic_mpp_probe(struct platform_device *pdev) if (IS_ERR(state->ctrl)) return PTR_ERR(state->ctrl); - ret = gpiochip_add(&state->chip); + ret = gpiochip_add_data(&state->chip, state); if (ret) { dev_err(state->dev, "can't add gpio chip\n"); goto err_chip; |