pinctrl: as3722: 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: Andrew Bresticker <abrestic@chromium.org> Cc: Mallikarjun Kasoju <mkasoju@nvidia.com> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
04d3672311
commit
f5bc3568db
|
@ -436,14 +436,9 @@ static struct pinctrl_desc as3722_pinctrl_desc = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct as3722_pctrl_info *to_as_pci(struct gpio_chip *chip)
|
|
||||||
{
|
|
||||||
return container_of(chip, struct as3722_pctrl_info, gpio_chip);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int as3722_gpio_get(struct gpio_chip *chip, unsigned offset)
|
static int as3722_gpio_get(struct gpio_chip *chip, unsigned offset)
|
||||||
{
|
{
|
||||||
struct as3722_pctrl_info *as_pci = to_as_pci(chip);
|
struct as3722_pctrl_info *as_pci = gpiochip_get_data(chip);
|
||||||
struct as3722 *as3722 = as_pci->as3722;
|
struct as3722 *as3722 = as_pci->as3722;
|
||||||
int ret;
|
int ret;
|
||||||
u32 reg;
|
u32 reg;
|
||||||
|
@ -491,7 +486,7 @@ static int as3722_gpio_get(struct gpio_chip *chip, unsigned offset)
|
||||||
static void as3722_gpio_set(struct gpio_chip *chip, unsigned offset,
|
static void as3722_gpio_set(struct gpio_chip *chip, unsigned offset,
|
||||||
int value)
|
int value)
|
||||||
{
|
{
|
||||||
struct as3722_pctrl_info *as_pci = to_as_pci(chip);
|
struct as3722_pctrl_info *as_pci = gpiochip_get_data(chip);
|
||||||
struct as3722 *as3722 = as_pci->as3722;
|
struct as3722 *as3722 = as_pci->as3722;
|
||||||
int en_invert;
|
int en_invert;
|
||||||
u32 val;
|
u32 val;
|
||||||
|
@ -531,7 +526,7 @@ static int as3722_gpio_direction_output(struct gpio_chip *chip,
|
||||||
|
|
||||||
static int as3722_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
|
static int as3722_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
|
||||||
{
|
{
|
||||||
struct as3722_pctrl_info *as_pci = to_as_pci(chip);
|
struct as3722_pctrl_info *as_pci = gpiochip_get_data(chip);
|
||||||
|
|
||||||
return as3722_irq_get_virq(as_pci->as3722, offset);
|
return as3722_irq_get_virq(as_pci->as3722, offset);
|
||||||
}
|
}
|
||||||
|
@ -584,7 +579,7 @@ static int as3722_pinctrl_probe(struct platform_device *pdev)
|
||||||
as_pci->gpio_chip = as3722_gpio_chip;
|
as_pci->gpio_chip = as3722_gpio_chip;
|
||||||
as_pci->gpio_chip.parent = &pdev->dev;
|
as_pci->gpio_chip.parent = &pdev->dev;
|
||||||
as_pci->gpio_chip.of_node = pdev->dev.parent->of_node;
|
as_pci->gpio_chip.of_node = pdev->dev.parent->of_node;
|
||||||
ret = gpiochip_add(&as_pci->gpio_chip);
|
ret = gpiochip_add_data(&as_pci->gpio_chip, as_pci);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(&pdev->dev, "Couldn't register gpiochip, %d\n", ret);
|
dev_err(&pdev->dev, "Couldn't register gpiochip, %d\n", ret);
|
||||||
goto fail_chip_add;
|
goto fail_chip_add;
|
||||||
|
|
Loading…
Reference in New Issue