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

pinctrl: exynos5440: 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: Kukjin Kim <kgene@kernel.org>
Acked-by: NTomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 80036f88
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/gpio.h> #include <linux/gpio/driver.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/pinctrl/pinctrl.h> #include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/pinmux.h> #include <linux/pinctrl/pinmux.h>
...@@ -539,7 +539,7 @@ static const struct pinconf_ops exynos5440_pinconf_ops = { ...@@ -539,7 +539,7 @@ static const struct pinconf_ops exynos5440_pinconf_ops = {
/* gpiolib gpio_set callback function */ /* gpiolib gpio_set callback function */
static void exynos5440_gpio_set(struct gpio_chip *gc, unsigned offset, int value) static void exynos5440_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
{ {
struct exynos5440_pinctrl_priv_data *priv = dev_get_drvdata(gc->parent); struct exynos5440_pinctrl_priv_data *priv = gpiochip_get_data(gc);
void __iomem *base = priv->reg_base; void __iomem *base = priv->reg_base;
u32 data; u32 data;
...@@ -553,7 +553,7 @@ static void exynos5440_gpio_set(struct gpio_chip *gc, unsigned offset, int value ...@@ -553,7 +553,7 @@ static void exynos5440_gpio_set(struct gpio_chip *gc, unsigned offset, int value
/* gpiolib gpio_get callback function */ /* gpiolib gpio_get callback function */
static int exynos5440_gpio_get(struct gpio_chip *gc, unsigned offset) static int exynos5440_gpio_get(struct gpio_chip *gc, unsigned offset)
{ {
struct exynos5440_pinctrl_priv_data *priv = dev_get_drvdata(gc->parent); struct exynos5440_pinctrl_priv_data *priv = gpiochip_get_data(gc);
void __iomem *base = priv->reg_base; void __iomem *base = priv->reg_base;
u32 data; u32 data;
...@@ -566,7 +566,7 @@ static int exynos5440_gpio_get(struct gpio_chip *gc, unsigned offset) ...@@ -566,7 +566,7 @@ static int exynos5440_gpio_get(struct gpio_chip *gc, unsigned offset)
/* gpiolib gpio_direction_input callback function */ /* gpiolib gpio_direction_input callback function */
static int exynos5440_gpio_direction_input(struct gpio_chip *gc, unsigned offset) static int exynos5440_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
{ {
struct exynos5440_pinctrl_priv_data *priv = dev_get_drvdata(gc->parent); struct exynos5440_pinctrl_priv_data *priv = gpiochip_get_data(gc);
void __iomem *base = priv->reg_base; void __iomem *base = priv->reg_base;
u32 data; u32 data;
...@@ -586,7 +586,7 @@ static int exynos5440_gpio_direction_input(struct gpio_chip *gc, unsigned offset ...@@ -586,7 +586,7 @@ static int exynos5440_gpio_direction_input(struct gpio_chip *gc, unsigned offset
static int exynos5440_gpio_direction_output(struct gpio_chip *gc, unsigned offset, static int exynos5440_gpio_direction_output(struct gpio_chip *gc, unsigned offset,
int value) int value)
{ {
struct exynos5440_pinctrl_priv_data *priv = dev_get_drvdata(gc->parent); struct exynos5440_pinctrl_priv_data *priv = gpiochip_get_data(gc);
void __iomem *base = priv->reg_base; void __iomem *base = priv->reg_base;
u32 data; u32 data;
...@@ -607,7 +607,7 @@ static int exynos5440_gpio_direction_output(struct gpio_chip *gc, unsigned offse ...@@ -607,7 +607,7 @@ static int exynos5440_gpio_direction_output(struct gpio_chip *gc, unsigned offse
/* gpiolib gpio_to_irq callback function */ /* gpiolib gpio_to_irq callback function */
static int exynos5440_gpio_to_irq(struct gpio_chip *gc, unsigned offset) static int exynos5440_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
{ {
struct exynos5440_pinctrl_priv_data *priv = dev_get_drvdata(gc->parent); struct exynos5440_pinctrl_priv_data *priv = gpiochip_get_data(gc);
unsigned int virq; unsigned int virq;
if (offset < 16 || offset > 23) if (offset < 16 || offset > 23)
...@@ -825,7 +825,7 @@ static int exynos5440_gpiolib_register(struct platform_device *pdev, ...@@ -825,7 +825,7 @@ static int exynos5440_gpiolib_register(struct platform_device *pdev,
gc->to_irq = exynos5440_gpio_to_irq; gc->to_irq = exynos5440_gpio_to_irq;
gc->label = "gpiolib-exynos5440"; gc->label = "gpiolib-exynos5440";
gc->owner = THIS_MODULE; gc->owner = THIS_MODULE;
ret = gpiochip_add(gc); ret = gpiochip_add_data(gc, priv);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to register gpio_chip %s, error " dev_err(&pdev->dev, "failed to register gpio_chip %s, error "
"code: %d\n", gc->label, ret); "code: %d\n", gc->label, ret);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册