aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-05-11iio: light: ltr501: Constify structsRikard Falkeborn1-19/+20
Constify some data structs that are never changed. In order to do so, also update a couple of functions that now need to accept pointers to const struct instead of struct. While at it, update a few more functions to accept pointers to const struct instead of pointers. This allows the compiler to put more data in the code segment instead of the data segment, as seen by the output of the file command: Before: text data bss dec hex filename 27080 8144 192 35416 8a58 drivers/iio/light/ltr501.o After: text data bss dec hex filename 27688 7536 192 35416 8a58 drivers/iio/light/ltr501.o Signed-off-by: Rikard Falkeborn <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-11staging: iio: ad5933: attach life-cycle of kfifo buffer to parent device and ↵Alexandru Ardelean1-40/+37
use managed calls throughout This change makes the use of devm_iio_kfifo_allocate() to attach the life-cycle of the kfifo buffer to the parent (client->dev) object. This removes the need to explicitly free 'indio_dev->buffer' via iio_kfifo_free(), which is the main intent. Having done this, it is straight forward to move to devm_ calls throughout and drop the remove function. Signed-off-by: Alexandru Ardelean <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-11iio: bmp280: fix compensation of humidityAndreas Klinger1-0/+2
Limit the output of humidity compensation to the range between 0 and 100 percent. Depending on the calibration parameters of the individual sensor it happens, that a humidity above 100 percent or below 0 percent is calculated, which don't make sense in terms of relative humidity. Add a clamp to the compensation formula as described in the datasheet of the sensor in chapter 4.2.3. Although this clamp is documented, it was never in the driver of the kernel. It depends on the circumstances (calibration parameters, temperature, humidity) if one can see a value above 100 percent without the clamp. The writer of this patch was working with this type of sensor without noting this error. So it seems to be a rare event when this bug occures. Signed-off-by: Andreas Klinger <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-11iio: light: cm32181: Fix integartion time typoHans de Goede1-1/+1
Fix integartion time typo and while at it improve the comment with the typo a bit in general. Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-11iio: light: cm32181: Add support for parsing CPM0 and CPM1 ACPI tablesHans de Goede1-0/+101
On ACPI based systems the CPLM3218 ACPI device node describing the CM3218[1] sensor typically will have some extra tables with register init values for initializing the sensor and calibration info. This is based on a newer version of cm32181.c, with a copyright of: * Copyright (C) 2014 Capella Microsystems Inc. * Author: Kevin Tsai <[email protected]> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published * by the Free Software Foundation. Which is floating around on the net in various places, but the changes from this newer version never made it upstream. This was tested on the following models: Acer Switch 10 SW5-012 (CM32181) Asus T100TA (CM3218), Asus T100CHI (CM3218) and HP X2 10-n000nd (CM32181). Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-10iio: light: cm32181: Make lux_per_bit and lux_per_bit_base_it runtime settingsHans de Goede1-2/+6
Make lux_per_bit and lux_per_bit_base_it settings stored in struct cm32181_chip instead of a hardcoded (defined) values. This is a preparation patch for reading some ACPI tables which specify a device specific lux_per_bit value. Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-10iio: light: cm32181: Use units of 1/100000th for calibscale and lux_per_bitHans de Goede1-11/+11
Use units of 1/100000th for calibscale and lux_per_bit. The similar cm3232 driver already uses 1/100000th as unit for calibscale. This allows for higher-accuracy and makes it easier to add support for getting device-specific calibscale and lux_per_bit values from a device's ACPI tables, as the values in the ACPI tables also use 1/100000th units. This units change means that our intermediate values in cm32181_get_lux() may get quite big, change the type of the lux variable to a u64 to deal with this. Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-10iio: light: cm32181: Change reg_init to use a bitmap of which registers to initHans de Goede1-8/+6
This is a preparation patch for reading some ACPI tables which give init values for multiple registers. Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-10iio: light: cm32181: Handle CM3218 ACPI devices with 2 I2C resourcesHans de Goede1-0/+22
Some ACPI systems list 2 I2C resources for the CM3218 sensor. On these systems the first I2cSerialBus ACPI-resource points to the SMBus Alert Response Address (ARA, 0x0c) and the second I2cSerialBus ACPI-resource points to the actual CM3218 sensor address: Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings { Name (SBUF, ResourceTemplate () { I2cSerialBusV2 (0x000C, ControllerInitiated, 0x00061A80, AddressingMode7Bit, "\\_SB.I2C3", 0x00, ResourceConsumer, , Exclusive, ) I2cSerialBusV2 (0x0048, ControllerInitiated, 0x00061A80, AddressingMode7Bit, "\\_SB.I2C3", 0x00, ResourceConsumer, , Exclusive, ) Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) { 0x00000033, } }) Return (SBUF) /* \_SB_.I2C3.ALSD._CRS.SBUF */ } Detect this and take the following step to deal with it: 1. When a SMBus Alert capable sensor has an Alert asserted, it will not respond on its actual I2C address. Read a byte from the ARA to clear any pending Alerts. 2. Create a "dummy" client for the actual I2C address and use that client to communicate with the sensor. Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-10iio: light: cm32181: Clean up the probe function a bitHans de Goede1-14/+8
3 small cleanups to cm32181_probe(): 1. Do not log an error when we fail to allocate memory (as a general rule drivers do not log errors for this as the kernel will already have complained loudly that it could not alloc the mem). 2. Remove the i2c_set_clientdata() call, we never use i2c_get_clientdata() or dev_get_drvdata() anywhere. 3. Add a dev helper variable and use it in various places instead of &client->dev. Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-10iio: light: cm32181: Add support for the CM3218Hans de Goede1-12/+36
Add support for the CM3218 which is an older version of the CM32181. This is based on a newer version of cm32181.c, with a copyright of: * Copyright (C) 2014 Capella Microsystems Inc. * Author: Kevin Tsai <[email protected]> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published * by the Free Software Foundation. Which is floating around on the net in various places, but the changes from this newer version never made it upstream. This was tested on an Asus T100TA and an Asus T100CHI, which both come with the CM3218 variant of the light sensor. Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-10iio: light: cm32181: Add some extra register definesHans de Goede1-4/+11
These come from a newer version of cm32181.c, which is floating around the net, with a copyright of: * Copyright (C) 2014 Capella Microsystems Inc. * Author: Kevin Tsai <[email protected]> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2, as published * by the Free Software Foundation. Note that this removes the bogus CM32181_CMD_ALS_ENABLE define, there is no enable bit, only a disable bit and enabled is the absence of being disabled. This is a preparation patch for adding support for the older CM3218 model of the light sensor. Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-10iio: light: cm32181: Add support for ACPI enumerationHans de Goede1-0/+9
Add support for ACPI enumeration, this has been tested on a HP HP Pavilion x2 Detachable 10 (Bay Trail model). Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-10iio: light: cm32181: Switch to new style i2c-driver probe functionHans de Goede1-12/+3
Switch to the new style i2c-driver probe_new probe function and drop the unnecessary i2c_device_id table (we do not have any old style board files using this). This is a preparation patch for adding ACPI binding support. Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-10iio: hid-sensors: move triggered buffer setup into hid_sensor_setup_triggerAlexandru Ardelean12-134/+55
The main intent here is to get rid of the iio_buffer_set_attrs() helper, or at least rework it's usage a bit. The problem with that helper is that it needs a pointer to the buffer, which makes supporting multiple buffers per IIO device a bit more cumbersome. The hid_sensor_setup_trigger() is pretty much used in the same way: - iio_triggered_buffer_setup() gets called before - then hid_sensor_setup_trigger() and hid_sensor_setup_batch_mode() gets called which may attach some fifo attributes This change merges the 2 together under the hid_sensor_setup_trigger() function. Only the &iio_pollfunc_store_time is passed to all devices, so it's not even required to pass it explicitly outside of the common hid_sensor_setup_trigger() function. Moving the devm_iio_triggered_buffer_setup/cleanup() calls into the common place code can help the rework of the buffer code, since it is in one place. One detail of the change is that there are 2 drivers that use devm_iio_triggered_buffer_setup(). That function gets implicitly replaced with iio_triggered_buffer_setup()/cleanup(), but since all drivers call both hid_sensor_setup_trigger9) & hid_sensor_remove_trigger() trigger, the iio_triggered_buffer_cleanup() piggy backs on the hid_sensor_remove_trigger() call, which should cover the cleanup. Signed-off-by: Alexandru Ardelean <[email protected]> Acked-by: Srinivas Pandruvada <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: vcnl4000: Add buffer support for VCNL4010/20.Mathieu Othacehe2-2/+161
The VCNL4010 and VCNL4020 chips are able to raise interrupts on data ready. Use it to provide triggered buffer support for proximity data. Those two chips also provide ambient light data. However, they are sampled at different rate than proximity data. As this is not handled by the IIO framework for now, and the sample frequencies of ambient light data are very low, do add buffer support for them. Signed-off-by: Mathieu Othacehe <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: vcnl4000: Add sampling frequency support for VCNL4010/20.Mathieu Othacehe1-1/+117
Add sampling frequency support for proximity data on VCNL4010 and VCNL4020 chips. Signed-off-by: Mathieu Othacehe <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: vcnl4000: Add event support for VCNL4010/20.Mathieu Othacehe1-62/+392
The VCNL4010 and VCNL4020 chips are able to raise interrupts on proximity threshold events. Add support for threshold rising and falling events for those two chips. Signed-off-by: Mathieu Othacehe <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: vcnl4000: Factorize data reading and writing.Mathieu Othacehe1-2/+22
Factorize data reading in vcnl4000_measure into a vcnl4000_read_data function. Also add a vcnl4000_write_data function. Signed-off-by: Mathieu Othacehe <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: vcnl4000: Fix i2c swapped word reading.Mathieu Othacehe1-4/+2
The bytes returned by the i2c reading need to be swapped unconditionally. Otherwise, on be16 platforms, an incorrect value will be returned. Taking the slow path via next merge window as its been around a while and we have a patch set dependent on this which would be held up. Fixes: 62a1efb9f868 ("iio: add vcnl4000 combined ALS and proximity sensor") Signed-off-by: Mathieu Othacehe <[email protected]> Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: imu: adis16xxx: use helper to access iio core debugfs dirAlexandru Ardelean5-37/+24
The IIO core provides a iio_get_debugfs_dentry() helper. It seems that the ADIS IMU drivers access that field directly. This change converts them to use iio_get_debugfs_dentry() instead. Signed-off-by: Alexandru Ardelean <[email protected]> Acked-by: Nuno Sá <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: DAC extension for ltc2634-12/10/8Chris Ruehl3-4/+70
This patch add support for Analog Devices (Linear Technology) LTC2634 Quad 12-/10-/8-Bit Rail-to-Rail DAC. The SPI functionality based on them from LTC2632 therefor add the definitions only and update the Kconfig. Signed-off-by: Chris Ruehl <[email protected]> Acked-by: Uwe Kleine-König <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: documentation ltc2632_chip_info add num_channelsChris Ruehl1-0/+1
The documentation for ltc_2632_chip_info missed the desciption for the num_channels. This trivial patch adds it. Signed-off-by: Chris Ruehl <[email protected]> Fixes: 9f15a4a0adc9 ("iio: dac: ltc2632: add support for LTC2636 family") Acked-by: Uwe Kleine-König <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: magnetometer: ak8974: Provide scalingLinus Walleij1-1/+44
The manual for the HSCDTD008A gives us a scaling for the three axis as +/- 2.4mT (24 Gauss) per axis. The manual for the AMI305 and AMI306 gives us a scaling for the three axis as +/- 12 Gauss per axis. Tests with the HSCDTD008A sensor, cat the raw values: $ cat in_magn_*_raw raw 45 189 -19 The scaling factor in in_magn_*_scale is 0.001464843, which gives: 0.065 Gauss 0.277 Gauss -0.027 Gauss The earths magnetic field is in the range of 0.25 to 0.65 Gauss on the surface according to Wikipedia, so these seem like reasonable values. Again we are guessing that the AK8974 has a 12 bit ADC, based on the similarity with AMI305 and AMI306. Cc: Nick Reitemeyer <[email protected]> Cc: Stephan Gerhold <[email protected]> Cc: Michał Mirosław <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: magnetometer: ak8974: Break out measurementLinus Walleij1-26/+40
This breaks out the measurement code to its own function so we can handle this without swirling it up with the big switch() statement inside ak8974_read_raw(). Keep a local s16 helper variable for the signed value coming out of the measurement before assigning it to the integer *val. The local variable makes the code easier to read and the compiler will optimize it if possible. Cc: Nick Reitemeyer <[email protected]> Cc: Stephan Gerhold <[email protected]> Reviewed-by: Michał Mirosław <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: magnetometer: ak8974: Correct realbitsLinus Walleij1-8/+37
The HSCDTD008A has 15 bits of actual ADC valie, and the AMI305 and AMI306 has 12 bits. Correct this by providing an extra parameter to the channel macro and define a separate set of channels for each variant of the chip. The resolution is the actual resolution of the internal ADC of the chip. The values are stored in a S16 in 2's complement so all 16 bits are used for storing (no shifting needed). The AMI305, AMI306 and HSCDTD008A valid bits are picked from respective datasheet. My best educated guess is that AK8974 is also 12 bits. The AK8973 is an 8 bit and earlier version, and the sibling drivers AMI305 and AMI306 are 12 bits, so it makes sense to assume that the AK8974 is also 12 bits. Cc: Nick Reitemeyer <[email protected]> Cc: Stephan Gerhold <[email protected]> Cc: Michał Mirosław <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: magnetometer: ak8974: add Alps hscdtd008aNick Reitemeyer1-8/+30
The hscdtd008a is similar to the AK8974: Only the whoami value and some registers are different. Signed-off-by: Nick Reitemeyer <[email protected]> Reviewed-by: Stephan Gerhold <[email protected]> Tested-by: Stephan Gerhold <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Tested-by: Linus Walleij <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03dt-bindings: magnetometer: ak8974: Add Alps hscdtd008aNick Reitemeyer1-1/+3
Add binding documentation for the Alps HSCDTD008A, which is similar to the ak8974. Signed-off-by: Nick Reitemeyer <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Acked-by: Rob Herring <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: imu: st_lsm6dsx: enable 833Hz sample frequency for tagged sensorsLorenzo Bianconi1-7/+14
Enable 833Hz ODR for sensors that supports tagged hw FIFO: - LSM6DSO/LSM6DSOX - LSM6DSR/LSM6DSRX - ASM330LHH Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: adc: ad7476: remove redundant null check on an arrayColin Ian King1-1/+1
The null check on st->chip_info->convst_channel is redundant because convst_channel is a 2 element array of struct iio_chan_spec objects and this can never be null. Fix this by removing the null check. Addresses-Coverity: ("Array compared against 0") Signed-off-by: Colin Ian King <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: buffer: extend short-hand use for 'indio_dev->buffer'Alexandru Ardelean1-27/+34
This change is both cosmetic and a prequel to adding support for attaching multiple buffers per IIO device. The IIO buffer sysfs attrs are mostly designed to support only one attached buffer, and in order to support more, we need to centralize [in each attr function] the buffer which is being accessed. This also makes it a bit more uniform, as in some functions there is a short-hand 'buffer' variable and at the same time the 'indio_dev->buffer' is still access directly. Signed-off-by: Alexandru Ardelean <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: dac: ad5592r: Fix a typo in the name of a functionChristophe JAILLET1-2/+2
This module is related to AD5592R, not AD5593R, so be consistent in naming. Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: dac: ad5593r: Fix a typo in MODULE_DESCRIPTIONChristophe JAILLET1-1/+1
This module is related to AD5593R, not AD5592R. Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: st_sensors: Use get_unaligned_be24() and sign_extend32()Andy Shevchenko1-6/+1
Use these functions instead of open-coding them. Cc: Denis Ciocca <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: temperature: max31856: Use get_unaligned_beXX()Andy Shevchenko1-2/+3
This makes the driver code slightly easier to read. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: pressure: zpa2326: Use get_unaligned_le24()Andy Shevchenko1-5/+4
This makes the driver code slightly easier to read. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: pressure: ms5611: Use get_unaligned_be24()Andy Shevchenko2-2/+6
This makes the driver code slightly easier to read. Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Tomasz Duszynski <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: pressure: hp206c: Use get_unaligned_be24()Andy Shevchenko1-3/+5
This makes the driver code slightly easier to read. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: magnetometer: rm3100: Use get_unaligned_be24()Andy Shevchenko1-2/+3
This makes the driver code slightly easier to read. Cc: Song Qiang <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: light: zopt2201: Use get_unaligned_le24()Andy Shevchenko1-1/+3
This makes the driver code slightly easier to read. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: light: si1133: Use get_unaligned_be24()Andy Shevchenko1-12/+6
This makes the driver code slightly easier to read. Cc: Maxime Roussin-Bélanger <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: health: afe4403: Use get_unaligned_be24()Andy Shevchenko1-8/+6
This makes the driver code slightly easier to read. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: gyro: adis16130: Use get_unaligned_be24()Andy Shevchenko1-1/+3
This makes the driver code slightly easier to read. Cc: Lars-Peter Clausen <[email protected]> Cc: Michael Hennerich <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Nuno Sá <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: dac: ad5446: Use put_unaligned_be24()Andy Shevchenko1-3/+3
This makes the driver code slightly easier to read. Cc: Lars-Peter Clausen <[email protected]> Cc: Michael Hennerich <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: dac: ad5624r_spi: Use put_unaligned_be24()Andy Shevchenko1-4/+4
This makes the driver code slightly easier to read. Cc: Lars-Peter Clausen <[email protected]> Cc: Michael Hennerich <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Nuno Sá <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: dac: ltc2632: Use put_unaligned_be24()Andy Shevchenko1-3/+3
This makes the driver code slightly easier to read. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: adc: ti-ads124s08: Use get_unaligned_be24()Andy Shevchenko1-4/+3
This makes the driver code slightly easier to read. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: adc: mpc3422: Use get_unaligned_beXX()Andy Shevchenko1-2/+3
This makes the driver code slightly easier to read. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: adc: ad_sigma_delta: Use {get,put}_unaligned_be24()Andy Shevchenko1-6/+2
This makes the driver code slightly easier to read. Cc: Lars-Peter Clausen <[email protected]> Cc: Michael Hennerich <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Nuno Sá <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2020-05-03iio: Use an early return in iio_device_alloc to simplify code.Jonathan Cameron1-19/+19
Noticed whilst reviewing Alexandru's patch to the same function. If we simply flip the logic and return NULL immediately after memory allocation failure we reduce the indent of the following block and end up with more 'idiomatic' kernel code. Signed-off-by: Jonathan Cameron <[email protected]> Reviewed-by: Alexandru Ardelean <[email protected]>