Skip to contentSkip to conversation

iio: trigger: Print an error if there is no available irq

PATCH Superseded Mathieu Othacehe 3 participants 3 messages Feb 13, 2019 – Feb 20, 2019 IIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: trigger: Print an error if there is no available irq

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.

---
 drivers/iio/industrialio-trigger.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iio/industrialio-trigger.c +5 -1
index ce66699c7fcc..801986c21467 100644
@@ -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,
Signature · 1 line
2.17.1
#1 lore raw
Quoted 19 lines · 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.

---
  drivers/iio/industrialio-trigger.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iio/industrialio-trigger.c +0 -0
index ce66699c7fcc..801986c21467 100644
@@ -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);

drivers/iio/industrialio-trigger.c static int iio_trigger_attach_poll_func(struct iio_trigger *trig, · line 265

Quoted 10 lines
drivers/iio/industrialio-trigger.c +5 -1
-	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

maintainer
#2 lore raw
Quoted 35 lines · On Wed, 13 Feb 2019 22:19:16 +0000 Martin Kelly <[email protected]> wrote:
Quoted 19 lines · 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.

---
  drivers/iio/industrialio-trigger.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iio/industrialio-trigger.c +0 -0
index ce66699c7fcc..801986c21467 100644
@@ -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);

drivers/iio/industrialio-trigger.c static int iio_trigger_attach_poll_func(struct iio_trigger *trig, · line 265

Quoted 10 lines
drivers/iio/industrialio-trigger.c +5 -1
-	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:

Quoted 1 line

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