Skip to content

Commit 5751d3d

Browse files
brgllinusw
authored andcommitted
gpio: mxs: 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 db5270a commit 5751d3d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

drivers/gpio/gpio-mxs.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ struct mxs_gpio_port {
6666
int irq;
6767
struct irq_domain *domain;
6868
struct gpio_chip gc;
69+
struct device *dev;
6970
enum mxs_gpio_id devid;
7071
u32 both_edges;
7172
};
@@ -209,9 +210,10 @@ static int mxs_gpio_init_gc(struct mxs_gpio_port *port, int irq_base)
209210
{
210211
struct irq_chip_generic *gc;
211212
struct irq_chip_type *ct;
213+
int rv;
212214

213-
gc = irq_alloc_generic_chip("gpio-mxs", 2, irq_base,
214-
port->base, handle_level_irq);
215+
gc = devm_irq_alloc_generic_chip(port->dev, "gpio-mxs", 2, irq_base,
216+
port->base, handle_level_irq);
215217
if (!gc)
216218
return -ENOMEM;
217219

@@ -242,10 +244,11 @@ static int mxs_gpio_init_gc(struct mxs_gpio_port *port, int irq_base)
242244
ct->regs.disable = PINCTRL_IRQEN(port) + MXS_CLR;
243245
ct->handler = handle_level_irq;
244246

245-
irq_setup_generic_chip(gc, IRQ_MSK(32), IRQ_GC_INIT_NESTED_LOCK,
246-
IRQ_NOREQUEST, 0);
247+
rv = devm_irq_setup_generic_chip(port->dev, gc, IRQ_MSK(32),
248+
IRQ_GC_INIT_NESTED_LOCK,
249+
IRQ_NOREQUEST, 0);
247250

248-
return 0;
251+
return rv;
249252
}
250253

251254
static int mxs_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
@@ -304,6 +307,7 @@ static int mxs_gpio_probe(struct platform_device *pdev)
304307
if (port->id < 0)
305308
return port->id;
306309
port->devid = (enum mxs_gpio_id) of_id->data;
310+
port->dev = &pdev->dev;
307311
port->irq = platform_get_irq(pdev, 0);
308312
if (port->irq < 0)
309313
return port->irq;

0 commit comments

Comments
 (0)