[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210226064601.io6tznddikhcmvb3@pengutronix.de>
Date: Fri, 26 Feb 2021 07:46:01 +0100
From: Oleksij Rempel <o.rempel@...gutronix.de>
To: William Breathitt Gray <vilhelm.gray@...il.com>
Cc: devicetree@...r.kernel.org, Ahmad Fatoum <a.fatoum@...gutronix.de>,
linux-iio@...r.kernel.org,
Robin van der Gracht <robin@...tonic.nl>,
Linus Walleij <linus.walleij@...aro.org>,
linux-kernel@...r.kernel.org, Rob Herring <robh+dt@...nel.org>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
David Jander <david@...tonic.nl>,
Jonathan Cameron <jic23@...nel.org>
Subject: Re: [PATCH v5 2/2] counter: add IRQ or GPIO based event counter
On Wed, Feb 24, 2021 at 05:20:21PM +0900, William Breathitt Gray wrote:
> 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).
ack, with one correction. cnt_signals should be allocated, otherwise
this value will be set per driver not per device.
Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Powered by blists - more mailing lists