Skip to content

Commit db5270a

Browse files
brgllinusw
authored andcommitted
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: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent e0fc5a1 commit db5270a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/gpio/gpio-mxc.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ struct mxc_gpio_port {
6666
int irq_high;
6767
struct irq_domain *domain;
6868
struct gpio_chip gc;
69+
struct device *dev;
6970
u32 both_edges;
7071
};
7172

@@ -345,9 +346,10 @@ static int mxc_gpio_init_gc(struct mxc_gpio_port *port, int irq_base)
345346
{
346347
struct irq_chip_generic *gc;
347348
struct irq_chip_type *ct;
349+
int rv;
348350

349-
gc = irq_alloc_generic_chip("gpio-mxc", 1, irq_base,
350-
port->base, handle_level_irq);
351+
gc = devm_irq_alloc_generic_chip(port->dev, "gpio-mxc", 1, irq_base,
352+
port->base, handle_level_irq);
351353
if (!gc)
352354
return -ENOMEM;
353355
gc->private = port;
@@ -362,10 +364,11 @@ static int mxc_gpio_init_gc(struct mxc_gpio_port *port, int irq_base)
362364
ct->regs.ack = GPIO_ISR;
363365
ct->regs.mask = GPIO_IMR;
364366

365-
irq_setup_generic_chip(gc, IRQ_MSK(32), IRQ_GC_INIT_NESTED_LOCK,
366-
IRQ_NOREQUEST, 0);
367+
rv = devm_irq_setup_generic_chip(port->dev, gc, IRQ_MSK(32),
368+
IRQ_GC_INIT_NESTED_LOCK,
369+
IRQ_NOREQUEST, 0);
367370

368-
return 0;
371+
return rv;
369372
}
370373

371374
static void mxc_gpio_get_hw(struct platform_device *pdev)
@@ -419,6 +422,8 @@ static int mxc_gpio_probe(struct platform_device *pdev)
419422
if (!port)
420423
return -ENOMEM;
421424

425+
port->dev = &pdev->dev;
426+
422427
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
423428
port->base = devm_ioremap_resource(&pdev->dev, iores);
424429
if (IS_ERR(port->base))

0 commit comments

Comments
 (0)