Commit 064761d1 authored by Linus Walleij's avatar Linus Walleij

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: default avatarLinus Walleij <linus.walleij@linaro.org>
parent c52d9df1
...@@ -178,11 +178,6 @@ static const char *const pmic_mpp_functions[] = { ...@@ -178,11 +178,6 @@ static const char *const pmic_mpp_functions[] = {
"digital", "analog", "sink" "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, static int pmic_mpp_read(struct pmic_mpp_state *state,
struct pmic_mpp_pad *pad, unsigned int addr) struct pmic_mpp_pad *pad, unsigned int addr)
{ {
...@@ -556,7 +551,7 @@ static const struct pinconf_ops pmic_mpp_pinconf_ops = { ...@@ -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) 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; unsigned long config;
config = pinconf_to_config_packed(PIN_CONFIG_INPUT_ENABLE, 1); 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) ...@@ -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, static int pmic_mpp_direction_output(struct gpio_chip *chip,
unsigned pin, int val) 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; unsigned long config;
config = pinconf_to_config_packed(PIN_CONFIG_OUTPUT, val); config = pinconf_to_config_packed(PIN_CONFIG_OUTPUT, val);
...@@ -577,7 +572,7 @@ static int pmic_mpp_direction_output(struct gpio_chip *chip, ...@@ -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) 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; struct pmic_mpp_pad *pad;
int ret; int ret;
...@@ -596,7 +591,7 @@ static int pmic_mpp_get(struct gpio_chip *chip, unsigned pin) ...@@ -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) 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; unsigned long config;
config = pinconf_to_config_packed(PIN_CONFIG_OUTPUT, value); config = pinconf_to_config_packed(PIN_CONFIG_OUTPUT, value);
...@@ -619,7 +614,7 @@ static int pmic_mpp_of_xlate(struct gpio_chip *chip, ...@@ -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) 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; struct pmic_mpp_pad *pad;
pad = state->ctrl->desc->pins[pin].drv_data; pad = state->ctrl->desc->pins[pin].drv_data;
...@@ -629,7 +624,7 @@ static int pmic_mpp_to_irq(struct gpio_chip *chip, unsigned pin) ...@@ -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) 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; unsigned i;
for (i = 0; i < chip->ngpio; i++) { for (i = 0; i < chip->ngpio; i++) {
...@@ -873,7 +868,7 @@ static int pmic_mpp_probe(struct platform_device *pdev) ...@@ -873,7 +868,7 @@ static int pmic_mpp_probe(struct platform_device *pdev)
if (IS_ERR(state->ctrl)) if (IS_ERR(state->ctrl))
return PTR_ERR(state->ctrl); return PTR_ERR(state->ctrl);
ret = gpiochip_add(&state->chip); ret = gpiochip_add_data(&state->chip, state);
if (ret) { if (ret) {
dev_err(state->dev, "can't add gpio chip\n"); dev_err(state->dev, "can't add gpio chip\n");
goto err_chip; goto err_chip;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment