Changeset 2658
- Timestamp:
- 08/12/04 21:51:04 (9 years ago)
- Files:
-
- 1 modified
-
lm-sensors/trunk/kernel/chips/adm9240.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/kernel/chips/adm9240.c
r2445 r2658 2 2 adm9240.c - Part of lm_sensors, Linux kernel modules for hardware 3 3 monitoring 4 Copyright ( c) 1999 Frodo Looijaard <frodol@dds.nl>4 Copyright (C) 1999 Frodo Looijaard <frodol@dds.nl> 5 5 and Philip Edelbrock <phil@netroedge.com> 6 6 … … 54 54 #include <linux/init.h> 55 55 #include "version.h" 56 57 MODULE_LICENSE("GPL");58 56 59 57 /* Addresses to scan */ … … 127 125 these macros are called: arguments may be evaluated more than once. 128 126 Fixing this is just not worth it. */ 129 #define IN_TO_REG(val,nr) (SENSORS_LIMIT(( (val) & 0xff),0,255))127 #define IN_TO_REG(val,nr) (SENSORS_LIMIT((val), 0, 255)) 130 128 #define IN_FROM_REG(val,nr) (val) 131 129 … … 142 140 (val)==255?0:1350000/((div)*(val))) 143 141 144 #define TEMP_FROM_REG(temp) \ 145 ((temp)<256?((((temp)&0x1fe) >> 1) * 10) + ((temp) & 1) * 5: \ 146 ((((temp)&0x1fe) >> 1) -255) * 10 - ((temp) & 1) * 5) \ 147 148 #define TEMP_LIMIT_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*10) 149 150 #define TEMP_LIMIT_TO_REG(val) SENSORS_LIMIT(((val)<0?(((val)-5)/10):\ 142 #define TEMP_FROM_REG(temp) ((temp)<256 ? (temp) * 5 : \ 143 ((temp) - 512) * 5) 144 145 #define TEMP_LIMIT_FROM_REG(val) (((val)>=0x80?(val)-0x100:(val))*10) 146 147 #define TEMP_LIMIT_TO_REG(val) SENSORS_LIMIT(((val)<0?(((val)-5)/10)+256:\ 151 148 ((val)+5)/10), \ 152 149 0,255) … … 160 157 205-(val)*5) 161 158 162 /* For each registered ADM9240, we need to keep some data in memory. That 163 data is pointed to by adm9240_list[NR]->data. The structure itself is 164 dynamically allocated, at the same time when a new adm9240 client is 165 allocated. */ 159 /* For each registered ADM9240, we need to keep some data in memory. */ 166 160 struct adm9240_data { 167 161 struct i2c_client client; … … 193 187 static int adm9240_detach_client(struct i2c_client *client); 194 188 195 static int adm9240_read_value(struct i2c_client *client, u8 register); 196 static int adm9240_write_value(struct i2c_client *client, u8 register, 197 u8 value); 189 static int adm9240_read_value(struct i2c_client *client, u8 reg); 190 static int adm9240_write_value(struct i2c_client *client, u8 reg, u8 value); 198 191 static void adm9240_update_client(struct i2c_client *client); 199 192 static void adm9240_init_client(struct i2c_client *client); … … 308 301 const char *client_name = ""; 309 302 310 /* Make sure we aren't probing the ISA bus!! This is just a safety check311 at this moment; i2c_detect really won't call us. */312 #ifdef DEBUG313 if (i2c_is_isa_adapter(adapter)) {314 printk315 ("adm9240.o: adm9240_detect called for an ISA bus adapter?!?\n");316 return 0;317 }318 #endif319 320 303 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 321 304 goto ERROR0; … … 444 427 static int adm9240_read_value(struct i2c_client *client, u8 reg) 445 428 { 446 return 0xFF &i2c_smbus_read_byte_data(client, reg);429 return i2c_smbus_read_byte_data(client, reg); 447 430 } 448 431 … … 452 435 } 453 436 454 /* Called when we have found a new ADM9240. It should set limits, etc.*/437 /* Called when we have found a new ADM9240. */ 455 438 static void adm9240_init_client(struct i2c_client *client) 456 439 { … … 723 706 MODULE_AUTHOR 724 707 ("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>"); 708 MODULE_LICENSE("GPL"); 725 709 MODULE_DESCRIPTION("ADM9240 driver"); 726 710
