diff options
Diffstat (limited to 'drivers/staging/iio/light')
-rw-r--r-- | drivers/staging/iio/light/isl29018.c | 75 | ||||
-rw-r--r-- | drivers/staging/iio/light/isl29028.c | 31 | ||||
-rw-r--r-- | drivers/staging/iio/light/tsl2583.c | 92 | ||||
-rw-r--r-- | drivers/staging/iio/light/tsl2x7x_core.c | 8 |
4 files changed, 121 insertions, 85 deletions
diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c index bbf7e35cb..76d9f74e7 100644 --- a/drivers/staging/iio/light/isl29018.c +++ b/drivers/staging/iio/light/isl29018.c @@ -100,7 +100,6 @@ static const struct isl29018_scale { }; struct isl29018_chip { - struct device *dev; struct regmap *regmap; struct mutex lock; int type; @@ -180,30 +179,31 @@ static int isl29018_read_sensor_input(struct isl29018_chip *chip, int mode) int status; unsigned int lsb; unsigned int msb; + struct device *dev = regmap_get_device(chip->regmap); /* Set mode */ status = regmap_write(chip->regmap, ISL29018_REG_ADD_COMMAND1, - mode << COMMMAND1_OPMODE_SHIFT); + mode << COMMMAND1_OPMODE_SHIFT); if (status) { - dev_err(chip->dev, + dev_err(dev, "Error in setting operating mode err %d\n", status); return status; } msleep(CONVERSION_TIME_MS); status = regmap_read(chip->regmap, ISL29018_REG_ADD_DATA_LSB, &lsb); if (status < 0) { - dev_err(chip->dev, + dev_err(dev, "Error in reading LSB DATA with err %d\n", status); return status; } status = regmap_read(chip->regmap, ISL29018_REG_ADD_DATA_MSB, &msb); if (status < 0) { - dev_err(chip->dev, + dev_err(dev, "Error in reading MSB DATA with error %d\n", status); return status; } - dev_vdbg(chip->dev, "MSB 0x%x and LSB 0x%x\n", msb, lsb); + dev_vdbg(dev, "MSB 0x%x and LSB 0x%x\n", msb, lsb); return (msb << 8) | lsb; } @@ -241,23 +241,24 @@ static int isl29018_read_ir(struct isl29018_chip *chip, int *ir) } static int isl29018_read_proximity_ir(struct isl29018_chip *chip, int scheme, - int *near_ir) + int *near_ir) { int status; int prox_data = -1; int ir_data = -1; + struct device *dev = regmap_get_device(chip->regmap); /* Do proximity sensing with required scheme */ status = regmap_update_bits(chip->regmap, ISL29018_REG_ADD_COMMANDII, - COMMANDII_SCHEME_MASK, - scheme << COMMANDII_SCHEME_SHIFT); + COMMANDII_SCHEME_MASK, + scheme << COMMANDII_SCHEME_SHIFT); if (status) { - dev_err(chip->dev, "Error in setting operating mode\n"); + dev_err(dev, "Error in setting operating mode\n"); return status; } prox_data = isl29018_read_sensor_input(chip, - COMMMAND1_OPMODE_PROX_ONCE); + COMMMAND1_OPMODE_PROX_ONCE); if (prox_data < 0) return prox_data; @@ -280,7 +281,7 @@ static int isl29018_read_proximity_ir(struct isl29018_chip *chip, int scheme, } static ssize_t show_scale_available(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, char *buf) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct isl29018_chip *chip = iio_priv(indio_dev); @@ -297,7 +298,7 @@ static ssize_t show_scale_available(struct device *dev, } static ssize_t show_int_time_available(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, char *buf) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct isl29018_chip *chip = iio_priv(indio_dev); @@ -314,18 +315,22 @@ static ssize_t show_int_time_available(struct device *dev, /* proximity scheme */ static ssize_t show_prox_infrared_suppression(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, + char *buf) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct isl29018_chip *chip = iio_priv(indio_dev); - /* return the "proximity scheme" i.e. if the chip does on chip - infrared suppression (1 means perform on chip suppression) */ + /* + * return the "proximity scheme" i.e. if the chip does on chip + * infrared suppression (1 means perform on chip suppression) + */ return sprintf(buf, "%d\n", chip->prox_scheme); } static ssize_t store_prox_infrared_suppression(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) + struct device_attribute *attr, + const char *buf, size_t count) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct isl29018_chip *chip = iio_priv(indio_dev); @@ -338,8 +343,10 @@ static ssize_t store_prox_infrared_suppression(struct device *dev, return -EINVAL; } - /* get the "proximity scheme" i.e. if the chip does on chip - infrared suppression (1 means perform on chip suppression) */ + /* + * get the "proximity scheme" i.e. if the chip does on chip + * infrared suppression (1 means perform on chip suppression) + */ mutex_lock(&chip->lock); chip->prox_scheme = val; mutex_unlock(&chip->lock); @@ -413,7 +420,8 @@ static int isl29018_read_raw(struct iio_dev *indio_dev, break; case IIO_PROXIMITY: ret = isl29018_read_proximity_ir(chip, - chip->prox_scheme, val); + chip->prox_scheme, + val); break; default: break; @@ -518,10 +526,11 @@ static int isl29035_detect(struct isl29018_chip *chip) { int status; unsigned int id; + struct device *dev = regmap_get_device(chip->regmap); status = regmap_read(chip->regmap, ISL29035_REG_DEVICE_ID, &id); if (status < 0) { - dev_err(chip->dev, + dev_err(dev, "Error reading ID register with error %d\n", status); return status; @@ -546,6 +555,7 @@ enum { static int isl29018_chip_init(struct isl29018_chip *chip) { int status; + struct device *dev = regmap_get_device(chip->regmap); if (chip->type == isl29035) { status = isl29035_detect(chip); @@ -575,7 +585,7 @@ static int isl29018_chip_init(struct isl29018_chip *chip) */ status = regmap_write(chip->regmap, ISL29018_REG_TEST, 0x0); if (status < 0) { - dev_err(chip->dev, "Failed to clear isl29018 TEST reg.(%d)\n", + dev_err(dev, "Failed to clear isl29018 TEST reg.(%d)\n", status); return status; } @@ -586,7 +596,7 @@ static int isl29018_chip_init(struct isl29018_chip *chip) */ status = regmap_write(chip->regmap, ISL29018_REG_ADD_COMMAND1, 0); if (status < 0) { - dev_err(chip->dev, "Failed to clear isl29018 CMD1 reg.(%d)\n", + dev_err(dev, "Failed to clear isl29018 CMD1 reg.(%d)\n", status); return status; } @@ -597,14 +607,14 @@ static int isl29018_chip_init(struct isl29018_chip *chip) status = isl29018_set_scale(chip, chip->scale.scale, chip->scale.uscale); if (status < 0) { - dev_err(chip->dev, "Init of isl29018 fails\n"); + dev_err(dev, "Init of isl29018 fails\n"); return status; } status = isl29018_set_integration_time(chip, isl29018_int_utimes[chip->type][chip->int_time]); if (status < 0) { - dev_err(chip->dev, "Init of isl29018 fails\n"); + dev_err(dev, "Init of isl29018 fails\n"); return status; } @@ -614,15 +624,15 @@ static int isl29018_chip_init(struct isl29018_chip *chip) static const struct iio_info isl29018_info = { .attrs = &isl29018_group, .driver_module = THIS_MODULE, - .read_raw = &isl29018_read_raw, - .write_raw = &isl29018_write_raw, + .read_raw = isl29018_read_raw, + .write_raw = isl29018_write_raw, }; static const struct iio_info isl29023_info = { .attrs = &isl29023_group, .driver_module = THIS_MODULE, - .read_raw = &isl29018_read_raw, - .write_raw = &isl29018_write_raw, + .read_raw = isl29018_read_raw, + .write_raw = isl29018_write_raw, }; static bool is_volatile_reg(struct device *dev, unsigned int reg) @@ -699,13 +709,13 @@ static const char *isl29018_match_acpi_device(struct device *dev, int *data) if (!id) return NULL; - *data = (int) id->driver_data; + *data = (int)id->driver_data; return dev_name(dev); } static int isl29018_probe(struct i2c_client *client, - const struct i2c_device_id *id) + const struct i2c_device_id *id) { struct isl29018_chip *chip; struct iio_dev *indio_dev; @@ -721,7 +731,6 @@ static int isl29018_probe(struct i2c_client *client, chip = iio_priv(indio_dev); i2c_set_clientdata(client, indio_dev); - chip->dev = &client->dev; if (id) { name = id->name; @@ -744,7 +753,7 @@ static int isl29018_probe(struct i2c_client *client, chip_info_tbl[dev_id].regmap_cfg); if (IS_ERR(chip->regmap)) { err = PTR_ERR(chip->regmap); - dev_err(chip->dev, "regmap initialization failed: %d\n", err); + dev_err(&client->dev, "regmap initialization fails: %d\n", err); return err; } diff --git a/drivers/staging/iio/light/isl29028.c b/drivers/staging/iio/light/isl29028.c index 32ae1127d..6e2ba458c 100644 --- a/drivers/staging/iio/light/isl29028.c +++ b/drivers/staging/iio/light/isl29028.c @@ -81,7 +81,7 @@ struct isl29028_chip { }; static int isl29028_set_proxim_sampling(struct isl29028_chip *chip, - unsigned int sampling) + unsigned int sampling) { static unsigned int prox_period[] = {800, 400, 200, 100, 75, 50, 12, 0}; int sel; @@ -103,7 +103,7 @@ static int isl29028_enable_proximity(struct isl29028_chip *chip, bool enable) if (enable) val = CONFIGURE_PROX_EN; ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - CONFIGURE_PROX_EN_MASK, val); + CONFIGURE_PROX_EN_MASK, val); if (ret < 0) return ret; @@ -122,24 +122,27 @@ static int isl29028_set_als_scale(struct isl29028_chip *chip, int lux_scale) } static int isl29028_set_als_ir_mode(struct isl29028_chip *chip, - enum als_ir_mode mode) + enum als_ir_mode mode) { int ret = 0; switch (mode) { case MODE_ALS: ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - CONFIGURE_ALS_IR_MODE_MASK, CONFIGURE_ALS_IR_MODE_ALS); + CONFIGURE_ALS_IR_MODE_MASK, + CONFIGURE_ALS_IR_MODE_ALS); if (ret < 0) return ret; ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - CONFIGURE_ALS_RANGE_MASK, CONFIGURE_ALS_RANGE_HIGH_LUX); + CONFIGURE_ALS_RANGE_MASK, + CONFIGURE_ALS_RANGE_HIGH_LUX); break; case MODE_IR: ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - CONFIGURE_ALS_IR_MODE_MASK, CONFIGURE_ALS_IR_MODE_IR); + CONFIGURE_ALS_IR_MODE_MASK, + CONFIGURE_ALS_IR_MODE_IR); break; case MODE_NONE: @@ -152,7 +155,7 @@ static int isl29028_set_als_ir_mode(struct isl29028_chip *chip, /* Enable the ALS/IR */ ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - CONFIGURE_ALS_EN_MASK, CONFIGURE_ALS_EN); + CONFIGURE_ALS_EN_MASK, CONFIGURE_ALS_EN); if (ret < 0) return ret; @@ -193,7 +196,7 @@ static int isl29028_read_proxim(struct isl29028_chip *chip, int *prox) ret = regmap_read(chip->regmap, ISL29028_REG_PROX_DATA, &data); if (ret < 0) { dev_err(chip->dev, "Error in reading register %d, error %d\n", - ISL29028_REG_PROX_DATA, ret); + ISL29028_REG_PROX_DATA, ret); return ret; } *prox = data; @@ -264,7 +267,8 @@ static int isl29028_ir_get(struct isl29028_chip *chip, int *ir_data) /* Channel IO */ static int isl29028_write_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, int val, int val2, long mask) + struct iio_chan_spec const *chan, + int val, int val2, long mask) { struct isl29028_chip *chip = iio_priv(indio_dev); int ret = -EINVAL; @@ -323,7 +327,8 @@ static int isl29028_write_raw(struct iio_dev *indio_dev, } static int isl29028_read_raw(struct iio_dev *indio_dev, - struct iio_chan_spec const *chan, int *val, int *val2, long mask) + struct iio_chan_spec const *chan, + int *val, int *val2, long mask) { struct isl29028_chip *chip = iio_priv(indio_dev); int ret = -EINVAL; @@ -406,8 +411,8 @@ static const struct iio_chan_spec isl29028_channels[] = { static const struct iio_info isl29028_info = { .attrs = &isl29108_group, .driver_module = THIS_MODULE, - .read_raw = &isl29028_read_raw, - .write_raw = &isl29028_write_raw, + .read_raw = isl29028_read_raw, + .write_raw = isl29028_write_raw, }; static int isl29028_chip_init(struct isl29028_chip *chip) @@ -476,7 +481,7 @@ static const struct regmap_config isl29028_regmap_config = { }; static int isl29028_probe(struct i2c_client *client, - const struct i2c_device_id *id) + const struct i2c_device_id *id) { struct isl29028_chip *chip; struct iio_dev *indio_dev; diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c index 3100d960f..05b4ad4e9 100644 --- a/drivers/staging/iio/light/tsl2583.c +++ b/drivers/staging/iio/light/tsl2583.c @@ -240,8 +240,10 @@ static int taos_get_lux(struct iio_dev *indio_dev) } } - /* clear status, really interrupt status (interrupts are off), but - * we use the bit anyway - don't forget 0x80 - this is a command*/ + /* + * clear status, really interrupt status (interrupts are off), but + * we use the bit anyway - don't forget 0x80 - this is a command + */ ret = i2c_smbus_write_byte(chip->client, (TSL258X_CMD_REG | TSL258X_CMD_SPL_FN | TSL258X_CMD_ALS_INT_CLR)); @@ -265,13 +267,14 @@ static int taos_get_lux(struct iio_dev *indio_dev) if (!ch0) { /* have no data, so return LAST VALUE */ - ret = chip->als_cur_info.lux = 0; + ret = 0; + chip->als_cur_info.lux = 0; goto out_unlock; } /* calculate ratio */ ratio = (ch1 << 15) / ch0; /* convert to unscaled lux using the pointer to the table */ - for (p = (struct taos_lux *) taos_device_lux; + for (p = (struct taos_lux *)taos_device_lux; p->ratio != 0 && p->ratio < ratio; p++) ; @@ -290,7 +293,8 @@ static int taos_get_lux(struct iio_dev *indio_dev) /* note: lux is 31 bit max at this point */ if (ch1lux > ch0lux) { dev_dbg(&chip->client->dev, "No Data - Return last value\n"); - ret = chip->als_cur_info.lux = 0; + ret = 0; + chip->als_cur_info.lux = 0; goto out_unlock; } @@ -378,7 +382,7 @@ static int taos_als_calibrate(struct iio_dev *indio_dev) dev_err(&chip->client->dev, "taos_als_calibrate failed to get lux\n"); return lux_val; } - gain_trim_val = (unsigned int) (((chip->taos_settings.als_cal_target) + gain_trim_val = (unsigned int)(((chip->taos_settings.als_cal_target) * chip->taos_settings.als_gain_trim) / lux_val); if ((gain_trim_val < 250) || (gain_trim_val > 4000)) { @@ -387,9 +391,9 @@ static int taos_als_calibrate(struct iio_dev *indio_dev) gain_trim_val); return -ENODATA; } - chip->taos_settings.als_gain_trim = (int) gain_trim_val; + chip->taos_settings.als_gain_trim = (int)gain_trim_val; - return (int) gain_trim_val; + return (int)gain_trim_val; } /* @@ -429,8 +433,10 @@ static int taos_chip_on(struct iio_dev *indio_dev) chip->als_saturation = als_count * 922; /* 90% of full scale */ chip->als_time_scale = (als_time + 25) / 50; - /* TSL258x Specific power-on / adc enable sequence - * Power on the device 1st. */ + /* + * TSL258x Specific power-on / adc enable sequence + * Power on the device 1st. + */ utmp = TSL258X_CNTL_PWR_ON; ret = i2c_smbus_write_byte_data(chip->client, TSL258X_CMD_REG | TSL258X_CNTRL, utmp); @@ -439,8 +445,10 @@ static int taos_chip_on(struct iio_dev *indio_dev) return ret; } - /* Use the following shadow copy for our delay before enabling ADC. - * Write all the registers. */ + /* + * Use the following shadow copy for our delay before enabling ADC. + * Write all the registers. + */ for (i = 0, uP = chip->taos_config; i < TSL258X_REG_MAX; i++) { ret = i2c_smbus_write_byte_data(chip->client, TSL258X_CMD_REG + i, @@ -453,8 +461,10 @@ static int taos_chip_on(struct iio_dev *indio_dev) } usleep_range(3000, 3500); - /* NOW enable the ADC - * initialize the desired mode of operation */ + /* + * NOW enable the ADC + * initialize the desired mode of operation + */ utmp = TSL258X_CNTL_PWR_ON | TSL258X_CNTL_ADC_ENBL; ret = i2c_smbus_write_byte_data(chip->client, TSL258X_CMD_REG | TSL258X_CNTRL, @@ -482,7 +492,7 @@ static int taos_chip_off(struct iio_dev *indio_dev) /* Sysfs Interface Functions */ static ssize_t taos_power_state_show(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, char *buf) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct tsl2583_chip *chip = iio_priv(indio_dev); @@ -491,7 +501,8 @@ static ssize_t taos_power_state_show(struct device *dev, } static ssize_t taos_power_state_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t len) + struct device_attribute *attr, + const char *buf, size_t len) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); int value; @@ -508,7 +519,7 @@ static ssize_t taos_power_state_store(struct device *dev, } static ssize_t taos_gain_show(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, char *buf) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct tsl2583_chip *chip = iio_priv(indio_dev); @@ -533,7 +544,8 @@ static ssize_t taos_gain_show(struct device *dev, } static ssize_t taos_gain_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t len) + struct device_attribute *attr, + const char *buf, size_t len) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct tsl2583_chip *chip = iio_priv(indio_dev); @@ -564,13 +576,14 @@ static ssize_t taos_gain_store(struct device *dev, } static ssize_t taos_gain_available_show(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, + char *buf) { return sprintf(buf, "%s\n", "1 8 16 111"); } static ssize_t taos_als_time_show(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, char *buf) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct tsl2583_chip *chip = iio_priv(indio_dev); @@ -579,7 +592,8 @@ static ssize_t taos_als_time_show(struct device *dev, } static ssize_t taos_als_time_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t len) + struct device_attribute *attr, + const char *buf, size_t len) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct tsl2583_chip *chip = iio_priv(indio_dev); @@ -600,14 +614,15 @@ static ssize_t taos_als_time_store(struct device *dev, } static ssize_t taos_als_time_available_show(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, + char *buf) { return sprintf(buf, "%s\n", "50 100 150 200 250 300 350 400 450 500 550 600 650"); } static ssize_t taos_als_trim_show(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, char *buf) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct tsl2583_chip *chip = iio_priv(indio_dev); @@ -616,7 +631,8 @@ static ssize_t taos_als_trim_show(struct device *dev, } static ssize_t taos_als_trim_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t len) + struct device_attribute *attr, + const char *buf, size_t len) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct tsl2583_chip *chip = iio_priv(indio_dev); @@ -632,7 +648,8 @@ static ssize_t taos_als_trim_store(struct device *dev, } static ssize_t taos_als_cal_target_show(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, + char *buf) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct tsl2583_chip *chip = iio_priv(indio_dev); @@ -641,7 +658,8 @@ static ssize_t taos_als_cal_target_show(struct device *dev, } static ssize_t taos_als_cal_target_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t len) + struct device_attribute *attr, + const char *buf, size_t len) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct tsl2583_chip *chip = iio_priv(indio_dev); @@ -657,7 +675,7 @@ static ssize_t taos_als_cal_target_store(struct device *dev, } static ssize_t taos_lux_show(struct device *dev, struct device_attribute *attr, - char *buf) + char *buf) { int ret; @@ -669,7 +687,8 @@ static ssize_t taos_lux_show(struct device *dev, struct device_attribute *attr, } static ssize_t taos_do_calibrate(struct device *dev, - struct device_attribute *attr, const char *buf, size_t len) + struct device_attribute *attr, + const char *buf, size_t len) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); int value; @@ -684,7 +703,7 @@ static ssize_t taos_do_calibrate(struct device *dev, } static ssize_t taos_luxtable_show(struct device *dev, - struct device_attribute *attr, char *buf) + struct device_attribute *attr, char *buf) { int i; int offset = 0; @@ -695,8 +714,10 @@ static ssize_t taos_luxtable_show(struct device *dev, taos_device_lux[i].ch0, taos_device_lux[i].ch1); if (taos_device_lux[i].ratio == 0) { - /* We just printed the first "0" entry. - * Now get rid of the extra "," and break. */ + /* + * We just printed the first "0" entry. + * Now get rid of the extra "," and break. + */ offset--; break; } @@ -707,11 +728,12 @@ static ssize_t taos_luxtable_show(struct device *dev, } static ssize_t taos_luxtable_store(struct device *dev, - struct device_attribute *attr, const char *buf, size_t len) + struct device_attribute *attr, + const char *buf, size_t len) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct tsl2583_chip *chip = iio_priv(indio_dev); - int value[ARRAY_SIZE(taos_device_lux)*3 + 1]; + int value[ARRAY_SIZE(taos_device_lux) * 3 + 1]; int n; get_options(buf, ARRAY_SIZE(value), value); @@ -809,7 +831,7 @@ static int taos_probe(struct i2c_client *clientp, struct iio_dev *indio_dev; if (!i2c_check_functionality(clientp->adapter, - I2C_FUNC_SMBUS_BYTE_DATA)) { + I2C_FUNC_SMBUS_BYTE_DATA)) { dev_err(&clientp->dev, "taos_probe() - i2c smbus byte data func unsupported\n"); return -EOPNOTSUPP; } @@ -846,7 +868,7 @@ static int taos_probe(struct i2c_client *clientp, if (!taos_tsl258x_device(buf)) { dev_info(&clientp->dev, - "i2c device found but does not match expected id in taos_probe()\n"); + "i2c device found but does not match expected id in taos_probe()\n"); return -EINVAL; } diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c index 5b1c1650a..5f308bae4 100644 --- a/drivers/staging/iio/light/tsl2x7x_core.c +++ b/drivers/staging/iio/light/tsl2x7x_core.c @@ -296,7 +296,7 @@ static const u8 device_channel_config[] = { static int tsl2x7x_i2c_read(struct i2c_client *client, u8 reg, u8 *val) { - int ret = 0; + int ret; /* select register to write */ ret = i2c_smbus_write_byte(client, (TSL2X7X_CMD_REG | reg)); @@ -687,9 +687,9 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev) /* Set the gain based on tsl2x7x_settings struct */ chip->tsl2x7x_config[TSL2X7X_GAIN] = - (chip->tsl2x7x_settings.als_gain | + chip->tsl2x7x_settings.als_gain | (TSL2X7X_mA100 | TSL2X7X_DIODE1) - | ((chip->tsl2x7x_settings.prox_gain) << 2)); + | ((chip->tsl2x7x_settings.prox_gain) << 2); /* set chip struct re scaling and saturation */ chip->als_saturation = als_count * 922; /* 90% of full scale */ @@ -983,7 +983,7 @@ static ssize_t tsl2x7x_als_time_store(struct device *dev, result.fract /= 3; chip->tsl2x7x_settings.als_time = - (TSL2X7X_MAX_TIMER_CNT - (u8)result.fract); + TSL2X7X_MAX_TIMER_CNT - (u8)result.fract; dev_info(&chip->client->dev, "%s: als time = %d", __func__, chip->tsl2x7x_settings.als_time); |