aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/meter/ade7854-i2c.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-04-03staging: iio: add proper SPDX identifiers to remaining driver filesGreg Kroah-Hartman1-2/+1
There are a number of IIO staging drivers that do not have a proper SPDX identifier on it. So fix that up and at the same time, remove the "free form" license text, as that's pretty much impossible for any tool to parse. Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Michael Hennerich <Michael.Hennerich@analog.com> Cc: Jonathan Cameron <jic23@kernel.org> Cc: Hartmut Knaack <knaack.h@gmx.de> Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-24staging:iio:ade7854: Remove read_reg_* duplicationsRodrigo Siqueira1-32/+1
The original code had a read function per data size; after updates, all read functions tasks were centralized in a single function, but the old signature was kept to maintain the module working without problems. This patch removes a set of duplications associated with read_reg_*, and update the areas that calling the old interface by the new one. Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging:iio:ade7854: Rework I2C read functionRodrigo Siqueira1-69/+37
The read operation for the I2C function has many duplications that can be generalized into a single function. This patch reworks the read operation for I2C to centralizes all similar code in a single function. It is possible to remove all the old interface to use the new one, however, for keeping the things simple and working this patch maintain legacy interface. Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging:iio:ade7854: Remove write_reg_* duplicationsRodrigo Siqueira1-32/+1
This patch removes code duplications related to the write_reg_* functions and centralizes them in a single function. Also, it eliminates the legacy functions and replaces them by a unique signature that is used by SPI and I2C. Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging:iio:ade7854: Rework I2C write functionRodrigo Siqueira1-50/+46
The write operation using I2C has many code duplications and four different interfaces per data size. This patch introduces a single function that centralizes the main tasks. The central function inserted by this patch can easily replace all the four functions related to the data size. However, this patch does not remove any code signature for keeping the meter module work and make easier to review this patch. Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging:iio:ade7854: Fix the wrong number of bits to readJohn Syne1-1/+1
Fixes: correctly handle the data size in the read operation for I2C The function ade7854_i2c_read_reg_32() have to invoke the i2c_master_recv() for read 32 bits values, however, the counter is set to 3 which means 24 bits. This patch fixes the wrong size of 24 bits, to 32 bits. Signed-off-by: John Syne <john3909@gmail.com> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Fixes: 8d97a5877 ("staging: iio: meter: new driver for ADE7754 devices") Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging:iio:ade7854: Fix error handling on read/writeJohn Syne1-12/+12
The original code does not correctly handle the error related to I2C read and write. This patch fixes the error handling related to all read/write functions for I2C. Signed-off-by: John Syne <john3909@gmail.com> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Fixes: 8d97a5877 ("staging: iio: meter: new driver for ADE7754 devices") Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-02-24staging:iio:meter: Add name to function definition argumentsRodrigo Siqueira1-14/+14
This patch fixes the checkpatch.pl warning: drivers/staging/iio/meter/ade7854.h:157: WARNING: function definition argument 'struct device *' should also have an identifier name... This commit adds arguments names to the signature declared in the ade7854_state struct. For consistency reason, It also renames all arguments in function definitions. Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2016-03-11staging: iio: ade7854: use devm_iio_device_registerAlison Schofield1-6/+0
Replace iio_device_register with the device managed version. This change is safe because it does not change the order of any device removal actions. Unregistering the device was the only removal action. The newly emptied .remove functions are deleted. Signed-off-by: Alison Schofield <amsfield22@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-09drivers: staging: iio: meter: Removed unnecessary variableTina Johnson1-4/+1
Variable ret is used only to store the return value. Hence ret is removed and the return statement modified. Coccinelle was used to detect such removable variables: @rule1@ identifier ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Tina Johnson <tinajohnson.1234@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01Staging: iio: meter: ade7854-i2c: code style improvementsTolga Ceylan1-1/+1
Code reformatting based on checkpatch.pl with --strict: Comparison to NULL rewritten as !indio_dev Signed-off-by: Tolga Ceylan <tolga.ceylan@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01Staging: iio: meter: ade7854-i2c: code style improvementsTolga Ceylan1-1/+2
Code reformatting based on checkpatch.pl with --strict: Lines over 80 characters were fixed Signed-off-by: Tolga Ceylan <tolga.ceylan@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01Staging: iio: meter: ade7854-i2c: code style improvementsTolga Ceylan1-17/+17
Code reformatting based on checkpatch.pl with --strict: Alignment should match open paranthesis cases corrected Signed-off-by: Tolga Ceylan <tolga.ceylan@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-14staging: iio: ade7854: Use devm_iio_device_allocSachin Kamat1-3/+1
devm_iio_device_alloc makes code simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Barry Song <21cnbao@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-21staging: iio: remove use of __devexit_pBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21staging: iio: remove use of __devexitBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21staging: iio: remove use of __devinitBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-14staging:iio:meter: Use dev_to_iio_dev()Lars-Peter Clausen1-8/+8
Replace open-coded instances of getting a iio_dev struct from a device struct with dev_to_iio_dev(). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-29staging:iio: Streamline API function namingLars-Peter Clausen1-2/+2
Currently we use two different naming schemes in the IIO API, iio_verb_object and iio_object_verb. E.g iio_device_register and iio_allocate_device. This patches renames instances of the later to the former. The patch also renames allocate to alloc as this seems to be the preferred form throughout the kernel. In particular the following renames are performed by the patch: iio_put_device -> iio_device_put iio_allocate_device -> iio_device_alloc iio_free_device -> iio_device_free iio_get_trigger -> iio_trigger_get iio_put_trigger -> iio_trigger_put iio_allocate_trigger -> iio_trigger_alloc iio_free_trigger -> iio_trigger_free The conversion was done with the following coccinelle patch with manual fixes to comments and documentation. <smpl> @@ @@ -iio_put_device +iio_device_put @@ @@ -iio_allocate_device +iio_device_alloc @@ @@ -iio_free_device +iio_device_free @@ @@ -iio_get_trigger +iio_trigger_get @@ @@ -iio_put_trigger +iio_trigger_put @@ @@ -iio_allocate_trigger +iio_trigger_alloc @@ @@ -iio_free_trigger +iio_trigger_free </smpl> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-25IIO: Move core headers to include/linux/iioJonathan Cameron1-1/+1
Step 1 in moving the IIO core out of staging. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2011-11-17staging:iio: Use module_i2c_driver to register I2C driversLars-Peter Clausen1-13/+1
Use the newly introduced module_i2c_driver macro for registering I2C drivers. This allows us to remove a few lines of boilerplate code. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-25staging: Add module.h to drivers/staging usersPaul Gortmaker1-0/+1
Lots of people expect module.h to just "be there" without any #include effort. But we are crushing that. So fix those files in staging relying on implicit module.h presence. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28staging:iio:meter:ade7854: Allocate buffers in state and state with iio_dev.Jonathan Cameron1-20/+19
Requires moving a few things around, but should be no functional changes. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-11-09staging: iio: meter: new driver for ADE7854/58/68/78 devicesBarry Song1-0/+272
Signed-off-by: Barry Song <barry.song@analog.com> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>