linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: trigger: Print an error if there is no available irq
@ 2019-02-13 13:17 Mathieu Othacehe
  2019-02-13 22:19 ` Martin Kelly
  0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Othacehe @ 2019-02-13 13:17 UTC (permalink / raw)
  To: jic23, knaack.h, lars, pmeerw; +Cc: linux-iio, linux-kernel, Mathieu Othacehe

If there are more trigger consumers than
CONFIG_IIO_CONSUMERS_PER_TRIGGER, iio_trigger_attach_poll_func will
silently fail. Add an error message to inform the user that
CONFIG_IIO_CONSUMERS_PER_TRIGGER limit might be exceeded.

Signed-off-by: Mathieu Othacehe <m.othacehe@gmail.com>
---
 drivers/iio/industrialio-trigger.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
index ce66699c7fcc..801986c21467 100644
--- a/drivers/iio/industrialio-trigger.c
+++ b/drivers/iio/industrialio-trigger.c
@@ -254,8 +254,12 @@ static int iio_trigger_attach_poll_func(struct iio_trigger *trig,
 
 	/* Get irq number */
 	pf->irq = iio_trigger_get_irq(trig);
-	if (pf->irq < 0)
+	if (pf->irq < 0) {
+		pr_err("Could not find an available irq for trigger %s, "
+			"CONFIG_IIO_CONSUMERS_PER_TRIGGER limit "
+			"might be exceeded\n", trig->name);
 		goto out_put_module;
+	}
 
 	/* Request irq */
 	ret = request_threaded_irq(pf->irq, pf->h, pf->thread,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: trigger: Print an error if there is no available irq
  2019-02-13 13:17 [PATCH] iio: trigger: Print an error if there is no available irq Mathieu Othacehe
@ 2019-02-13 22:19 ` Martin Kelly
  2019-02-20 11:34   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Kelly @ 2019-02-13 22:19 UTC (permalink / raw)
  To: Mathieu Othacehe, jic23, knaack.h, lars, pmeerw; +Cc: linux-iio, linux-kernel

On 2/13/19 5:17 AM, Mathieu Othacehe wrote:
> If there are more trigger consumers than
> CONFIG_IIO_CONSUMERS_PER_TRIGGER, iio_trigger_attach_poll_func will
> silently fail. Add an error message to inform the user that
> CONFIG_IIO_CONSUMERS_PER_TRIGGER limit might be exceeded.
> 
> Signed-off-by: Mathieu Othacehe <m.othacehe@gmail.com>
> ---
>   drivers/iio/industrialio-trigger.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
> index ce66699c7fcc..801986c21467 100644
> --- a/drivers/iio/industrialio-trigger.c
> +++ b/drivers/iio/industrialio-trigger.c
> @@ -254,8 +254,12 @@ static int iio_trigger_attach_poll_func(struct iio_trigger *trig,
>   
>   	/* Get irq number */
>   	pf->irq = iio_trigger_get_irq(trig);
> -	if (pf->irq < 0)
> +	if (pf->irq < 0) {
> +		pr_err("Could not find an available irq for trigger %s, "
> +			"CONFIG_IIO_CONSUMERS_PER_TRIGGER limit "
> +			"might be exceeded\n", trig->name);
>   		goto out_put_module;
> +	}
>   
>   	/* Request irq */
>   	ret = request_threaded_irq(pf->irq, pf->h, pf->thread,
> 

This seems useful! I think it would be good to print the value of 
CONFIG_IIO_CONSUMERS_PER_TRIGGER too. Also, it appears this is 
triggering a checkpatch warning:

WARNING: quoted string split across lines

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: trigger: Print an error if there is no available irq
  2019-02-13 22:19 ` Martin Kelly
@ 2019-02-20 11:34   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2019-02-20 11:34 UTC (permalink / raw)
  To: Martin Kelly
  Cc: Mathieu Othacehe, knaack.h, lars, pmeerw, linux-iio, linux-kernel

On Wed, 13 Feb 2019 22:19:16 +0000
Martin Kelly <mkelly@xevo.com> wrote:

> On 2/13/19 5:17 AM, Mathieu Othacehe wrote:
> > If there are more trigger consumers than
> > CONFIG_IIO_CONSUMERS_PER_TRIGGER, iio_trigger_attach_poll_func will
> > silently fail. Add an error message to inform the user that
> > CONFIG_IIO_CONSUMERS_PER_TRIGGER limit might be exceeded.
> > 
> > Signed-off-by: Mathieu Othacehe <m.othacehe@gmail.com>
> > ---
> >   drivers/iio/industrialio-trigger.c | 6 +++++-
> >   1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
> > index ce66699c7fcc..801986c21467 100644
> > --- a/drivers/iio/industrialio-trigger.c
> > +++ b/drivers/iio/industrialio-trigger.c
> > @@ -254,8 +254,12 @@ static int iio_trigger_attach_poll_func(struct iio_trigger *trig,
> >   
> >   	/* Get irq number */
> >   	pf->irq = iio_trigger_get_irq(trig);
> > -	if (pf->irq < 0)
> > +	if (pf->irq < 0) {
> > +		pr_err("Could not find an available irq for trigger %s, "
> > +			"CONFIG_IIO_CONSUMERS_PER_TRIGGER limit "
> > +			"might be exceeded\n", trig->name);
> >   		goto out_put_module;
> > +	}
> >   
> >   	/* Request irq */
> >   	ret = request_threaded_irq(pf->irq, pf->h, pf->thread,
> >   
> 
> This seems useful! I think it would be good to print the value of 
> CONFIG_IIO_CONSUMERS_PER_TRIGGER too. Also, it appears this is 
> triggering a checkpatch warning:
> 
> WARNING: quoted string split across lines
Agreed, with both comments.  Sensible change though. I'll admit
I'm a bit embarrassed that I wrote it without that warning in the
first place :(

Thanks,

Jonathan


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-20 11:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-13 13:17 [PATCH] iio: trigger: Print an error if there is no available irq Mathieu Othacehe
2019-02-13 22:19 ` Martin Kelly
2019-02-20 11:34   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).