提交 c63b30b0 编写于 作者: L Linus Walleij

gpio: stp-xway: 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: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 b03c04a0
...@@ -100,8 +100,7 @@ struct xway_stp { ...@@ -100,8 +100,7 @@ struct xway_stp {
*/ */
static void xway_stp_set(struct gpio_chip *gc, unsigned gpio, int val) static void xway_stp_set(struct gpio_chip *gc, unsigned gpio, int val)
{ {
struct xway_stp *chip = struct xway_stp *chip = gpiochip_get_data(gc);
container_of(gc, struct xway_stp, gc);
if (val) if (val)
chip->shadow |= BIT(gpio); chip->shadow |= BIT(gpio);
...@@ -135,8 +134,7 @@ static int xway_stp_dir_out(struct gpio_chip *gc, unsigned gpio, int val) ...@@ -135,8 +134,7 @@ static int xway_stp_dir_out(struct gpio_chip *gc, unsigned gpio, int val)
*/ */
static int xway_stp_request(struct gpio_chip *gc, unsigned gpio) static int xway_stp_request(struct gpio_chip *gc, unsigned gpio)
{ {
struct xway_stp *chip = struct xway_stp *chip = gpiochip_get_data(gc);
container_of(gc, struct xway_stp, gc);
if ((gpio < 8) && (chip->reserved & BIT(gpio))) { if ((gpio < 8) && (chip->reserved & BIT(gpio))) {
dev_err(gc->parent, "GPIO %d is driven by hardware\n", gpio); dev_err(gc->parent, "GPIO %d is driven by hardware\n", gpio);
...@@ -260,7 +258,7 @@ static int xway_stp_probe(struct platform_device *pdev) ...@@ -260,7 +258,7 @@ static int xway_stp_probe(struct platform_device *pdev)
ret = xway_stp_hw_init(chip); ret = xway_stp_hw_init(chip);
if (!ret) if (!ret)
ret = gpiochip_add(&chip->gc); ret = gpiochip_add_data(&chip->gc, chip);
if (!ret) if (!ret)
dev_info(&pdev->dev, "Init done\n"); dev_info(&pdev->dev, "Init done\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册