Skip to content
Snippets Groups Projects
Commit 27d0a81a authored by Alessandro Rubini's avatar Alessandro Rubini
Browse files

core: accept zero-size time csets


This commit allows zero-size channels to exist. The feature is used
for TDC and DTC (time to digital converters and the opposite).  This
simple change in the core allows to implement TDC drivers that only
return the control (which includes a time stamp) and no data.

For DTC to work we need some modification to chardev.c, which are not
there yet.

Signed-off-by: default avatarAlessandro Rubini <rubini@gnudd.com>
Acked-by: default avatarFederico Vaga <federico.vaga@gmail.com>
parent 72557096
Branches
No related merge requests found
......@@ -220,7 +220,12 @@ static int _zdev_template_check_and_init(struct zio_device *zdev,
name, cset->index);
return -EINVAL;
}
if (!cset->ssize) {
/*
* Only time-type can have a zero-sized sample. This
* protects against users who forgot to fill fields.
*/
if (!cset->ssize &&
(cset->flags & ZIO_CSET_TYPE) != ZIO_CSET_TYPE_TIME) {
dev_err(&zdev->head.dev,
"ssize can not be 0 in %s cset%i\n",
name, cset->index);
......
......@@ -527,11 +527,7 @@ static int chan_register(struct zio_channel *chan, struct zio_channel *chan_t)
goto out_zattr_check;
}
ctrl->nsamples = chan->cset->ti->nsamples;
ctrl->nbits = __get_nbits(chan);
if (!ctrl->nbits) {
err = -EINVAL; /* message already printed */
goto out_ctrl_bits;
}
ctrl->nbits = __get_nbits(chan); /* may be zero */
/* ctrl->addr.family = PF_ZIO */
ctrl->addr.cset = chan->cset->index;
ctrl->addr.chan = chan->index;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment