Fix IN_FROM_REG rounding.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2124 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2003-11-30 11:40:20 +00:00
1 parent c1e28f8896
commit a3c77b0191
5 files changed
+10 -10

No files matched your search

+2 -2
View File
@@ -137,12 +137,12 @@ static int init = 1;
#define THERMISTOR 2
#define PIIDIODE 3
/* Conversions. Rounding and limit checking is only done on the TO_REG
/* Conversions. Limit checking is only done on the TO_REG
variants. Note that you should be a bit careful with which arguments
these macros are called: arguments may be evaluated more than once.
Fixing this is just not worth it. */
#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255))
#define IN_FROM_REG(val) (((val) * 16) / 10)
#define IN_FROM_REG(val) (((val) * 16 + 5) / 10)
static inline u8 FAN_TO_REG(long rpm, int div)
{
+2 -2
View File
@@ -73,12 +73,12 @@ SENSORS_INSMOD_3(lm78, lm78j, lm79);
#define LM78_REG_I2C_ADDR 0x48
/* Conversions. Rounding and limit checking is only done on the TO_REG
/* Conversions. Limit checking is only done on the TO_REG
variants. Note that you should be a bit careful with which arguments
these macros are called: arguments may be evaluated more than once.
Fixing this is just not worth it. */
#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255))
#define IN_FROM_REG(val) (((val) * 16) / 10)
#define IN_FROM_REG(val) (((val) * 16 + 5) / 10)
static inline u8 FAN_TO_REG(long rpm, int div)
{
+2 -2
View File
@@ -102,7 +102,7 @@ SENSORS_INSMOD_1(mtp008);
#define PIIDIODE 3
/*
* Conversion routines and macros. Rounding and limit checking is only done on
* Conversion routines and macros. Limit checking is only done on
* the TO_REG variants.
*
* Note that IN values are expressed as 100 times the actual voltage to avoid
@@ -110,7 +110,7 @@ SENSORS_INSMOD_1(mtp008);
* 409 (0V to 4.096V).
*/
#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8) / 16), 0, 255))
#define IN_FROM_REG(val) (((val) * 16) / 10)
#define IN_FROM_REG(val) (((val) * 16 + 5) / 10)
/*
* The fan cotation count (as stored in the register) is calculated using the
+2 -2
View File
@@ -138,13 +138,13 @@ static int blacklist[] = {
#define SIS5595_REG_ALARM2 0x42
#define SIS5595_REG_FANDIV 0x47
/* Conversions. Rounding and limit checking is only done on the TO_REG
/* Conversions. Limit checking is only done on the TO_REG
variants. Note that you should be a bit careful with which arguments
these macros are called: arguments may be evaluated more than once.
Fixing this is just not worth it. */
#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255))
#define IN_FROM_REG(val) (((val) * 16) / 10)
#define IN_FROM_REG(val) (((val) * 16 + 5) / 10)
static inline u8 FAN_TO_REG(long rpm, int div)
{
+2 -2
View File
@@ -199,12 +199,12 @@ static const u8 BIT_SCFG1[] = { 0x02, 0x04, 0x08 };
static const u8 BIT_SCFG2[] = { 0x10, 0x20, 0x40 };
#define W83781D_DEFAULT_BETA 3435
/* Conversions. Rounding and limit checking is only done on the TO_REG
/* Conversions. Limit checking is only done on the TO_REG
variants. Note that you should be a bit careful with which arguments
these macros are called: arguments may be evaluated more than once.
Fixing this is just not worth it. */
#define IN_TO_REG(val) (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255))
#define IN_FROM_REG(val) (((val) * 16) / 10)
#define IN_FROM_REG(val) (((val) * 16 + 5) / 10)
static inline u8 FAN_TO_REG(long rpm, int div)
{