[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5547CE60.5000300@metafoo.de>
Date: Mon, 04 May 2015 21:54:08 +0200
From: Lars-Peter Clausen <lars@...afoo.de>
To: Daniel Baluta <daniel.baluta@...el.com>, jic23@...nel.org
CC: jlbec@...lplan.org, knaack.h@....de, linux-kernel@...r.kernel.org,
linux-iio@...r.kernel.org, octavian.purdila@...el.com,
pebolle@...cali.nl, patrick.porlan@...el.com,
adriana.reus@...el.com, constantin.musca@...el.com,
marten@...uitiveaerial.com
Subject: Re: [PATCH v5 3/4] iio: trigger: Introduce IIO hrtimer based trigger
On 05/04/2015 12:50 PM, Daniel Baluta wrote:
[...]
> +IIO_HRTIMER_INFO_ATTR(sampling_frequency, S_IRUGO | S_IWUSR,
> + iio_hrtimer_info_show_sampling_frequency,
> + iio_hrtimer_info_store_sampling_frequency);
I wonder if the sampling frequency should be configurable the regular IIO
API, just like any other IIO device. But things like min/max sampling
frequency should be configured in configfs.
[...]
> +#endif /* CONFIGFS_FS */
> +
[...]
> +static struct iio_sw_trigger *iio_trig_hrtimer_probe(const char *name)
> +{
[...]
> +#ifdef CONFIG_CONFIGFS_FS
> + config_group_init_type_name(&trig_info->swt.group, name,
> + &iio_hrtimer_type);
> +#endif
This should probably have a helper function in the sw trigger core, that
gets stubbed out when CONFIG_FS is disabled. Otherwise we'll see the same
#ifdef in every software trigger driver.
[...]
> +}
> +
> +static int iio_trig_hrtimer_remove(struct iio_sw_trigger *swt)
> +{
> + struct iio_hrtimer_info *trig_info;
> +
> + trig_info = iio_trigger_get_drvdata(swt->trigger);
> +
> + hrtimer_cancel(&trig_info->timer);
> +
> + iio_trigger_unregister(swt->trigger);
> + iio_trigger_free(swt->trigger);
There is a bit of a race condition here. hrtimer_cancel() should be called
between unregister and free, otherwise it might be re-armed before it is
unregistered.
> + kfree(trig_info);
> +
> + return 0;
> +}
> +
> +struct iio_sw_trigger_ops iio_trig_hrtimer_ops = {
const
> + .probe = iio_trig_hrtimer_probe,
> + .remove = iio_trig_hrtimer_remove,
> +};
[...]
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists