Commit ed47941a authored by Linus Walleij's avatar Linus Walleij

pinctrl: ssbi-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>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 064761d1
...@@ -448,7 +448,7 @@ static struct pinctrl_desc pm8xxx_pinctrl_desc = { ...@@ -448,7 +448,7 @@ static struct pinctrl_desc pm8xxx_pinctrl_desc = {
static int pm8xxx_mpp_direction_input(struct gpio_chip *chip, static int pm8xxx_mpp_direction_input(struct gpio_chip *chip,
unsigned offset) unsigned offset)
{ {
struct pm8xxx_mpp *pctrl = container_of(chip, struct pm8xxx_mpp, chip); struct pm8xxx_mpp *pctrl = gpiochip_get_data(chip);
struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data;
switch (pin->mode) { switch (pin->mode) {
...@@ -472,7 +472,7 @@ static int pm8xxx_mpp_direction_output(struct gpio_chip *chip, ...@@ -472,7 +472,7 @@ static int pm8xxx_mpp_direction_output(struct gpio_chip *chip,
unsigned offset, unsigned offset,
int value) int value)
{ {
struct pm8xxx_mpp *pctrl = container_of(chip, struct pm8xxx_mpp, chip); struct pm8xxx_mpp *pctrl = gpiochip_get_data(chip);
struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data;
switch (pin->mode) { switch (pin->mode) {
...@@ -496,7 +496,7 @@ static int pm8xxx_mpp_direction_output(struct gpio_chip *chip, ...@@ -496,7 +496,7 @@ static int pm8xxx_mpp_direction_output(struct gpio_chip *chip,
static int pm8xxx_mpp_get(struct gpio_chip *chip, unsigned offset) static int pm8xxx_mpp_get(struct gpio_chip *chip, unsigned offset)
{ {
struct pm8xxx_mpp *pctrl = container_of(chip, struct pm8xxx_mpp, chip); struct pm8xxx_mpp *pctrl = gpiochip_get_data(chip);
struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data;
bool state; bool state;
int ret; int ret;
...@@ -513,7 +513,7 @@ static int pm8xxx_mpp_get(struct gpio_chip *chip, unsigned offset) ...@@ -513,7 +513,7 @@ static int pm8xxx_mpp_get(struct gpio_chip *chip, unsigned offset)
static void pm8xxx_mpp_set(struct gpio_chip *chip, unsigned offset, int value) static void pm8xxx_mpp_set(struct gpio_chip *chip, unsigned offset, int value)
{ {
struct pm8xxx_mpp *pctrl = container_of(chip, struct pm8xxx_mpp, chip); struct pm8xxx_mpp *pctrl = gpiochip_get_data(chip);
struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data;
pin->output_value = !!value; pin->output_value = !!value;
...@@ -537,7 +537,7 @@ static int pm8xxx_mpp_of_xlate(struct gpio_chip *chip, ...@@ -537,7 +537,7 @@ static int pm8xxx_mpp_of_xlate(struct gpio_chip *chip,
static int pm8xxx_mpp_to_irq(struct gpio_chip *chip, unsigned offset) static int pm8xxx_mpp_to_irq(struct gpio_chip *chip, unsigned offset)
{ {
struct pm8xxx_mpp *pctrl = container_of(chip, struct pm8xxx_mpp, chip); struct pm8xxx_mpp *pctrl = gpiochip_get_data(chip);
struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data;
return pin->irq; return pin->irq;
...@@ -552,7 +552,7 @@ static void pm8xxx_mpp_dbg_show_one(struct seq_file *s, ...@@ -552,7 +552,7 @@ static void pm8xxx_mpp_dbg_show_one(struct seq_file *s,
unsigned offset, unsigned offset,
unsigned gpio) unsigned gpio)
{ {
struct pm8xxx_mpp *pctrl = container_of(chip, struct pm8xxx_mpp, chip); struct pm8xxx_mpp *pctrl = gpiochip_get_data(chip);
struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data; struct pm8xxx_pin_data *pin = pctrl->desc.pins[offset].drv_data;
static const char * const aout_lvls[] = { static const char * const aout_lvls[] = {
...@@ -826,7 +826,7 @@ static int pm8xxx_mpp_probe(struct platform_device *pdev) ...@@ -826,7 +826,7 @@ static int pm8xxx_mpp_probe(struct platform_device *pdev)
pctrl->chip.of_gpio_n_cells = 2; pctrl->chip.of_gpio_n_cells = 2;
pctrl->chip.label = dev_name(pctrl->dev); pctrl->chip.label = dev_name(pctrl->dev);
pctrl->chip.ngpio = pctrl->npins; pctrl->chip.ngpio = pctrl->npins;
ret = gpiochip_add(&pctrl->chip); ret = gpiochip_add_data(&pctrl->chip, pctrl);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed register gpiochip\n"); dev_err(&pdev->dev, "failed register gpiochip\n");
goto unregister_pinctrl; goto unregister_pinctrl;
......
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