Commit Graph

13 Commits

Author SHA1 Message Date
Jonathan Cameron 52615d4783 staging:iio:Documentation generic_buffer.c update to new abi for buffers + misc fixes
Trivial space before newline fix incorporated.

Additional fixes related to handling of sign extension and shifted
data.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>

squash into buffer handling update.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-05-19 16:14:48 -07:00
Lucas De Marchi 25985edced Fix common misspellings
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-31 11:26:23 -03:00
Michael Hennerich 8b68bb2081 Staging: IIO: Documentation: iio_utils: fix channel array generation.
The previous implementation flawed, in case some channels are not enabled.
The sorted array would then include channel information of disabled channels,
And misses the enabled ones, when the count is reached.
More troublesome, the loop would not even terminate.

The fix is twofold:

First we skip channels that are not enabled.
Then we use a tested bubble sort algorithm to sort the array.
Since we already allocated exactly the number of bytes we need.
We can exercise bubble sort on the original memory.
In all cases I've seen, the array is already sorted, so this sort
terminates immediately.

Changes since V1:
Fix coding style issues.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-03-09 15:50:28 -08:00
Michael Hennerich fc7f95a946 IIO: Documentation: iio_utils: fix mask generation
Variable sizeint is used uninitialized.
Remove sizeint completely and use bits_used instead.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-28 14:40:24 -08:00
Michael Hennerich 7ccd4506fa IIO: Documentation: iio_utils: Prevent buffer overflow
The first part of build_channel_array()identifies the number of enabled channels.
Further down this count is used to allocate the ci_array. The next section parses the
scan_elements directory again, and fills ci_array regardless if the channel is enabled or not.
So if less than available channels are enabled ci_array memory is overflowed.

This fix makes sure that we allocate enough memory. But the whole approach looks a bit
cumbersome to me. Why not allocate memory for MAX_CHANNLES, less say 64
(I never seen a part with more than that channels). And skip the first part entirely.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-28 14:40:23 -08:00
Michael Hennerich 2bf99c70ce IIO: Documentation: iio_utils: style consistency fix
No functional changes

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-28 14:40:23 -08:00
Michael Hennerich cb771cbdbd IIO: Documentation: iio_utils: Avoid double free()
filename is used and freed later

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-28 14:40:22 -08:00
roel kluin 267024a9f6 Staging: iio: --/++ confusion in build_channel_array() error cleanup
Fix loop: it should decrement

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-01-20 15:58:17 -08:00
Jonathan Cameron e58537ccce staging: iio: update example application.
The application is now considerably more generic and should cope
with all devices in tree.  The process function will need to be
extended to handle other type values as needed.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-10-08 07:17:57 -07:00
Barry Song b6ee30a27f Staging: iio-utils: fix memory overflow for dynamically allocateded memory to hold filename
Signed-off-by: Barry Song <21cnbao@gmail.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-06-04 13:38:57 -07:00
Jonathan Cameron 9d8ae6c884 staging:iio:Documentation: Rewrite example for new abi.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-11 11:36:06 -07:00
Jonathan Cameron eaf86ff939 staging:iio: Documentation, update iio_utils.h for the move to a bus
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-11 11:36:05 -07:00
Jonathan Cameron c57f1ba732 Staging: IIO: Initial documentation
This needs considerably more work, all comments / suggestions
welcomed.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:25 -07:00