Re: [PATCH v5 2/2] counter: add IRQ or GPIO based event counter

From: William Breathitt Gray
Date: Wed Feb 24 2021 - 03:21:26 EST


On Wed, Feb 24, 2021 at 05:11:03PM +0900, William Breathitt Gray wrote:
> On Wed, Feb 24, 2021 at 08:35:06AM +0100, Oleksij Rempel wrote:
> > On Wed, Feb 24, 2021 at 11:34:06AM +0900, William Breathitt Gray wrote:
> > > Alternatively, we can take a more generic approach: ignore the GPIO
> > > names and focus solely on the IRQ lines; because the GPIO lines will
> > > always be tied to respective IRQ lines here, using the IRQ as the basis
> > > of the name should always be valid. The "name" member of the struct
> > > irq_chip can work for this. I haven't tested this, but I think something
> > > like this would work:
> > >
> > > cnt_signals[0].name = irq_get_chip(priv->irq)->name;
> >
> > ok, i'll take a look at it.
>
> If that doesn't work, then use devm_kasprintf() to generate the name
> based on the IRQ line number. The idea here is that the user should be
> able to identify that the Signal component for this Count is the
> respective IRQ.
>
> William Breathitt Gray

I realized that these irq_chip names are often just the device name
which isn't very useful either. :-(

In that case, I suppose we really are just left with generating the name
based on the IRQ line number then. This should be fine then:

cnt_signals[0].name = devm_kasprintf(dev, GFP_KERNEL, "IRQ %d",
priv->irq);
if (!cnt_signals[0].name)
return -ENOMEM;

I think this would make it clear to the user that this Signal is the
respective IRQ (whether sourced from GPIO or not).

William Breathitt Gray

Attachment: signature.asc
Description: PGP signature