On Sat, Mar 21, 2026 at 12:00 AM Rosen Penev <[email protected]> wrote:
>
> >
> > static int gpio_mockup_probe(struct platform_device *pdev)
> > {
> >         ...
> >         u16 ngpio;
> >         ...
> >         rv = device_property_read_u16(dev, "nr-gpios", &ngpio);
> >         ...
> >         gc->ngpio = ngpio;
> >         ...
> >         chip->lines = devm_kcalloc(dev, gc->ngpio,
> >                                    sizeof(*chip->lines), GFP_KERNEL);
> >
> > But this begs the question: why add nr_lines when ngpio is already part
> > of the struct:
> Maintainers for some inexplicable reason want an extra variable for
> __counted_by works.

I believe what Kees means here is: you can use ngpio for __counted_by() like so:

  __counted_by(gc.ngpio)

I didn't think about it and I do prefer it of course over an extra field.

Bart

Reply via email to