Commit de3d851b authored by Linus Walleij's avatar Linus Walleij

pinctrl: adi2: 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().
Acked-by: default avatarSonic Zhang <sonic.zhang@analog.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 2b016d27
...@@ -636,7 +636,7 @@ static int adi_pinmux_set(struct pinctrl_dev *pctldev, unsigned func_id, ...@@ -636,7 +636,7 @@ static int adi_pinmux_set(struct pinctrl_dev *pctldev, unsigned func_id,
if (range == NULL) /* should not happen */ if (range == NULL) /* should not happen */
return -ENODEV; return -ENODEV;
port = container_of(range->gc, struct gpio_port, chip); port = gpiochip_get_data(range->gc);
spin_lock_irqsave(&port->lock, flags); spin_lock_irqsave(&port->lock, flags);
...@@ -684,7 +684,7 @@ static int adi_pinmux_request_gpio(struct pinctrl_dev *pctldev, ...@@ -684,7 +684,7 @@ static int adi_pinmux_request_gpio(struct pinctrl_dev *pctldev,
unsigned long flags; unsigned long flags;
u8 offset; u8 offset;
port = container_of(range->gc, struct gpio_port, chip); port = gpiochip_get_data(range->gc);
offset = pin_to_offset(range, pin); offset = pin_to_offset(range, pin);
spin_lock_irqsave(&port->lock, flags); spin_lock_irqsave(&port->lock, flags);
...@@ -718,7 +718,7 @@ static int adi_gpio_direction_input(struct gpio_chip *chip, unsigned offset) ...@@ -718,7 +718,7 @@ static int adi_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
struct gpio_port *port; struct gpio_port *port;
unsigned long flags; unsigned long flags;
port = container_of(chip, struct gpio_port, chip); port = gpiochip_get_data(chip);
spin_lock_irqsave(&port->lock, flags); spin_lock_irqsave(&port->lock, flags);
...@@ -733,7 +733,7 @@ static int adi_gpio_direction_input(struct gpio_chip *chip, unsigned offset) ...@@ -733,7 +733,7 @@ static int adi_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
static void adi_gpio_set_value(struct gpio_chip *chip, unsigned offset, static void adi_gpio_set_value(struct gpio_chip *chip, unsigned offset,
int value) int value)
{ {
struct gpio_port *port = container_of(chip, struct gpio_port, chip); struct gpio_port *port = gpiochip_get_data(chip);
struct gpio_port_t *regs = port->regs; struct gpio_port_t *regs = port->regs;
unsigned long flags; unsigned long flags;
...@@ -750,7 +750,7 @@ static void adi_gpio_set_value(struct gpio_chip *chip, unsigned offset, ...@@ -750,7 +750,7 @@ static void adi_gpio_set_value(struct gpio_chip *chip, unsigned offset,
static int adi_gpio_direction_output(struct gpio_chip *chip, unsigned offset, static int adi_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
int value) int value)
{ {
struct gpio_port *port = container_of(chip, struct gpio_port, chip); struct gpio_port *port = gpiochip_get_data(chip);
struct gpio_port_t *regs = port->regs; struct gpio_port_t *regs = port->regs;
unsigned long flags; unsigned long flags;
...@@ -770,7 +770,7 @@ static int adi_gpio_direction_output(struct gpio_chip *chip, unsigned offset, ...@@ -770,7 +770,7 @@ static int adi_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
static int adi_gpio_get_value(struct gpio_chip *chip, unsigned offset) static int adi_gpio_get_value(struct gpio_chip *chip, unsigned offset)
{ {
struct gpio_port *port = container_of(chip, struct gpio_port, chip); struct gpio_port *port = gpiochip_get_data(chip);
struct gpio_port_t *regs = port->regs; struct gpio_port_t *regs = port->regs;
unsigned long flags; unsigned long flags;
int ret; int ret;
...@@ -786,7 +786,7 @@ static int adi_gpio_get_value(struct gpio_chip *chip, unsigned offset) ...@@ -786,7 +786,7 @@ static int adi_gpio_get_value(struct gpio_chip *chip, unsigned offset)
static int adi_gpio_to_irq(struct gpio_chip *chip, unsigned offset) static int adi_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
{ {
struct gpio_port *port = container_of(chip, struct gpio_port, chip); struct gpio_port *port = gpiochip_get_data(chip);
if (port->irq_base >= 0) if (port->irq_base >= 0)
return irq_find_mapping(port->domain, offset); return irq_find_mapping(port->domain, offset);
...@@ -994,7 +994,7 @@ static int adi_gpio_probe(struct platform_device *pdev) ...@@ -994,7 +994,7 @@ static int adi_gpio_probe(struct platform_device *pdev)
port->chip.ngpio = port->width; port->chip.ngpio = port->width;
gpio = port->chip.base + port->width; gpio = port->chip.base + port->width;
ret = gpiochip_add(&port->chip); ret = gpiochip_add_data(&port->chip, port);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Fail to add GPIO chip.\n"); dev_err(&pdev->dev, "Fail to add GPIO chip.\n");
goto out_remove_domain; goto out_remove_domain;
......
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