aboutsummaryrefslogtreecommitdiffstats
path: root/tools/iio
AgeCommit message (Collapse)Author
2015-05-31tools:iio:iio_event_monitor: save right errnoHartmut Knaack
Move up error handling code to preserve the errno coming from ioctl(), before it may be changed by close(). Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-31tools:iio: save errno firstHartmut Knaack
The man-page of errno states, that errno should be saved before doing any library call, as that call may have changed the value of errno. So, when encountering any error, save errno first. This patch affects generic_buffer.c, iio_event_monitor.c and iio_utils.c. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-31tools:iio:lsiio: add closedir before exitHartmut Knaack
In dump_channels() the DIR *dp was left open on exit. Close it and check for errors. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-31tools:iio:iio_utils: fix allocation handlingHartmut Knaack
In build_channel_array(), count needs to be decreased in more places since current->name and current->generic_name would be freed on the error path, although they have not been allocated, yet. This also requires to free current->name, when it is allocated, but current->generic_name is not yet allocated. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-31tools:iio: free channel-array completelyHartmut Knaack
In iio_utils.c build_channel_array() dynamically allocates the string generic_name in the current iio_channel_info, which doesn't got freed in case of an error. This dynamically allocated channel-array is used by generic_buffer, and needs to be freed on the error/exit path. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-31tools:iio:iio_utils: free scan_el_dir on exitHartmut Knaack
In the error path, the string scan_el_dir got freed, while it was missing when build_channel_array() finished without errors. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-31tools:iio:generic_buffer: free dev_dir_name on exitHartmut Knaack
Make sure to free dev_dir_name in case of an error or regular exit. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-31tools:iio:generic_buffer: fix order of freeing dataHartmut Knaack
data gets allocated before buffer_access, so it should be freed in reverse order. Otherwise, if allocating buffer_access fails, an attempt to free it would be taken, which should not happen. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10iio: make tools more cross-compilation friendlyLinus Walleij
When cross-compiling the IIO tools we need to opportunity to specify a cross compiler prefix and some extra CFLAGS. This patch enables this in the same way as for other stuff in tools. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-03-28tools: iio: generic_buffer: Fix generic scale extractionIrina Tirdea
When using generic_buffer to read data, the scale is not properly detected for scale shared by type. This is caused by a problem with the generation of generic name out of the full name. E.g.: for current->name in_accel_z, the extracted generic name is "in" (when it should be "in_accel"). This is used in generic_buffer to generate scale and offset paths (in_accel_scale). Consider the in_ or out_ prefix when extracting the generic name from the full name. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Reviewed-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-03-24Merge tag 'iio-for-4.1a' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: First set of new drivers, cleanups and functionality for IIO in the 4.1 cycle. New drivers * CM3323 color sensor. * MS5611 pressure and temperature sensor. New functionality * mup6050 - create mux clients for devices described via ACPI. The reasoning and approach taken in this patch are complex. Basically there is no otherway of finding out what is there than by some esoteric look ups in the ACPI data. * cm3232 - PM support * itg3200 - suspend/resume support * mcp320x - add more ADCs to the kconfig to reflect what the driver supports (this patch and the bindings got left behind when the support was added a while back). Docs / utils * ti-adc128s052 - DT bindings. * mcp3422 - DT bindings. * mcp320x - DT bindings * ABI docs for event threshold scale attributes, in_magn_offset, proximity scan_element and thresh falling/rising values for accelerometers. All elements long in use that have slipped by being explicitly documented. * Tidy up the tools previously in drivers/staging/iio/Documentation and move them out to /tools/iio. Yet another move that should have happened long ago. This time Roberta Dobrescu did the leg work. Thanks! Core Cleanups * Export userspace IIO headers. We should have done the appropriate header splitting a long time ago. Thanks to Daniel for sorting this out. * Refactor the registring of attributes for buffers to move all non-custom ones to a vector allowing easier additions to the current set in the future. Driver Cleanups * gpiod related cleanups. Make use of the additional parameter to specify initial direciton to avoid extra code. * bmc150 - Various refactorings to reduce code repitition and prepare for hardware buffer support. Some of these cleanups are good even without the new functionality. * kmx61 - direct use of index to an array avoiding a structure element which was always the index to an element in an array of that structure. * vf610 - avoid incorrect type for return from wait_for_completion_timeout. * gp2ap020a00f - use put_unaligned_le32 for slight code simplification. * ade7754 - improve error handling including suppressing some build warnings. * ade7759 - improve error handling including suppressing some build warnings. * hmc5843 - Long line and indentation fixes. Also some constifying of various constant data. * ade7854 - 80+ character line splitting. * ad2s1210 - fix wrong printf format string. * mxs-lradc - fix wrong printf format string. * ade7954-i2c - code alignment fixes and other trivial but worthwhile bits. * periodic rtc trigger - make the frequency type an unsigned int as it is always treated as such. * jsa1212 - constify struct regmap_config as it is constant. * ad7793 - typo in the MODULE_DESCRIPTION * mma9551 - check gpiod_to_irq errors. Note that this doesn't actually cause any trouble but is worth tidying up as obviously incorrect. * mlx90614 - refactor the register symbols to make it clear which reads are to RAM not PROM.
2015-03-09tools: iio: lsiio: Remove unused variablesRoberta Dobrescu
This patch removes unused variables from lsiio.c in order to get rid of the warnings regarding them. Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-03-09tools: iio: Define _GNU_SOURCE in MakefileRoberta Dobrescu
Definition of _GNU_SOURCE is needed to get rid of some warnings, such as: warning: implicit declaration of function `asprintf'. generic_buffer.c and iio_event_monitor.c define _GNU_SOURCE, but it is also needed in lsiio.c and iio_utils.c. For this reason, this patch adds the definition in Makefile and removes it from where it already exists. Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-03-09iio: Move iio userspace applications out of stagingRoberta Dobrescu
This patch moves iio userspace applications out of staging, to tools/iio/ and adds a Makefile in order to compile them easily. It also adds tools/iio/ to MAINTAINERS file. Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>