fixed CHECK: Lines should not end with a '('
reported by checkpatch.pl
Signed-off-by: Ashish Kalra <eashishkalra@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Line up arguments to opening parentheses and ensure lines stay under 80
columns, since checkpatch.pl was complaining about incorrect indentation
in function calls and definitions.
Signed-off-by: Zebulon McCorkle <zebmccorkle@zeb.fun>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
checkpatch.pl reported the bitshifts (1<<x) as a style violation, so
change them to the BIT macro (BIT(x)).
Signed-off-by: Zebulon McCorkle <zebmccorkle@zeb.fun>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch removes macros in XGI_main.h that contain a xgifb_info
variable. These macros hurt readability by hiding said variable
behind a define. It also uses a temporary variable to keep the
replaced code from getting too long.
Signed-off-by: Joshua Abraham <j.abraham1776@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Func definitions in the aead implementation were did not adhere to
coding style. Fix them for better readability.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The aead files was using a func naming convention which was inconsistent
(ssi vs. cc), included a useless prefix (ssi_aead) and often used
too long function names producing monster func names such as
ssi_aead_gcm_setup_ghash_desc() that made the call site code hard
to read.
Make the code more readable by switching to a simpler, consistent naming
conventionfor all the function defined in the file.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
backup_info field is only allocated for decrypt code path.
The field was not nullified when not used causing a kfree
in an error handling path to attempt to free random
addresses as uncovered in stress testing.
Fixes: 737aed947f ("staging: ccree: save ciphertext for CTS IV")
Cc: stable@vger.kernel.org
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Update the ccree staging TODO list in light of recent work.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Remove braces from single statement if clause.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix indentation of var assignment split across lines for
better readability.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The removal of likely/unlikely unearthed some more
unnecessary parentheses. Remove them for better readability.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The ccree code made a lot of use of likely/unlikely qualifiers without
proven measurements showing any benefits. Remove them all until we
see what is justified and what is not.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The ccree drivers was marking a lot of big functions in C file as
static inline for no good reason. Remove the inline qualifier from
any but the few truly single line functions.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This was found using checkpatch.pl's EMBEDDED_FUNCTION_NAME warning.
It is easier to be consistent and always use __func__ instead of having
to remember to update any hardcoded references to the original name.
Signed-off-by: Genki Sky <sky@genki.is>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This was found using checkpatch.pl's SPLIT_STRING warning. While joining
these strings makes for long lines, the kernel codebase consistently
does it this way to make user-visible strings easier to grep for.
Signed-off-by: Genki Sky <sky@genki.is>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This was found using checkpatch.pl's MULTILINE_DEREFERENCE warning.
Putting the dereference onto one line makes them easier to read,
especially when part of a larger expression (in this case, function
arguments and ternary operator), and when the dereferences are short
(as they are here).
Signed-off-by: Genki Sky <sky@genki.is>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
New device support
* IDT Z0PT2201 ambient light and UVB sensor
- new driver and DT bindings.
* MAX30102 (pulse oximetery sensor)
- support for MAX30105 sensor (smoke detector) Just goes to show
how two supposedly totally different applications can use very similar
devices.
* UVIS25 UV sensor
- new driver and DT bindings.
Major new features
* at91-sama5d2-adc
- DMA support including bindings + a fix for an issue with acking the
interrupt to prevent false overrun reports.
* ina2xx
- allow control of shunt voltage PGA and bus voltage range to give better
accuracy in some cases.
* stm32-adc
- support differential channels (precursor patch reworked how channel names
were created to enable this).
Cleanups / minor fixes / features
* core
- mark a deliberate switch fallthrough.
- macro to populate struct iio_map array elements.
* docs
- typo fix.
* MAINTAINERS
- add some missing entries for IIO ABI files.
* ad7152
- tidy up unlocking paths.
* ad7746
- tidy up unlocking paths.
* ak8975
- add an ACPI id found on a prototype board.
* aspeed-adc
- deassert reset in probe to ensure device is usable.
* bfin-trigger
- platform_get_irq return value fixing.
* bmc150
- OF device ID table for i2c (spi to be done).
* cros_ec
- unused variable cleanup.
* da208
- ACPI binding seen on Linx 820 tablet.
* ina2xx
- shift down raw value to drop status flags from value (likely to have
been hidden in the noise).
- tidy up a special case that wasn't needed.
* inv_mpu6050
- i2c_unregister_device knows about null values so don't check it twice.
* kxsd9
- fix missing MODULE_LICENSE and MODULE_DESCRIPTION.
* max30102
- missing new lines in dev_err.
- inconsistent punctuation in error messages.
- fix LED mode mask number of bits.
- check return value of power mode functions to handle errors.
- introduce an intensity channel macro to reduce duplication.
- fix minor issue where device wasn't necessarily enabled during
a get temperature.
- use indicies for LED channels.
- move the mode seetting to buffer_postenable - precursor to new device
support.
- prepare to allow copying of varying numbers of measurement.
* meson-saradc
- drop irrelevant clock and update bindings.
* mma8452
- a couple of renames for readability reasons.
* qcom_vadc
- fix missing MODULE_LICENSE and MODULE_DESCRIPTION.
* st_accel
- drop an unused variable.
* sx9500
- add an ACPI id found on a prototype board.
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAloizUQRHGppYzIzQGtl
cm5lbC5vcmcACgkQVIU0mcT0FogGjA/9GmfFvAzoPyzcQvUFOSCIwHPcX72erA7v
4CdHrFUQgISYMM2sMBA6Pk9YEHe392VVLARVWqm0jbPxapJ9P3Z3JXpQuX/0iGgo
S2l577xt8xjYgd5st4oMxSG31Ayse7TnRxN/khySo6uFbWg5tfixjzCehCAkfbAE
RD51MLS950RdTJeGtgujMCSY6Ax891qjJUdfJk5BqktSULdXqRKikuYoB7ugENpT
buaJi8FGD87wb832QzpJ2lobL+TRVdNyJuxzHYSJiG2Y9TV5fs0nOJTcQQ4+pTtT
MIoAupUg5hrgxYGfWYA+CA4IQEjJvl1PqZMRWat35VpLLD5Rd6bu2PFk7UJcJdt4
IfjhNuGtfPqIb8a8VTTP8ksxyHjhTJjAtB52gxkyEa+1a+ZsP0BaRtSBni+k8NAI
2ekzttML66Wvd3fDOkcG/ULOe+jo1E2JzFflHkVmLyiJOprWA4qb+lt1jiC/8Lrg
9dE1DWc+ZLkDQaGjCU0YPqoP7rK9Gmdbh6wfIE2Hn/5r8l0MuSlYduxDyC2rB/O9
AcdtSbZ0TVJrIkmcRk0/2VyFWKeqrqFLtR0UtsESYON2fUZWn83VkMa3kRuMFn22
A2O1GKi+wzOgGKUUeTuYu5L2I3ltYEUHZT9L/Y3sf0+3/nm5vCNHJEN16eYyht3I
7SHCdJRgWjU=
=ICgu
-----END PGP SIGNATURE-----
Merge tag 'iio-for-4.16a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
First set of new device support, cleanups and features for IIO in the 4.16 cycle
New device support
* IDT Z0PT2201 ambient light and UVB sensor
- new driver and DT bindings.
* MAX30102 (pulse oximetery sensor)
- support for MAX30105 sensor (smoke detector) Just goes to show
how two supposedly totally different applications can use very similar
devices.
* UVIS25 UV sensor
- new driver and DT bindings.
Major new features
* at91-sama5d2-adc
- DMA support including bindings + a fix for an issue with acking the
interrupt to prevent false overrun reports.
* ina2xx
- allow control of shunt voltage PGA and bus voltage range to give better
accuracy in some cases.
* stm32-adc
- support differential channels (precursor patch reworked how channel names
were created to enable this).
Cleanups / minor fixes / features
* core
- mark a deliberate switch fallthrough.
- macro to populate struct iio_map array elements.
* docs
- typo fix.
* MAINTAINERS
- add some missing entries for IIO ABI files.
* ad7152
- tidy up unlocking paths.
* ad7746
- tidy up unlocking paths.
* ak8975
- add an ACPI id found on a prototype board.
* aspeed-adc
- deassert reset in probe to ensure device is usable.
* bfin-trigger
- platform_get_irq return value fixing.
* bmc150
- OF device ID table for i2c (spi to be done).
* cros_ec
- unused variable cleanup.
* da208
- ACPI binding seen on Linx 820 tablet.
* ina2xx
- shift down raw value to drop status flags from value (likely to have
been hidden in the noise).
- tidy up a special case that wasn't needed.
* inv_mpu6050
- i2c_unregister_device knows about null values so don't check it twice.
* kxsd9
- fix missing MODULE_LICENSE and MODULE_DESCRIPTION.
* max30102
- missing new lines in dev_err.
- inconsistent punctuation in error messages.
- fix LED mode mask number of bits.
- check return value of power mode functions to handle errors.
- introduce an intensity channel macro to reduce duplication.
- fix minor issue where device wasn't necessarily enabled during
a get temperature.
- use indicies for LED channels.
- move the mode seetting to buffer_postenable - precursor to new device
support.
- prepare to allow copying of varying numbers of measurement.
* meson-saradc
- drop irrelevant clock and update bindings.
* mma8452
- a couple of renames for readability reasons.
* qcom_vadc
- fix missing MODULE_LICENSE and MODULE_DESCRIPTION.
* st_accel
- drop an unused variable.
* sx9500
- add an ACPI id found on a prototype board.
The GPIO core provides a handy GPIO_LOOKUP() macro to populate a struct
gpiod_lookup array without having to spell out attribute names (but
still avoid breakage when attributes within the struct are rearranged
or added).
The axp288_adc.c driver uses a similar macro to populate a struct
iio_map array. Make it available to others.
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The platform_get_irq() function returns negative if an error occurs.
zero or positive number on success. platform_get_irq() error checking
for zero is not correct.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.
But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.
The I2C device ID table entries have the .driver_data field set, but they
are not used in the driver so weren't set in the OF device table entries.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Update the doc as the SAR ADC modules doesn't require "sana" clock.
Singed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The "sana" clock is not used at SAR ADC module in Amlogic Meson SoC,
it is irrelevant for the SAR ADC.
Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Pointer pdata is being assigned but it is never being used, hence
it is redundant and can be removed. Cleans up clang warning:
drivers/iio/accel/st_accel_core.c:952:3: warning: Value stored to 'pdata'
is never read
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This adds an ACPI table to the driver and the ACPI ID of the sensor
on the tablet.
Signed-off-by: Luke Ross <luke@lukeross.name>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
add support for STMicroelectronics UVIS25 uv sensor
http://www.st.com/resource/en/datasheet/uvis25.pdf
- continuos mode support
- i2c support
- spi support
- trigger mode support
- system PM support
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The ASPEED SoC must deassert a reset in order to use the ADC peripheral.
The device tree bindings are updated to document the resets phandle, and
the example is updated to match what is expected for both the reset and
clock phandle. Note that the bindings should have always had the reset
controller, as the hardware is unusable without it.
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Cc: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The Maxim MAX30105 part adds a third LED (green) and uses a multi-LED
measuring mode producing three measurements
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Current code assumes always 2 measurements (6 bytes) have to be copied,
prepare for more flexibility
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Move the programming of the mode setting from init() to
buffer_postenable()
Split out a separate function to
only update the power/shutdown bit
This changes permits to more easily implement different
modes of measurements in further patches
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Chip must not be in shutdown for reading temperature, so briefly leave
shutdown if buffer is not already running
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stalder <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Table 4 of the datasheet specifies the mode control, these are not
individual bits; add multi LED mode
Add multi-LED mode and fix MODE_MASK (3 bits wide, not 2)
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
STM32H7 ADC channels can be configured either as single ended or
differential with 'st,adc-channels' or 'st,adc-diff-channels'
(positive and negative input pair: <vinp vinn>, ...).
Differential channels have different offset and scale, from spec:
raw value = (full_scale / 2) * (1 + (vinp - vinn) / vref).
Add offset attribute.
Differential channels are selected by DIFSEL register. Negative
inputs must be added to pre-selected channels as well (PCSEL).
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Remove const array that defines channels. Build channels definition
at probe time, when initializing channels (only for requested ones).
This will ease adding differential channels support.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
STM32H7 ADC channels may be configured either as single-ended or
differential.
Add 'st,adc-diff-channels' property to support differential channels.
Differential channels are defined as a pair of positive and negative
inputs: vinp & vinn.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reducing shunt and bus voltage range improves the accuracy, so allow
altering the default settings.
Both settings are exposed as gain values. While for the shunt voltage
this is straightforward, the bus range settings of 32V (default) and 16V
are mapped to gain values of 1 resp. 2, to provide a uniform API to
userspace.
As the gain settings are incorporated into the raw values by the sensor
itself, adjusting of the scale attributes is not necessary.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
While the config uses the physical value corresponding to the LSB
for both the power and the bus voltage register, the shunt voltage is
specified as parts of 1 mV. Use the LSB physical value for all registers.
No functional change.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lower bits of the INA219/220 bus voltage register are conversion
status flags, properly shift the value.
When reading via IIO buffer, the value is passed on unaltered,
shifting is the responsibility of the user.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* Add a jump target so that a call of the function "mutex_unlock" is stored
only twice in this function implementation.
* Replace two calls by goto statements.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* Add a jump target so that a call of the function "mutex_unlock" is stored
only twice in this function implementation.
* Replace two calls by goto statements.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>