Exemple #1
0
static ssize_t store_amb_max(struct device *dev,
			     struct device_attribute *devattr,
			     const char *buf,
			     size_t count)
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct i5k_amb_data *data = dev_get_drvdata(dev);
	unsigned long temp = simple_strtoul(buf, NULL, 10) / 500;

	if (temp > 255)
		temp = 255;

	amb_write_byte(data, amb_reg_temp_max(attr->index), temp);
	return count;
}
Exemple #2
0
static ssize_t store_amb_mid(struct device *dev,
			     struct device_attribute *devattr,
			     const char *buf,
			     size_t count)
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct i5k_amb_data *data = dev_get_drvdata(dev);
	unsigned long temp;
	int ret = kstrtoul(buf, 10, &temp);
	if (ret < 0)
		return ret;

	temp = temp / 500;
	if (temp > 255)
		temp = 255;

	amb_write_byte(data, amb_reg_temp_mid(attr->index), temp);
	return count;
}