diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-12-08 11:51:47 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-01-05 16:15:00 +0300 |
commit | c52d9df14ba75af351a2be7cc49f9e055192af93 (patch) | |
tree | 3c0ac8ce48d4ec4ff4b93596d9cc1c9241d99195 /drivers/pinctrl | |
parent | fded3f40bf96d14a8c5bc3e4593e7cdc5709ab88 (diff) | |
download | linux-c52d9df14ba75af351a2be7cc49f9e055192af93.tar.xz |
pinctrl: spmi: 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: Ivan T. Ivanov <ivan.ivanov@linaro.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-spmi-gpio.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c index 4460b2c9c8bd..23553ecd8115 100644 --- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c +++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c @@ -158,11 +158,6 @@ static const char *const pmic_gpio_functions[] = { PMIC_GPIO_FUNC_DTEST3, PMIC_GPIO_FUNC_DTEST4, }; -static inline struct pmic_gpio_state *to_gpio_state(struct gpio_chip *chip) -{ - return container_of(chip, struct pmic_gpio_state, chip); -}; - static int pmic_gpio_read(struct pmic_gpio_state *state, struct pmic_gpio_pad *pad, unsigned int addr) { @@ -495,7 +490,7 @@ static const struct pinconf_ops pmic_gpio_pinconf_ops = { static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned pin) { - struct pmic_gpio_state *state = to_gpio_state(chip); + struct pmic_gpio_state *state = gpiochip_get_data(chip); unsigned long config; config = pinconf_to_config_packed(PIN_CONFIG_INPUT_ENABLE, 1); @@ -506,7 +501,7 @@ static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned pin) static int pmic_gpio_direction_output(struct gpio_chip *chip, unsigned pin, int val) { - struct pmic_gpio_state *state = to_gpio_state(chip); + struct pmic_gpio_state *state = gpiochip_get_data(chip); unsigned long config; config = pinconf_to_config_packed(PIN_CONFIG_OUTPUT, val); @@ -516,7 +511,7 @@ static int pmic_gpio_direction_output(struct gpio_chip *chip, static int pmic_gpio_get(struct gpio_chip *chip, unsigned pin) { - struct pmic_gpio_state *state = to_gpio_state(chip); + struct pmic_gpio_state *state = gpiochip_get_data(chip); struct pmic_gpio_pad *pad; int ret; @@ -538,7 +533,7 @@ static int pmic_gpio_get(struct gpio_chip *chip, unsigned pin) static void pmic_gpio_set(struct gpio_chip *chip, unsigned pin, int value) { - struct pmic_gpio_state *state = to_gpio_state(chip); + struct pmic_gpio_state *state = gpiochip_get_data(chip); unsigned long config; config = pinconf_to_config_packed(PIN_CONFIG_OUTPUT, value); @@ -561,7 +556,7 @@ static int pmic_gpio_of_xlate(struct gpio_chip *chip, static int pmic_gpio_to_irq(struct gpio_chip *chip, unsigned pin) { - struct pmic_gpio_state *state = to_gpio_state(chip); + struct pmic_gpio_state *state = gpiochip_get_data(chip); struct pmic_gpio_pad *pad; pad = state->ctrl->desc->pins[pin].drv_data; @@ -571,7 +566,7 @@ static int pmic_gpio_to_irq(struct gpio_chip *chip, unsigned pin) static void pmic_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) { - struct pmic_gpio_state *state = to_gpio_state(chip); + struct pmic_gpio_state *state = gpiochip_get_data(chip); unsigned i; for (i = 0; i < chip->ngpio; i++) { @@ -771,7 +766,7 @@ static int pmic_gpio_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; |