aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/industrialio-trigger.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-06-30 05:03:36 -0400
committerDavid S. Miller <davem@davemloft.net>2016-06-30 05:03:36 -0400
commitee58b57100ca953da7320c285315a95db2f7053d (patch)
tree77b815a31240adc4d6326346908137fc6c2c3a96 /drivers/iio/industrialio-trigger.c
parent6f30e8b022c8e3a722928ddb1a2ae0be852fcc0e (diff)
parente7bdea7750eb2a64aea4a08fa5c0a31719c8155d (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Several cases of overlapping changes, except the packet scheduler conflicts which deal with the addition of the free list parameter to qdisc_enqueue(). Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/iio/industrialio-trigger.c')
-rw-r--r--drivers/iio/industrialio-trigger.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
index ae2806aafb72..0c52dfe64977 100644
--- a/drivers/iio/industrialio-trigger.c
+++ b/drivers/iio/industrialio-trigger.c
@@ -210,22 +210,35 @@ static int iio_trigger_attach_poll_func(struct iio_trigger *trig,
210 210
211 /* Prevent the module from being removed whilst attached to a trigger */ 211 /* Prevent the module from being removed whilst attached to a trigger */
212 __module_get(pf->indio_dev->info->driver_module); 212 __module_get(pf->indio_dev->info->driver_module);
213
214 /* Get irq number */
213 pf->irq = iio_trigger_get_irq(trig); 215 pf->irq = iio_trigger_get_irq(trig);
216 if (pf->irq < 0)
217 goto out_put_module;
218
219 /* Request irq */
214 ret = request_threaded_irq(pf->irq, pf->h, pf->thread, 220 ret = request_threaded_irq(pf->irq, pf->h, pf->thread,
215 pf->type, pf->name, 221 pf->type, pf->name,
216 pf); 222 pf);
217 if (ret < 0) { 223 if (ret < 0)
218 module_put(pf->indio_dev->info->driver_module); 224 goto out_put_irq;
219 return ret;
220 }
221 225
226 /* Enable trigger in driver */
222 if (trig->ops && trig->ops->set_trigger_state && notinuse) { 227 if (trig->ops && trig->ops->set_trigger_state && notinuse) {
223 ret = trig->ops->set_trigger_state(trig, true); 228 ret = trig->ops->set_trigger_state(trig, true);
224 if (ret < 0) 229 if (ret < 0)
225 module_put(pf->indio_dev->info->driver_module); 230 goto out_free_irq;
226 } 231 }
227 232
228 return ret; 233 return ret;
234
235out_free_irq:
236 free_irq(pf->irq, pf);
237out_put_irq:
238 iio_trigger_put_irq(trig, pf->irq);
239out_put_module:
240 module_put(pf->indio_dev->info->driver_module);
241 return ret;
229} 242}
230 243
231static int iio_trigger_detach_poll_func(struct iio_trigger *trig, 244static int iio_trigger_detach_poll_func(struct iio_trigger *trig,