Exemple #1
0
static ssize_t show_in_min(struct device *dev, struct device_attribute
                           *devattr, char *buf)
{
    struct f71805f_data *data = f71805f_update_device(dev);
    struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
    int nr = attr->index;

    return sprintf(buf, "%ld\n", in_from_reg(data->in_low[nr]));
}
static ssize_t
show_in(struct device *dev, struct device_attribute *attr, char *buf)
{
	struct imanager_hwmon_data *data = imanager_hwmon_update_device(dev);
	int index = to_sensor_dev_attr(attr)->index;
	struct hwm_voltage *adc = &data->hwm.volt[index];

	return sprintf(buf, "%u\n", in_from_reg(adc->value));
}
Exemple #3
0
static ssize_t
show_in_reg(struct device *dev, struct device_attribute *attr, char *buf)
{
	struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
	struct nct6683_data *data = nct6683_update_device(dev);
	int index = sattr->index;
	int nr = sattr->nr;

	return sprintf(buf, "%ld\n",
		       in_from_reg(data->in[index][nr], data->in_index[index]));
}
static ssize_t
show_in_average(struct device *dev, struct device_attribute *attr, char *buf)
{
	struct imanager_hwmon_data *data = imanager_hwmon_update_device(dev);
	int index = to_sensor_dev_attr(attr)->index;
	struct hwm_voltage *adc = &data->hwm.volt[index];

	if (adc->average)
		adc->average = DIV_ROUND_CLOSEST(adc->average * data->samples
				+ adc->value, ++data->samples);
	else {
		adc->average = adc->value;
		data->samples = 1;
	}

	return sprintf(buf, "%u\n", in_from_reg(adc->average));
}