staging: comedi: introduce some sample size manipulation functions
authorIan Abbott <abbotti@mev.co.uk>
Thu, 23 Oct 2014 12:47:51 +0000 (13:47 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Oct 2014 08:12:41 +0000 (16:12 +0800)
commitbf33eb4b4f57d277eac611b5d331976059bcc700
tree9425391e7bde9f8fd40b35bbb724c15deb2c4107
parent7885b070b83ce5c8fb42bf65047e7dd6388d7b20
staging: comedi: introduce some sample size manipulation functions

Introduce a few static inline helper functions:

`comedi_bytes_per_sample(s)` is the same as the existing
`bytes_per_sample(s)` and determines the size of a comedi sample in
bytes.  (`bytes_per_sample(s)` will be removed.)

`comedi_sample_shift(s)` determines the log2 of the comedi sample size,
so it can be used in bit-shift operations to multiply or divide by the
sample size.

`comedi_bytes_to_samples(s, nbytes)` converts a number of bytes to a
number of samples (rounding down).

`comedi_samples_to_bytes(s, nsamples)` converts a number of samples to a
number of bytes.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedidev.h