From c52d9df14ba75af351a2be7cc49f9e055192af93 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Tue, 8 Dec 2015 09:51:47 +0100 Subject: pinctrl: spmi: use gpiochip data pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Cc: Björn Andersson Signed-off-by: Linus Walleij --- drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'drivers') diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c index 4460b2c..23553ec 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; -- cgit v1.1