Lines Matching refs:ret
79 int ret; in ds2780_read16() local
82 ret = ds2780_battery_io(dev_info, raw, addr, sizeof(raw), 0); in ds2780_read16()
83 if (ret < 0) in ds2780_read16()
84 return ret; in ds2780_read16()
115 int ret; in ds2780_save_eeprom() local
117 ret = ds2780_store_eeprom(dev_info->w1_dev, reg); in ds2780_save_eeprom()
118 if (ret < 0) in ds2780_save_eeprom()
119 return ret; in ds2780_save_eeprom()
121 ret = ds2780_recall_eeprom(dev_info->w1_dev, reg); in ds2780_save_eeprom()
122 if (ret < 0) in ds2780_save_eeprom()
123 return ret; in ds2780_save_eeprom()
132 int ret; in ds2780_set_sense_register() local
134 ret = ds2780_write(dev_info, &conductance, in ds2780_set_sense_register()
136 if (ret < 0) in ds2780_set_sense_register()
137 return ret; in ds2780_set_sense_register()
153 int ret; in ds2780_set_rsgain_register() local
156 ret = ds2780_write(dev_info, raw, in ds2780_set_rsgain_register()
158 if (ret < 0) in ds2780_set_rsgain_register()
159 return ret; in ds2780_set_rsgain_register()
167 int ret; in ds2780_get_voltage() local
179 ret = ds2780_read16(dev_info, &voltage_raw, in ds2780_get_voltage()
181 if (ret < 0) in ds2780_get_voltage()
182 return ret; in ds2780_get_voltage()
195 int ret; in ds2780_get_temperature() local
208 ret = ds2780_read16(dev_info, &temperature_raw, in ds2780_get_temperature()
210 if (ret < 0) in ds2780_get_temperature()
211 return ret; in ds2780_get_temperature()
226 int ret, sense_res; in ds2780_get_current() local
234 ret = ds2780_read8(dev_info, &sense_res_raw, DS2780_RSNSP_REG); in ds2780_get_current()
235 if (ret < 0) in ds2780_get_current()
236 return ret; in ds2780_get_current()
260 ret = ds2780_read16(dev_info, ¤t_raw, reg_msb); in ds2780_get_current()
261 if (ret < 0) in ds2780_get_current()
262 return ret; in ds2780_get_current()
271 int ret, sense_res; in ds2780_get_accumulated_current() local
279 ret = ds2780_read8(dev_info, &sense_res_raw, DS2780_RSNSP_REG); in ds2780_get_accumulated_current()
280 if (ret < 0) in ds2780_get_accumulated_current()
281 return ret; in ds2780_get_accumulated_current()
297 ret = ds2780_read16(dev_info, ¤t_raw, DS2780_ACR_MSB_REG); in ds2780_get_accumulated_current()
298 if (ret < 0) in ds2780_get_accumulated_current()
299 return ret; in ds2780_get_accumulated_current()
308 int ret; in ds2780_get_capacity() local
311 ret = ds2780_read8(dev_info, &raw, DS2780_RARC_REG); in ds2780_get_capacity()
312 if (ret < 0) in ds2780_get_capacity()
313 return ret; in ds2780_get_capacity()
321 int ret, current_uA, capacity; in ds2780_get_status() local
323 ret = ds2780_get_current(dev_info, CURRENT_NOW, ¤t_uA); in ds2780_get_status()
324 if (ret < 0) in ds2780_get_status()
325 return ret; in ds2780_get_status()
327 ret = ds2780_get_capacity(dev_info, &capacity); in ds2780_get_status()
328 if (ret < 0) in ds2780_get_status()
329 return ret; in ds2780_get_status()
346 int ret; in ds2780_get_charge_now() local
357 ret = ds2780_read16(dev_info, &charge_raw, DS2780_RAAC_MSB_REG); in ds2780_get_charge_now()
358 if (ret < 0) in ds2780_get_charge_now()
359 return ret; in ds2780_get_charge_now()
374 int ret; in ds2780_set_control_register() local
376 ret = ds2780_write(dev_info, &control_reg, in ds2780_set_control_register()
378 if (ret < 0) in ds2780_set_control_register()
379 return ret; in ds2780_set_control_register()
388 int ret = 0; in ds2780_battery_get_property() local
393 ret = ds2780_get_voltage(dev_info, &val->intval); in ds2780_battery_get_property()
397 ret = ds2780_get_temperature(dev_info, &val->intval); in ds2780_battery_get_property()
409 ret = ds2780_get_current(dev_info, CURRENT_NOW, &val->intval); in ds2780_battery_get_property()
413 ret = ds2780_get_current(dev_info, CURRENT_AVG, &val->intval); in ds2780_battery_get_property()
417 ret = ds2780_get_status(dev_info, &val->intval); in ds2780_battery_get_property()
421 ret = ds2780_get_capacity(dev_info, &val->intval); in ds2780_battery_get_property()
425 ret = ds2780_get_accumulated_current(dev_info, &val->intval); in ds2780_battery_get_property()
429 ret = ds2780_get_charge_now(dev_info, &val->intval); in ds2780_battery_get_property()
433 ret = -EINVAL; in ds2780_battery_get_property()
436 return ret; in ds2780_battery_get_property()
456 int ret; in ds2780_get_pmod_enabled() local
462 ret = ds2780_get_control_register(dev_info, &control_reg); in ds2780_get_pmod_enabled()
463 if (ret < 0) in ds2780_get_pmod_enabled()
464 return ret; in ds2780_get_pmod_enabled()
475 int ret; in ds2780_set_pmod_enabled() local
481 ret = ds2780_get_control_register(dev_info, &control_reg); in ds2780_set_pmod_enabled()
482 if (ret < 0) in ds2780_set_pmod_enabled()
483 return ret; in ds2780_set_pmod_enabled()
485 ret = kstrtou8(buf, 0, &new_setting); in ds2780_set_pmod_enabled()
486 if (ret < 0) in ds2780_set_pmod_enabled()
487 return ret; in ds2780_set_pmod_enabled()
499 ret = ds2780_set_control_register(dev_info, control_reg); in ds2780_set_pmod_enabled()
500 if (ret < 0) in ds2780_set_pmod_enabled()
501 return ret; in ds2780_set_pmod_enabled()
510 int ret; in ds2780_get_sense_resistor_value() local
515 ret = ds2780_read8(dev_info, &sense_resistor, DS2780_RSNSP_REG); in ds2780_get_sense_resistor_value()
516 if (ret < 0) in ds2780_get_sense_resistor_value()
517 return ret; in ds2780_get_sense_resistor_value()
519 ret = sprintf(buf, "%d\n", sense_resistor); in ds2780_get_sense_resistor_value()
520 return ret; in ds2780_get_sense_resistor_value()
528 int ret; in ds2780_set_sense_resistor_value() local
533 ret = kstrtou8(buf, 0, &new_setting); in ds2780_set_sense_resistor_value()
534 if (ret < 0) in ds2780_set_sense_resistor_value()
535 return ret; in ds2780_set_sense_resistor_value()
537 ret = ds2780_set_sense_register(dev_info, new_setting); in ds2780_set_sense_resistor_value()
538 if (ret < 0) in ds2780_set_sense_resistor_value()
539 return ret; in ds2780_set_sense_resistor_value()
548 int ret; in ds2780_get_rsgain_setting() local
553 ret = ds2780_get_rsgain_register(dev_info, &rsgain); in ds2780_get_rsgain_setting()
554 if (ret < 0) in ds2780_get_rsgain_setting()
555 return ret; in ds2780_get_rsgain_setting()
565 int ret; in ds2780_set_rsgain_setting() local
570 ret = kstrtou16(buf, 0, &new_setting); in ds2780_set_rsgain_setting()
571 if (ret < 0) in ds2780_set_rsgain_setting()
572 return ret; in ds2780_set_rsgain_setting()
580 ret = ds2780_set_rsgain_register(dev_info, new_setting); in ds2780_set_rsgain_setting()
581 if (ret < 0) in ds2780_set_rsgain_setting()
582 return ret; in ds2780_set_rsgain_setting()
591 int ret; in ds2780_get_pio_pin() local
596 ret = ds2780_read8(dev_info, &sfr, DS2780_SFR_REG); in ds2780_get_pio_pin()
597 if (ret < 0) in ds2780_get_pio_pin()
598 return ret; in ds2780_get_pio_pin()
600 ret = sprintf(buf, "%d\n", sfr & DS2780_SFR_REG_PIOSC); in ds2780_get_pio_pin()
601 return ret; in ds2780_get_pio_pin()
609 int ret; in ds2780_set_pio_pin() local
614 ret = kstrtou8(buf, 0, &new_setting); in ds2780_set_pio_pin()
615 if (ret < 0) in ds2780_set_pio_pin()
616 return ret; in ds2780_set_pio_pin()
623 ret = ds2780_write(dev_info, &new_setting, in ds2780_set_pio_pin()
625 if (ret < 0) in ds2780_set_pio_pin()
626 return ret; in ds2780_set_pio_pin()
652 int ret; in ds2780_write_param_eeprom_bin() local
654 ret = ds2780_write(dev_info, buf, in ds2780_write_param_eeprom_bin()
656 if (ret < 0) in ds2780_write_param_eeprom_bin()
657 return ret; in ds2780_write_param_eeprom_bin()
659 ret = ds2780_save_eeprom(dev_info, DS2780_EEPROM_BLOCK1_START); in ds2780_write_param_eeprom_bin()
660 if (ret < 0) in ds2780_write_param_eeprom_bin()
661 return ret; in ds2780_write_param_eeprom_bin()
697 int ret; in ds2780_write_user_eeprom_bin() local
699 ret = ds2780_write(dev_info, buf, in ds2780_write_user_eeprom_bin()
701 if (ret < 0) in ds2780_write_user_eeprom_bin()
702 return ret; in ds2780_write_user_eeprom_bin()
704 ret = ds2780_save_eeprom(dev_info, DS2780_EEPROM_BLOCK0_START); in ds2780_write_user_eeprom_bin()
705 if (ret < 0) in ds2780_write_user_eeprom_bin()
706 return ret; in ds2780_write_user_eeprom_bin()
746 int ret = 0; in ds2780_battery_probe() local
751 ret = -ENOMEM; in ds2780_battery_probe()
771 ret = PTR_ERR(dev_info->bat); in ds2780_battery_probe()
775 ret = sysfs_create_group(&dev_info->bat->dev.kobj, &ds2780_attr_group); in ds2780_battery_probe()
776 if (ret) { in ds2780_battery_probe()
781 ret = sysfs_create_bin_file(&dev_info->bat->dev.kobj, in ds2780_battery_probe()
783 if (ret) { in ds2780_battery_probe()
789 ret = sysfs_create_bin_file(&dev_info->bat->dev.kobj, in ds2780_battery_probe()
791 if (ret) { in ds2780_battery_probe()
807 return ret; in ds2780_battery_probe()