Changeset 2124

Show
Ignore:
Timestamp:
11/30/03 12:40:20 (9 years ago)
Author:
khali
Message:

Fix IN_FROM_REG rounding.

Location:
lm-sensors/trunk/kernel/chips
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/kernel/chips/it87.c

    r2068 r2124  
    138138#define PIIDIODE        3 
    139139 
    140 /* Conversions. Rounding and limit checking is only done on the TO_REG  
     140/* Conversions. Limit checking is only done on the TO_REG  
    141141   variants. Note that you should be a bit careful with which arguments 
    142142   these macros are called: arguments may be evaluated more than once. 
    143143   Fixing this is just not worth it. */ 
    144144#define IN_TO_REG(val)  (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255)) 
    145 #define IN_FROM_REG(val) (((val) *  16) / 10) 
     145#define IN_FROM_REG(val) (((val) *  16 + 5) / 10) 
    146146 
    147147static inline u8 FAN_TO_REG(long rpm, int div) 
  • lm-sensors/trunk/kernel/chips/lm78.c

    r2069 r2124  
    7474 
    7575 
    76 /* Conversions. Rounding and limit checking is only done on the TO_REG  
     76/* Conversions. Limit checking is only done on the TO_REG  
    7777   variants. Note that you should be a bit careful with which arguments 
    7878   these macros are called: arguments may be evaluated more than once. 
    7979   Fixing this is just not worth it. */ 
    8080#define IN_TO_REG(val)  (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255)) 
    81 #define IN_FROM_REG(val) (((val) *  16) / 10) 
     81#define IN_FROM_REG(val) (((val) *  16 + 5) / 10) 
    8282 
    8383static inline u8 FAN_TO_REG(long rpm, int div) 
  • lm-sensors/trunk/kernel/chips/mtp008.c

    r2070 r2124  
    103103 
    104104/* 
    105  * Conversion routines and macros.  Rounding and limit checking is only done on 
     105 * Conversion routines and macros.  Limit checking is only done on 
    106106 * the TO_REG variants. 
    107107 * 
     
    111111 */ 
    112112#define IN_TO_REG(val)          (SENSORS_LIMIT((((val) * 10 + 8) / 16), 0, 255)) 
    113 #define IN_FROM_REG(val)        (((val) * 16) / 10) 
     113#define IN_FROM_REG(val)        (((val) * 16 + 5) / 10) 
    114114 
    115115/* 
  • lm-sensors/trunk/kernel/chips/sis5595.c

    r2123 r2124  
    139139#define SIS5595_REG_FANDIV 0x47 
    140140 
    141 /* Conversions. Rounding and limit checking is only done on the TO_REG 
     141/* Conversions. Limit checking is only done on the TO_REG 
    142142   variants. Note that you should be a bit careful with which arguments 
    143143   these macros are called: arguments may be evaluated more than once. 
     
    145145 
    146146#define IN_TO_REG(val)  (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255)) 
    147 #define IN_FROM_REG(val) (((val) *  16) / 10) 
     147#define IN_FROM_REG(val) (((val) *  16 + 5) / 10) 
    148148 
    149149static inline u8 FAN_TO_REG(long rpm, int div) 
  • lm-sensors/trunk/kernel/chips/w83627hf.c

    r2070 r2124  
    200200#define W83781D_DEFAULT_BETA 3435 
    201201 
    202 /* Conversions. Rounding and limit checking is only done on the TO_REG 
     202/* Conversions. Limit checking is only done on the TO_REG 
    203203   variants. Note that you should be a bit careful with which arguments 
    204204   these macros are called: arguments may be evaluated more than once. 
    205205   Fixing this is just not worth it. */ 
    206206#define IN_TO_REG(val)  (SENSORS_LIMIT((((val) * 10 + 8)/16),0,255)) 
    207 #define IN_FROM_REG(val) (((val) * 16) / 10) 
     207#define IN_FROM_REG(val) (((val) * 16 + 5) / 10) 
    208208 
    209209static inline u8 FAN_TO_REG(long rpm, int div)