mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 16:44:58 +02:00
Fourth set of changes for iio in the 3.10 cycle. This time just a fix an
a cleanup. The fix is to the dummy driver for some inconsistent specification of parameters available vs parameters supplied. The cleanup is for some silly memcmp usage. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQIcBAABAgAGBQJRZFD3AAoJEFSFNJnE9BaIb94P/07TOcL70M8JgIb5cLiht3y6 RgWZHFyuACk3eBa/iC2jcpmpF5OUcoMTE7yBAudVeP4YKp8GbFcjMAh2jVtq3AS+ xPhrM9cwvtnIGAp4fn7BkDfjD0N0a0aeAnw3K4N2ThnV4RBTRItmgMsMv9CQtW1Z I0YmPmaqRzTUIzDIv6Q5vuQJ9V0FOcLv94X/OHQZkJQx7DbQjszIvRlX8WXHYMMq tPn3uliAQ1Fk2RDWB/bC1zJojo10qwR2acixrKmfVIlnufbBjdz9Yb9hChWg0PPx dVZrG6yfCjebA8oaesEZ7BjEieBG4uQjCTgKWKc3RTSgTjwOvyZNNlSPz1ygf05a b/gnpctO1ewyaSYMqjb6/juxZy457t3G7HXh2SAtkXXPpvRf+M6r9hrpAbbl+Z8N CHjkZ+ev5T79Tgn9JKxssxGlVxs+RvipF+6SL1wFrX+uoXUKphs+PBzhjxjhs87b VFmUWzkc/GfxkU9PnAobhdtzLdKisJcRDLlFrgt7PvyhU932NiLn9DSDaoYIaSPm wp9+F+GMq+b6P6dFCq4DyZKKVU7lQbF9SNFtGpiIcQg7/xka0mwBeAVnjMFSU47S DjqUJqVKCguUu8ksJJDG9ek+H6lGfmHCiZqhYTyzrv/jXWwfHUnEOr1yuXPBjarZ PhJ0ETsaK5myyAOue/iE =Ere9 -----END PGP SIGNATURE----- Merge tag 'iio-for-3.10d' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: Fourth set of changes for iio in the 3.10 cycle. This time just a fix an a cleanup. The fix is to the dummy driver for some inconsistent specification of parameters available vs parameters supplied. The cleanup is for some silly memcmp usage.
This commit is contained in:
commit
de68600e32
|
|
@ -256,7 +256,7 @@ static ssize_t adt7316_store_enabled(struct device *dev,
|
|||
struct adt7316_chip_info *chip = iio_priv(dev_info);
|
||||
int enable;
|
||||
|
||||
if (!memcmp(buf, "1", 1))
|
||||
if (buf[0] == '1')
|
||||
enable = 1;
|
||||
else
|
||||
enable = 0;
|
||||
|
|
@ -299,7 +299,7 @@ static ssize_t adt7316_store_select_ex_temp(struct device *dev,
|
|||
return -EPERM;
|
||||
|
||||
config1 = chip->config1 & (~ADT7516_SEL_EX_TEMP);
|
||||
if (!memcmp(buf, "1", 1))
|
||||
if (buf[0] == '1')
|
||||
config1 |= ADT7516_SEL_EX_TEMP;
|
||||
|
||||
ret = chip->bus.write(chip->bus.client, ADT7316_CONFIG1, config1);
|
||||
|
|
@ -495,7 +495,7 @@ static ssize_t adt7316_store_disable_averaging(struct device *dev,
|
|||
int ret;
|
||||
|
||||
config2 = chip->config2 & (~ADT7316_DISABLE_AVERAGING);
|
||||
if (!memcmp(buf, "1", 1))
|
||||
if (buf[0] == '1')
|
||||
config2 |= ADT7316_DISABLE_AVERAGING;
|
||||
|
||||
ret = chip->bus.write(chip->bus.client, ADT7316_CONFIG2, config2);
|
||||
|
|
@ -534,7 +534,7 @@ static ssize_t adt7316_store_enable_smbus_timeout(struct device *dev,
|
|||
int ret;
|
||||
|
||||
config2 = chip->config2 & (~ADT7316_EN_SMBUS_TIMEOUT);
|
||||
if (!memcmp(buf, "1", 1))
|
||||
if (buf[0] == '1')
|
||||
config2 |= ADT7316_EN_SMBUS_TIMEOUT;
|
||||
|
||||
ret = chip->bus.write(chip->bus.client, ADT7316_CONFIG2, config2);
|
||||
|
|
@ -597,7 +597,7 @@ static ssize_t adt7316_store_powerdown(struct device *dev,
|
|||
int ret;
|
||||
|
||||
config1 = chip->config1 & (~ADT7316_PD);
|
||||
if (!memcmp(buf, "1", 1))
|
||||
if (buf[0] == '1')
|
||||
config1 |= ADT7316_PD;
|
||||
|
||||
ret = chip->bus.write(chip->bus.client, ADT7316_CONFIG1, config1);
|
||||
|
|
@ -635,7 +635,7 @@ static ssize_t adt7316_store_fast_ad_clock(struct device *dev,
|
|||
int ret;
|
||||
|
||||
config3 = chip->config3 & (~ADT7316_ADCLK_22_5);
|
||||
if (!memcmp(buf, "1", 1))
|
||||
if (buf[0] == '1')
|
||||
config3 |= ADT7316_ADCLK_22_5;
|
||||
|
||||
ret = chip->bus.write(chip->bus.client, ADT7316_CONFIG3, config3);
|
||||
|
|
@ -681,7 +681,7 @@ static ssize_t adt7316_store_da_high_resolution(struct device *dev,
|
|||
|
||||
chip->dac_bits = 8;
|
||||
|
||||
if (!memcmp(buf, "1", 1)) {
|
||||
if (buf[0] == '1') {
|
||||
config3 = chip->config3 | ADT7316_DA_HIGH_RESOLUTION;
|
||||
if (chip->id == ID_ADT7316 || chip->id == ID_ADT7516)
|
||||
chip->dac_bits = 12;
|
||||
|
|
@ -731,7 +731,7 @@ static ssize_t adt7316_store_AIN_internal_Vref(struct device *dev,
|
|||
if ((chip->id & ID_FAMILY_MASK) != ID_ADT75XX)
|
||||
return -EPERM;
|
||||
|
||||
if (memcmp(buf, "1", 1))
|
||||
if (buf[0] != '1')
|
||||
config3 = chip->config3 & (~ADT7516_AIN_IN_VREF);
|
||||
else
|
||||
config3 = chip->config3 | ADT7516_AIN_IN_VREF;
|
||||
|
|
@ -773,7 +773,7 @@ static ssize_t adt7316_store_enable_prop_DACA(struct device *dev,
|
|||
int ret;
|
||||
|
||||
config3 = chip->config3 & (~ADT7316_EN_IN_TEMP_PROP_DACA);
|
||||
if (!memcmp(buf, "1", 1))
|
||||
if (buf[0] == '1')
|
||||
config3 |= ADT7316_EN_IN_TEMP_PROP_DACA;
|
||||
|
||||
ret = chip->bus.write(chip->bus.client, ADT7316_CONFIG3, config3);
|
||||
|
|
@ -812,7 +812,7 @@ static ssize_t adt7316_store_enable_prop_DACB(struct device *dev,
|
|||
int ret;
|
||||
|
||||
config3 = chip->config3 & (~ADT7316_EN_EX_TEMP_PROP_DACB);
|
||||
if (!memcmp(buf, "1", 1))
|
||||
if (buf[0] == '1')
|
||||
config3 |= ADT7316_EN_EX_TEMP_PROP_DACB;
|
||||
|
||||
ret = chip->bus.write(chip->bus.client, ADT7316_CONFIG3, config3);
|
||||
|
|
@ -1018,7 +1018,7 @@ static ssize_t adt7316_store_DA_AB_Vref_bypass(struct device *dev,
|
|||
return -EPERM;
|
||||
|
||||
dac_config = chip->dac_config & (~ADT7316_VREF_BYPASS_DAC_AB);
|
||||
if (!memcmp(buf, "1", 1))
|
||||
if (buf[0] == '1')
|
||||
dac_config |= ADT7316_VREF_BYPASS_DAC_AB;
|
||||
|
||||
ret = chip->bus.write(chip->bus.client, ADT7316_DAC_CONFIG, dac_config);
|
||||
|
|
@ -1063,7 +1063,7 @@ static ssize_t adt7316_store_DA_CD_Vref_bypass(struct device *dev,
|
|||
return -EPERM;
|
||||
|
||||
dac_config = chip->dac_config & (~ADT7316_VREF_BYPASS_DAC_CD);
|
||||
if (!memcmp(buf, "1", 1))
|
||||
if (buf[0] == '1')
|
||||
dac_config |= ADT7316_VREF_BYPASS_DAC_CD;
|
||||
|
||||
ret = chip->bus.write(chip->bus.client, ADT7316_DAC_CONFIG, dac_config);
|
||||
|
|
@ -1982,7 +1982,7 @@ static ssize_t adt7316_set_int_enabled(struct device *dev,
|
|||
int ret;
|
||||
|
||||
config1 = chip->config1 & (~ADT7316_INT_EN);
|
||||
if (!memcmp(buf, "1", 1))
|
||||
if (buf[0] == '1')
|
||||
config1 |= ADT7316_INT_EN;
|
||||
|
||||
ret = chip->bus.write(chip->bus.client, ADT7316_CONFIG1, config1);
|
||||
|
|
|
|||
|
|
@ -166,11 +166,12 @@ static const struct iio_chan_spec iio_dummy_channels[] = {
|
|||
.channel2 = IIO_MOD_X,
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
|
||||
/*
|
||||
* Internal bias correction value. Applied
|
||||
* Internal bias and gain correction values. Applied
|
||||
* by the hardware or driver prior to userspace
|
||||
* seeing the readings. Typically part of hardware
|
||||
* calibration.
|
||||
*/
|
||||
BIT(IIO_CHAN_INFO_CALIBSCALE) |
|
||||
BIT(IIO_CHAN_INFO_CALIBBIAS),
|
||||
.scan_index = accelx,
|
||||
.scan_type = { /* Description of storage in buffer */
|
||||
|
|
@ -311,7 +312,7 @@ static int iio_dummy_write_raw(struct iio_dev *indio_dev,
|
|||
st->dac_val = val;
|
||||
mutex_unlock(&st->lock);
|
||||
return 0;
|
||||
case IIO_CHAN_INFO_CALIBBIAS:
|
||||
case IIO_CHAN_INFO_CALIBSCALE:
|
||||
mutex_lock(&st->lock);
|
||||
/* Compare against table - hard matching here */
|
||||
for (i = 0; i < ARRAY_SIZE(dummy_scales); i++)
|
||||
|
|
@ -324,6 +325,12 @@ static int iio_dummy_write_raw(struct iio_dev *indio_dev,
|
|||
st->accel_calibscale = &dummy_scales[i];
|
||||
mutex_unlock(&st->lock);
|
||||
return ret;
|
||||
case IIO_CHAN_INFO_CALIBBIAS:
|
||||
mutex_lock(&st->lock);
|
||||
st->accel_calibbias = val;
|
||||
mutex_unlock(&st->lock);
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user