Commit 9f57f81c authored by Linus Walleij's avatar Linus Walleij

pinctrl: samsung: 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: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 378596f9
...@@ -50,11 +50,6 @@ static LIST_HEAD(drvdata_list); ...@@ -50,11 +50,6 @@ static LIST_HEAD(drvdata_list);
static unsigned int pin_base; static unsigned int pin_base;
static inline struct samsung_pin_bank *gc_to_pin_bank(struct gpio_chip *gc)
{
return container_of(gc, struct samsung_pin_bank, gpio_chip);
}
static int samsung_get_group_count(struct pinctrl_dev *pctldev) static int samsung_get_group_count(struct pinctrl_dev *pctldev)
{ {
struct samsung_pinctrl_drv_data *pmx = pinctrl_dev_get_drvdata(pctldev); struct samsung_pinctrl_drv_data *pmx = pinctrl_dev_get_drvdata(pctldev);
...@@ -522,7 +517,7 @@ static const struct pinconf_ops samsung_pinconf_ops = { ...@@ -522,7 +517,7 @@ static const struct pinconf_ops samsung_pinconf_ops = {
/* gpiolib gpio_set callback function */ /* gpiolib gpio_set callback function */
static void samsung_gpio_set(struct gpio_chip *gc, unsigned offset, int value) static void samsung_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
{ {
struct samsung_pin_bank *bank = gc_to_pin_bank(gc); struct samsung_pin_bank *bank = gpiochip_get_data(gc);
const struct samsung_pin_bank_type *type = bank->type; const struct samsung_pin_bank_type *type = bank->type;
unsigned long flags; unsigned long flags;
void __iomem *reg; void __iomem *reg;
...@@ -546,7 +541,7 @@ static int samsung_gpio_get(struct gpio_chip *gc, unsigned offset) ...@@ -546,7 +541,7 @@ static int samsung_gpio_get(struct gpio_chip *gc, unsigned offset)
{ {
void __iomem *reg; void __iomem *reg;
u32 data; u32 data;
struct samsung_pin_bank *bank = gc_to_pin_bank(gc); struct samsung_pin_bank *bank = gpiochip_get_data(gc);
const struct samsung_pin_bank_type *type = bank->type; const struct samsung_pin_bank_type *type = bank->type;
reg = bank->drvdata->virt_base + bank->pctl_offset; reg = bank->drvdata->virt_base + bank->pctl_offset;
...@@ -571,7 +566,7 @@ static int samsung_gpio_set_direction(struct gpio_chip *gc, ...@@ -571,7 +566,7 @@ static int samsung_gpio_set_direction(struct gpio_chip *gc,
u32 data, mask, shift; u32 data, mask, shift;
unsigned long flags; unsigned long flags;
bank = gc_to_pin_bank(gc); bank = gpiochip_get_data(gc);
type = bank->type; type = bank->type;
drvdata = bank->drvdata; drvdata = bank->drvdata;
...@@ -619,7 +614,7 @@ static int samsung_gpio_direction_output(struct gpio_chip *gc, unsigned offset, ...@@ -619,7 +614,7 @@ static int samsung_gpio_direction_output(struct gpio_chip *gc, unsigned offset,
*/ */
static int samsung_gpio_to_irq(struct gpio_chip *gc, unsigned offset) static int samsung_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
{ {
struct samsung_pin_bank *bank = gc_to_pin_bank(gc); struct samsung_pin_bank *bank = gpiochip_get_data(gc);
unsigned int virq; unsigned int virq;
if (!bank->irq_domain) if (!bank->irq_domain)
...@@ -918,7 +913,7 @@ static int samsung_gpiolib_register(struct platform_device *pdev, ...@@ -918,7 +913,7 @@ static int samsung_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