Commit dee07cea authored by Linus Walleij's avatar Linus Walleij

serial: sc16is7xx: 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: Jiri Slaby <jslaby@suse.com>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent a00d60a0
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/gpio.h> #include <linux/gpio/driver.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
...@@ -1104,8 +1104,7 @@ static const struct uart_ops sc16is7xx_ops = { ...@@ -1104,8 +1104,7 @@ static const struct uart_ops sc16is7xx_ops = {
static int sc16is7xx_gpio_get(struct gpio_chip *chip, unsigned offset) static int sc16is7xx_gpio_get(struct gpio_chip *chip, unsigned offset)
{ {
unsigned int val; unsigned int val;
struct sc16is7xx_port *s = container_of(chip, struct sc16is7xx_port, struct sc16is7xx_port *s = gpiochip_get_data(chip);
gpio);
struct uart_port *port = &s->p[0].port; struct uart_port *port = &s->p[0].port;
val = sc16is7xx_port_read(port, SC16IS7XX_IOSTATE_REG); val = sc16is7xx_port_read(port, SC16IS7XX_IOSTATE_REG);
...@@ -1115,8 +1114,7 @@ static int sc16is7xx_gpio_get(struct gpio_chip *chip, unsigned offset) ...@@ -1115,8 +1114,7 @@ static int sc16is7xx_gpio_get(struct gpio_chip *chip, unsigned offset)
static void sc16is7xx_gpio_set(struct gpio_chip *chip, unsigned offset, int val) static void sc16is7xx_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
{ {
struct sc16is7xx_port *s = container_of(chip, struct sc16is7xx_port, struct sc16is7xx_port *s = gpiochip_get_data(chip);
gpio);
struct uart_port *port = &s->p[0].port; struct uart_port *port = &s->p[0].port;
sc16is7xx_port_update(port, SC16IS7XX_IOSTATE_REG, BIT(offset), sc16is7xx_port_update(port, SC16IS7XX_IOSTATE_REG, BIT(offset),
...@@ -1126,8 +1124,7 @@ static void sc16is7xx_gpio_set(struct gpio_chip *chip, unsigned offset, int val) ...@@ -1126,8 +1124,7 @@ static void sc16is7xx_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
static int sc16is7xx_gpio_direction_input(struct gpio_chip *chip, static int sc16is7xx_gpio_direction_input(struct gpio_chip *chip,
unsigned offset) unsigned offset)
{ {
struct sc16is7xx_port *s = container_of(chip, struct sc16is7xx_port, struct sc16is7xx_port *s = gpiochip_get_data(chip);
gpio);
struct uart_port *port = &s->p[0].port; struct uart_port *port = &s->p[0].port;
sc16is7xx_port_update(port, SC16IS7XX_IODIR_REG, BIT(offset), 0); sc16is7xx_port_update(port, SC16IS7XX_IODIR_REG, BIT(offset), 0);
...@@ -1138,8 +1135,7 @@ static int sc16is7xx_gpio_direction_input(struct gpio_chip *chip, ...@@ -1138,8 +1135,7 @@ static int sc16is7xx_gpio_direction_input(struct gpio_chip *chip,
static int sc16is7xx_gpio_direction_output(struct gpio_chip *chip, static int sc16is7xx_gpio_direction_output(struct gpio_chip *chip,
unsigned offset, int val) unsigned offset, int val)
{ {
struct sc16is7xx_port *s = container_of(chip, struct sc16is7xx_port, struct sc16is7xx_port *s = gpiochip_get_data(chip);
gpio);
struct uart_port *port = &s->p[0].port; struct uart_port *port = &s->p[0].port;
sc16is7xx_port_update(port, SC16IS7XX_IOSTATE_REG, BIT(offset), sc16is7xx_port_update(port, SC16IS7XX_IOSTATE_REG, BIT(offset),
...@@ -1210,7 +1206,7 @@ static int sc16is7xx_probe(struct device *dev, ...@@ -1210,7 +1206,7 @@ static int sc16is7xx_probe(struct device *dev,
s->gpio.base = -1; s->gpio.base = -1;
s->gpio.ngpio = devtype->nr_gpio; s->gpio.ngpio = devtype->nr_gpio;
s->gpio.can_sleep = 1; s->gpio.can_sleep = 1;
ret = gpiochip_add(&s->gpio); ret = gpiochip_add_data(&s->gpio, s);
if (ret) if (ret)
goto out_thread; goto out_thread;
} }
......
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