diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2014-10-31 19:04:28 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-04 00:34:17 (GMT) |
commit | c39e050d21d107d26183be0f22b89eccccdbe61c (patch) | |
tree | 968e6e76a074f75380f7e28e7f5306f42740e1ac /drivers/staging/comedi/comedi_buf.c | |
parent | 272fe8f51fd8b8cd1637c8d2ca868cbff725405e (diff) | |
download | linux-c39e050d21d107d26183be0f22b89eccccdbe61c.tar.xz |
staging: comedi: remove use of 'bytes_per_sample()'
This inline helper function has been replaced with comedi_bytes_per_sample().
The same commit (bf33eb4b4f57) introduced a couple other related helper
functions a manipulate the sample size.
Use the new helper functions to remove the use of 'bytes_per_sample()' and
remove it.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/comedi_buf.c')
-rw-r--r-- | drivers/staging/comedi/comedi_buf.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index b43424d..eb3fecf 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -283,7 +283,7 @@ static unsigned int comedi_buf_munge(struct comedi_subdevice *s, { struct comedi_async *async = s->async; unsigned int count = 0; - const unsigned num_sample_bytes = bytes_per_sample(s); + const unsigned num_sample_bytes = comedi_bytes_per_sample(s); if (!s->munge || (async->cmd.flags & CMDF_RAWDATA)) { async->munge_count += num_bytes; @@ -489,7 +489,8 @@ unsigned int comedi_buf_write_samples(struct comedi_subdevice *s, * If not, clamp the nsamples to the number that will fit, flag the * buffer overrun and add the samples that fit. */ - max_samples = comedi_buf_write_n_available(s) / bytes_per_sample(s); + max_samples = comedi_bytes_to_samples(s, + comedi_buf_write_n_available(s)); if (nsamples > max_samples) { dev_warn(s->device->class_dev, "buffer overrun\n"); s->async->events |= COMEDI_CB_OVERFLOW; @@ -499,7 +500,8 @@ unsigned int comedi_buf_write_samples(struct comedi_subdevice *s, if (nsamples == 0) return 0; - nbytes = comedi_buf_write_alloc(s, nsamples * bytes_per_sample(s)); + nbytes = comedi_buf_write_alloc(s, + comedi_samples_to_bytes(s, nsamples)); comedi_buf_memcpy_to(s, data, nbytes); comedi_buf_write_free(s, nbytes); comedi_inc_scan_progress(s, nbytes); @@ -527,14 +529,16 @@ unsigned int comedi_buf_read_samples(struct comedi_subdevice *s, unsigned int nbytes; /* clamp nsamples to the number of full samples available */ - max_samples = comedi_buf_read_n_available(s) / bytes_per_sample(s); + max_samples = comedi_bytes_to_samples(s, + comedi_buf_read_n_available(s)); if (nsamples > max_samples) nsamples = max_samples; if (nsamples == 0) return 0; - nbytes = comedi_buf_read_alloc(s, nsamples * bytes_per_sample(s)); + nbytes = comedi_buf_read_alloc(s, + comedi_samples_to_bytes(s, nsamples)); comedi_buf_memcpy_from(s, data, nbytes); comedi_buf_read_free(s, nbytes); comedi_inc_scan_progress(s, nbytes); |