Commit db5270ac authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Linus Walleij

gpio: mxc: use devres for irq generic chip

Use resource managed variants of irq_alloc_generic_chip() and
irq_setup_generic_chip().
Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent e0fc5a1b
...@@ -66,6 +66,7 @@ struct mxc_gpio_port { ...@@ -66,6 +66,7 @@ struct mxc_gpio_port {
int irq_high; int irq_high;
struct irq_domain *domain; struct irq_domain *domain;
struct gpio_chip gc; struct gpio_chip gc;
struct device *dev;
u32 both_edges; u32 both_edges;
}; };
...@@ -345,8 +346,9 @@ static int mxc_gpio_init_gc(struct mxc_gpio_port *port, int irq_base) ...@@ -345,8 +346,9 @@ static int mxc_gpio_init_gc(struct mxc_gpio_port *port, int irq_base)
{ {
struct irq_chip_generic *gc; struct irq_chip_generic *gc;
struct irq_chip_type *ct; struct irq_chip_type *ct;
int rv;
gc = irq_alloc_generic_chip("gpio-mxc", 1, irq_base, gc = devm_irq_alloc_generic_chip(port->dev, "gpio-mxc", 1, irq_base,
port->base, handle_level_irq); port->base, handle_level_irq);
if (!gc) if (!gc)
return -ENOMEM; return -ENOMEM;
...@@ -362,10 +364,11 @@ static int mxc_gpio_init_gc(struct mxc_gpio_port *port, int irq_base) ...@@ -362,10 +364,11 @@ static int mxc_gpio_init_gc(struct mxc_gpio_port *port, int irq_base)
ct->regs.ack = GPIO_ISR; ct->regs.ack = GPIO_ISR;
ct->regs.mask = GPIO_IMR; ct->regs.mask = GPIO_IMR;
irq_setup_generic_chip(gc, IRQ_MSK(32), IRQ_GC_INIT_NESTED_LOCK, rv = devm_irq_setup_generic_chip(port->dev, gc, IRQ_MSK(32),
IRQ_GC_INIT_NESTED_LOCK,
IRQ_NOREQUEST, 0); IRQ_NOREQUEST, 0);
return 0; return rv;
} }
static void mxc_gpio_get_hw(struct platform_device *pdev) static void mxc_gpio_get_hw(struct platform_device *pdev)
...@@ -419,6 +422,8 @@ static int mxc_gpio_probe(struct platform_device *pdev) ...@@ -419,6 +422,8 @@ static int mxc_gpio_probe(struct platform_device *pdev)
if (!port) if (!port)
return -ENOMEM; return -ENOMEM;
port->dev = &pdev->dev;
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
port->base = devm_ioremap_resource(&pdev->dev, iores); port->base = devm_ioremap_resource(&pdev->dev, iores);
if (IS_ERR(port->base)) if (IS_ERR(port->base))
......
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