Commit 03bf81f1 authored by Linus Walleij's avatar Linus Walleij

pinctrl: rockchip: 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 avatarHeiko Stuebner <heiko@sntech.de>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 3d18fb5c
...@@ -224,11 +224,6 @@ static struct regmap_config rockchip_regmap_config = { ...@@ -224,11 +224,6 @@ static struct regmap_config rockchip_regmap_config = {
.reg_stride = 4, .reg_stride = 4,
}; };
static inline struct rockchip_pin_bank *gc_to_pin_bank(struct gpio_chip *gc)
{
return container_of(gc, struct rockchip_pin_bank, gpio_chip);
}
static const inline struct rockchip_pin_group *pinctrl_name_to_group( static const inline struct rockchip_pin_group *pinctrl_name_to_group(
const struct rockchip_pinctrl *info, const struct rockchip_pinctrl *info,
const char *name) const char *name)
...@@ -939,7 +934,7 @@ static int _rockchip_pmx_gpio_set_direction(struct gpio_chip *chip, ...@@ -939,7 +934,7 @@ static int _rockchip_pmx_gpio_set_direction(struct gpio_chip *chip,
unsigned long flags; unsigned long flags;
u32 data; u32 data;
bank = gc_to_pin_bank(chip); bank = gpiochip_get_data(chip);
ret = rockchip_set_mux(bank, pin, RK_FUNC_GPIO); ret = rockchip_set_mux(bank, pin, RK_FUNC_GPIO);
if (ret < 0) if (ret < 0)
...@@ -1376,7 +1371,7 @@ static int rockchip_pinctrl_register(struct platform_device *pdev, ...@@ -1376,7 +1371,7 @@ static int rockchip_pinctrl_register(struct platform_device *pdev,
static void rockchip_gpio_set(struct gpio_chip *gc, unsigned offset, int value) static void rockchip_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
{ {
struct rockchip_pin_bank *bank = gc_to_pin_bank(gc); struct rockchip_pin_bank *bank = gpiochip_get_data(gc);
void __iomem *reg = bank->reg_base + GPIO_SWPORT_DR; void __iomem *reg = bank->reg_base + GPIO_SWPORT_DR;
unsigned long flags; unsigned long flags;
u32 data; u32 data;
...@@ -1400,7 +1395,7 @@ static void rockchip_gpio_set(struct gpio_chip *gc, unsigned offset, int value) ...@@ -1400,7 +1395,7 @@ static void rockchip_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
*/ */
static int rockchip_gpio_get(struct gpio_chip *gc, unsigned offset) static int rockchip_gpio_get(struct gpio_chip *gc, unsigned offset)
{ {
struct rockchip_pin_bank *bank = gc_to_pin_bank(gc); struct rockchip_pin_bank *bank = gpiochip_get_data(gc);
u32 data; u32 data;
clk_enable(bank->clk); clk_enable(bank->clk);
...@@ -1439,7 +1434,7 @@ static int rockchip_gpio_direction_output(struct gpio_chip *gc, ...@@ -1439,7 +1434,7 @@ static int rockchip_gpio_direction_output(struct gpio_chip *gc,
*/ */
static int rockchip_gpio_to_irq(struct gpio_chip *gc, unsigned offset) static int rockchip_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
{ {
struct rockchip_pin_bank *bank = gc_to_pin_bank(gc); struct rockchip_pin_bank *bank = gpiochip_get_data(gc);
unsigned int virq; unsigned int virq;
if (!bank->domain) if (!bank->domain)
...@@ -1758,7 +1753,7 @@ static int rockchip_gpiolib_register(struct platform_device *pdev, ...@@ -1758,7 +1753,7 @@ static int rockchip_gpiolib_register(struct platform_device *pdev,
gc->of_node = bank->of_node; gc->of_node = bank->of_node;
gc->label = bank->name; gc->label = bank->name;
ret = gpiochip_add(gc); ret = gpiochip_add_data(gc, bank);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to register gpio_chip %s, error code: %d\n", dev_err(&pdev->dev, "failed to register gpio_chip %s, error code: %d\n",
gc->label, ret); gc->label, ret);
......
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