From: Lars-Peter Clausen <lars@metafoo.de>
To: Denis CIOCCA <denis.ciocca@st.com>
Cc: jic23@kernel.org, linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio:trigger: Added iio-hrtimer-trigger
Date: Sat, 28 Sep 2013 12:13:47 +0200 [thread overview]
Message-ID: <5246ABDB.5090005@metafoo.de> (raw)
In-Reply-To: <1380014789-8636-2-git-send-email-denis.ciocca@st.com>
On 09/24/2013 11:26 AM, Denis CIOCCA wrote:
> This patch adds high resolution timer trigger support for iio framework.
>
I think the driver is mostly fine (a couple of minor comments inline). But
maybe we should give some more though how we want to deal with the creation
and deletion of software triggers like this one. Half of the code in this
drivers is boiler plate code copied from the sysfs trigger and is dealing
with creating and deleting the triggers.
[...]
> diff --git a/drivers/iio/trigger/Makefile b/drivers/iio/trigger/Makefile
> index 0694dae..4e1876d 100644
> --- a/drivers/iio/trigger/Makefile
> +++ b/drivers/iio/trigger/Makefile
> @@ -5,3 +5,4 @@
> # When adding new entries keep the list in alphabetical order
> obj-$(CONFIG_IIO_INTERRUPT_TRIGGER) += iio-trig-interrupt.o
> obj-$(CONFIG_IIO_SYSFS_TRIGGER) += iio-trig-sysfs.o
> +obj-$(CONFIG_IIO_HRTIMER_TRIGGER) += iio-trig-hrtimer.o
Alphabetical order, please.
[...]
> +static ssize_t iio_hrtimer_trigger_set_freq_value(struct device *dev,
> + struct device_attribute *attr, const char *buf, size_t len)
> +{
> + int ret;
> + u16 frequency;
> + struct iio_trigger *trig = to_iio_trigger(dev);
> + struct iio_hrtimer_trigger_data *trig_data =
> + iio_trigger_get_drvdata(trig);
> +
> + ret = kstrtou16(buf, 10, &frequency);
> + if (ret < 0)
> + return ret;
> +
> + if (frequency > MAX_UNSIGNED_INT16)
Will never be true with frequency being a u16.
> + return -EINVAL;
> +
> + trig_data->freq = frequency;
> +
> + if (frequency)
> + trig_data->period =
> + ktime_set(0, NSEC_PER_SEC / trig_data->freq);
> +
> + return len;
> +}
[...]
> +
> +enum hrtimer_restart iio_hrtimer_trigger_func(struct hrtimer *timer)
> +{
> + struct iio_hrtimer_trigger_data *trig_data;
> +
> + trig_data = container_of(timer, struct iio_hrtimer_trigger_data, timer);
> +
> + hrtimer_forward_now(timer, trig_data->period);
> + iio_trigger_poll(trig_data->trig, 0);
iio_trigger_poll(trig_data->trig, iio_get_time_ns());
> +
> + return HRTIMER_RESTART;
> +}
[...]
next prev parent reply other threads:[~2013-09-28 10:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-24 9:26 Added hrtimer trigger v2 Denis CIOCCA
2013-09-24 9:26 ` [PATCH] iio:trigger: Added iio-hrtimer-trigger Denis CIOCCA
2013-09-28 10:13 ` Lars-Peter Clausen [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-09-29 19:36 IIO hrtimer trigger Denis CIOCCA
2013-09-29 19:36 ` [PATCH] iio:trigger: Added iio-hrtimer-trigger Denis CIOCCA
2013-09-23 10:51 Added hrtimer trigger support Denis CIOCCA
2013-09-23 10:51 ` [PATCH] iio:trigger: Added iio-hrtimer-trigger Denis CIOCCA
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5246ABDB.5090005@metafoo.de \
--to=lars@metafoo.de \
--cc=denis.ciocca@st.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).