From 3613decdef98bae4d267dd55b412de447fc1fe5c Mon Sep 17 00:00:00 2001 From: Alessandro Rubini <rubini@gnudd.com> Date: Thu, 17 Jan 2013 16:47:29 +0100 Subject: [PATCH] core: rename a simple function, fix re-arming triggers zio_cset_is_self_timed() only returned true for input channels. This is needed, but the name is wrong: use zio_cset_early_arm() instead. An output channel can be self-timed as well, so trigger_data_done check the flag directly, not early_arm(). Every self-timed cset must be rearmed when the trigger fired. Signed-off-by: Alessandro Rubini <rubini@gnudd.com> Acked-by: Federico Vaga <federico.vaga@gmail.com> --- helpers.c | 3 ++- include/linux/zio.h | 2 +- objects.c | 6 +++--- triggers/zio-trig-user.c | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/helpers.c b/helpers.c index 40077df..f32d392 100644 --- a/helpers.c +++ b/helpers.c @@ -159,7 +159,8 @@ EXPORT_SYMBOL(zio_arm_trigger); */ void zio_trigger_data_done(struct zio_cset *cset) { - int self_timed = zio_cset_is_self_timed(cset); + int self_timed = cset->flags & ZIO_CSET_SELF_TIMED; + unsigned long flags; spin_lock_irqsave(&cset->lock, flags); diff --git a/include/linux/zio.h b/include/linux/zio.h index f478d5e..f5a6e4b 100644 --- a/include/linux/zio.h +++ b/include/linux/zio.h @@ -212,7 +212,7 @@ enum zio_cset_flags { }; /* Check the flags so we know whether to arm immediately or not */ -static inline int zio_cset_is_self_timed(struct zio_cset *cset) +static inline int zio_cset_early_arm(struct zio_cset *cset) { unsigned long flags = cset->flags; diff --git a/objects.c b/objects.c index bb7ce63..f09568d 100644 --- a/objects.c +++ b/objects.c @@ -331,7 +331,7 @@ int zio_change_current_trigger(struct zio_cset *cset, char *name) spin_unlock_irqrestore(&cset->lock, flags); /* Finally, arm it if so needed */ - if (zio_cset_is_self_timed(cset)) + if (zio_cset_early_arm(cset)) zio_arm_trigger(ti); return 0; @@ -434,7 +434,7 @@ int zio_change_current_buffer(struct zio_cset *cset, char *name) spin_unlock_irqrestore(&cset->lock, flags); /* Finally, arm the trigger if so needed */ - if (zio_cset_is_self_timed(cset)) + if (zio_cset_early_arm(cset)) zio_arm_trigger(ti); return 0; @@ -775,7 +775,7 @@ static int cset_register(struct zio_cset *cset, struct zio_cset *cset_t) ti->flags &= ~ZIO_DISABLED; spin_unlock_irqrestore(&cset->lock, flags); - if (zio_cset_is_self_timed(cset)) + if (zio_cset_early_arm(cset)) zio_arm_trigger(ti); return 0; diff --git a/triggers/zio-trig-user.c b/triggers/zio-trig-user.c index 4d65537..9649589 100644 --- a/triggers/zio-trig-user.c +++ b/triggers/zio-trig-user.c @@ -56,7 +56,7 @@ static void ztu_pull_block(struct zio_ti *ti, struct zio_channel *chan) pr_debug("%s:%d\n", __func__, __LINE__); /* For self-timed devices, we have no pull, as it's already armed */ - if (zio_cset_is_self_timed(ti->cset)) + if (zio_cset_early_arm(ti->cset)) return; /* Otherwise, the user sets the input timing by reading */ getnstimeofday(&ti->tstamp); -- GitLab