default: return -EINVAL; } return 0; } #define BATTERY_ATTR(_name) \ { \ .attr = { .name = #_name, .mode = S_IRUGO | S_IWUGO, .owner = THIS_MODULE }, \ .show = utv210_bat_show_property, \ .store = utv210_bat_store, \ } static struct device_attribute utv210_battery_attrs[] = { BATTERY_ATTR(batt_vol), BATTERY_ATTR(batt_vol_adc), BATTERY_ATTR(batt_vol_adc_cal), BATTERY_ATTR(batt_temp), BATTERY_ATTR(batt_temp_adc), BATTERY_ATTR(batt_temp_adc_cal), }; enum { BATT_VOL = 0, BATT_VOL_ADC, BATT_VOL_ADC_CAL, BATT_TEMP, BATT_TEMP_ADC, BATT_TEMP_ADC_CAL, };
static ssize_t battery_store_property(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); #define BATTERY_ATTR(_name) \ { \ .attr = { .name = #_name, \ .mode = S_IRUGO | S_IWUSR | S_IWGRP, \ }, \ .show = battery_show_property, \ .store = battery_store_property, \ } static struct device_attribute battery_attrs[] = { BATTERY_ATTR(batt_reset_soc), BATTERY_ATTR(batt_read_raw_soc), BATTERY_ATTR(batt_read_adj_soc), BATTERY_ATTR(batt_type), BATTERY_ATTR(batt_temp_adc), BATTERY_ATTR(batt_temp_aver), BATTERY_ATTR(batt_temp_adc_aver), BATTERY_ATTR(batt_vol_aver), BATTERY_ATTR(batt_vfocv), BATTERY_ATTR(batt_lp_charging), BATTERY_ATTR(batt_charging_source), BATTERY_ATTR(test_mode), BATTERY_ATTR(batt_error_test), BATTERY_ATTR(siop_activated), BATTERY_ATTR(wc_status), BATTERY_ATTR(wpc_pin_state),