[PATCH] i2c convert via686a temp_* to milli degree celsius

Jan Dittmer (j.dittmer@portrix.net)
Wed, 25 Jun 2003 09:25:11 +0200


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-3243-1056526015-0001-2
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Forgot to send this.

This converts the i2c chip driver via686a to handle milli degree celsius
instead of centi degree celsius. Applies for temp_input, temp_min, temp_max.

Jan

--=_courier-3243-1056526015-0001-2
Content-Type: text/plain; name="via686a_convert_temp.patch"; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="via686a_convert_temp.patch"

diff -u linux-mm/drivers/i2c/chips/via686a.c 2.5.73-mm1/drivers/i2c/chips/via686a.c
--- linux-mm/drivers/i2c/chips/via686a.c 2003-05-31 14:15:03.000000000 +0200
+++ 2.5.73-mm1/drivers/i2c/chips/via686a.c 2003-06-24 17:18:09.000000000 +0200
@@ -494,27 +494,27 @@
struct i2c_client *client = to_i2c_client(dev);
struct via686a_data *data = i2c_get_clientdata(client);
via686a_update_client(client);
- return sprintf(buf, "%ld\n", TEMP_FROM_REG10(data->temp[nr])*10 );
+ return sprintf(buf, "%ld\n", TEMP_FROM_REG10(data->temp[nr])*100 );
}
/* more like overshoot temperature */
static ssize_t show_temp_max(struct device *dev, char *buf, int nr) {
struct i2c_client *client = to_i2c_client(dev);
struct via686a_data *data = i2c_get_clientdata(client);
via686a_update_client(client);
- return sprintf(buf, "%ld\n", TEMP_FROM_REG(data->temp_over[nr])*10);
+ return sprintf(buf, "%ld\n", TEMP_FROM_REG(data->temp_over[nr])*100);
}
/* more like hysteresis temperature */
static ssize_t show_temp_min(struct device *dev, char *buf, int nr) {
struct i2c_client *client = to_i2c_client(dev);
struct via686a_data *data = i2c_get_clientdata(client);
via686a_update_client(client);
- return sprintf(buf, "%ld\n", TEMP_FROM_REG(data->temp_hyst[nr])*10);
+ return sprintf(buf, "%ld\n", TEMP_FROM_REG(data->temp_hyst[nr])*100);
}
static ssize_t set_temp_max(struct device *dev, const char *buf,
size_t count, int nr) {
struct i2c_client *client = to_i2c_client(dev);
struct via686a_data *data = i2c_get_clientdata(client);
- int val = simple_strtol(buf, NULL, 10)/10;
+ int val = simple_strtol(buf, NULL, 10)/100;
data->temp_over[nr] = TEMP_TO_REG(val);
via686a_write_value(client, VIA686A_REG_TEMP_OVER(nr), data->temp_over[nr]);
return count;
@@ -523,7 +523,7 @@
size_t count, int nr) {
struct i2c_client *client = to_i2c_client(dev);
struct via686a_data *data = i2c_get_clientdata(client);
- int val = simple_strtol(buf, NULL, 10)/10;
+ int val = simple_strtol(buf, NULL, 10)/100;
data->temp_hyst[nr] = TEMP_TO_REG(val);
via686a_write_value(client, VIA686A_REG_TEMP_HYST(nr), data->temp_hyst[nr]);
return count;

--=_courier-3243-1056526015-0001-2--