Lines Matching refs:ret

95 	int ret;  in apds9300_get_adc_val()  local
104 ret = i2c_smbus_read_word_data(data->client, flags); in apds9300_get_adc_val()
105 if (ret < 0) in apds9300_get_adc_val()
109 return ret; in apds9300_get_adc_val()
114 int ret; in apds9300_set_thresh_low() local
122 ret = i2c_smbus_write_word_data(data->client, APDS9300_THRESHLOWLOW in apds9300_set_thresh_low()
124 if (ret) { in apds9300_set_thresh_low()
126 return ret; in apds9300_set_thresh_low()
135 int ret; in apds9300_set_thresh_hi() local
143 ret = i2c_smbus_write_word_data(data->client, APDS9300_THRESHHIGHLOW in apds9300_set_thresh_hi()
145 if (ret) { in apds9300_set_thresh_hi()
147 return ret; in apds9300_set_thresh_hi()
156 int ret; in apds9300_set_intr_state() local
163 ret = i2c_smbus_write_byte_data(data->client, in apds9300_set_intr_state()
165 if (ret) { in apds9300_set_intr_state()
168 return ret; in apds9300_set_intr_state()
177 int ret; in apds9300_set_power_state() local
181 ret = i2c_smbus_write_byte_data(data->client, in apds9300_set_power_state()
183 if (ret) { in apds9300_set_power_state()
186 return ret; in apds9300_set_power_state()
195 int ret; in apds9300_clear_intr() local
197 ret = i2c_smbus_write_byte(data->client, APDS9300_CLEAR | APDS9300_CMD); in apds9300_clear_intr()
198 if (ret < 0) in apds9300_clear_intr()
204 int ret; in apds9300_chip_init() local
207 ret = apds9300_set_power_state(data, 0); in apds9300_chip_init()
208 if (ret < 0) in apds9300_chip_init()
214 ret = apds9300_set_power_state(data, 1); in apds9300_chip_init()
215 if (ret < 0) in apds9300_chip_init()
217 ret = i2c_smbus_read_byte_data(data->client, in apds9300_chip_init()
219 if (ret != APDS9300_POWER_ON) { in apds9300_chip_init()
220 ret = -ENODEV; in apds9300_chip_init()
227 ret = apds9300_set_intr_state(data, 0); in apds9300_chip_init()
228 if (ret < 0) in apds9300_chip_init()
235 return ret; in apds9300_chip_init()
242 int ch0, ch1, ret = -EINVAL; in apds9300_read_raw() local
250 ret = ch0; in apds9300_read_raw()
255 ret = ch1; in apds9300_read_raw()
259 ret = IIO_VAL_INT; in apds9300_read_raw()
262 ret = apds9300_get_adc_val(data, chan->channel); in apds9300_read_raw()
263 if (ret < 0) in apds9300_read_raw()
265 *val = ret; in apds9300_read_raw()
266 ret = IIO_VAL_INT; in apds9300_read_raw()
273 return ret; in apds9300_read_raw()
303 int ret; in apds9300_write_thresh() local
307 ret = apds9300_set_thresh_hi(data, val); in apds9300_write_thresh()
309 ret = apds9300_set_thresh_low(data, val); in apds9300_write_thresh()
312 return ret; in apds9300_write_thresh()
330 int ret; in apds9300_write_interrupt_config() local
333 ret = apds9300_set_intr_state(data, state); in apds9300_write_interrupt_config()
336 return ret; in apds9300_write_interrupt_config()
411 int ret; in apds9300_probe() local
421 ret = apds9300_chip_init(data); in apds9300_probe()
422 if (ret < 0) in apds9300_probe()
439 ret = devm_request_threaded_irq(&client->dev, client->irq, in apds9300_probe()
443 if (ret) { in apds9300_probe()
444 dev_err(&client->dev, "irq request error %d\n", -ret); in apds9300_probe()
449 ret = iio_device_register(indio_dev); in apds9300_probe()
450 if (ret < 0) in apds9300_probe()
458 return ret; in apds9300_probe()
480 int ret; in apds9300_suspend() local
483 ret = apds9300_set_power_state(data, 0); in apds9300_suspend()
486 return ret; in apds9300_suspend()
493 int ret; in apds9300_resume() local
496 ret = apds9300_set_power_state(data, 1); in apds9300_resume()
499 return ret; in apds9300_resume()