On Mon, Aug 12, 2019 at 12:58 PM Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote: > On Mon, Aug 12, 2019 at 10:13:51AM +0200, Linus Walleij wrote: > > + girq->num_parents = 1; > > + girq->parents = devm_kcalloc(&pdev->dev, 1, > > + sizeof(*girq->parents), > > + GFP_KERNEL); > > + if (!girq->parents) > > + return -ENOMEM; > > I understand the point to use kcalloc() for one entry, though I would make > intention more explicitly, i.e. use girq->num_parents in it instead of hard > coded value. That is better, but I have a loose plan to get rid of this and just set parents to a fixed width because all the allocation is annoying. > > + girq->parents[0] = (unsigned)irq_rc->start; > > + girq->default_type = IRQ_TYPE_NONE; > > > + girq->handler = handle_simple_irq; > > > - ret = gpiochip_irqchip_add(gc, &lp_irqchip, 0, > > - handle_simple_irq, IRQ_TYPE_NONE); > > Hmm... Now I'm wondering, shall we use handle_bad_irq() here? If you are sure that every consumer will call .set_type() you can use handle_bad_irq, and that is preferred. Yours, Linus Walleij