Changeset 4687
- Timestamp:
- 08/19/07 17:04:29 (1 year ago)
- Files:
-
- lm-sensors/branches/lm-sensors-3.0.0/lib/access.c (modified) (1 diff)
- lm-sensors/branches/lm-sensors-3.0.0/lib/conf-parse.y (modified) (4 diffs)
- lm-sensors/branches/lm-sensors-3.0.0/lib/data.c (modified) (4 diffs)
- lm-sensors/branches/lm-sensors-3.0.0/lib/data.h (modified) (2 diffs)
- lm-sensors/branches/lm-sensors-3.0.0/lib/sysfs.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
lm-sensors/branches/lm-sensors-3.0.0/lib/access.c
r4686 r4687 327 327 /* bus types with several instances */ 328 328 for (i = 0; i < sensors_proc_bus_count; i++) 329 if (sensors_proc_bus[i].number == bus->nr) 329 if (sensors_proc_bus[i].bus.type == bus->type && 330 sensors_proc_bus[i].bus.nr == bus->nr) 330 331 return sensors_proc_bus[i].adapter; 331 332 return NULL; lm-sensors/branches/lm-sensors-3.0.0/lib/conf-parse.y
r4465 r4687 95 95 sensors_chip_name_list chips; 96 96 sensors_expr *expr; 97 intbus;97 sensors_bus_id bus; 98 98 sensors_chip_name chip; 99 99 int line; … … 119 119 %type <chips> chip_name_list 120 120 %type <expr> expression 121 %type <bus> i2cbus_name121 %type <bus> bus_id 122 122 %type <name> adapter_name 123 123 %type <name> function_name … … 142 142 ; 143 143 144 bus_statement: BUS i2cbus_nameadapter_name144 bus_statement: BUS bus_id adapter_name 145 145 { sensors_bus new_el; 146 146 new_el.lineno = $1; 147 new_el.number= $2;147 new_el.bus = $2; 148 148 new_el.adapter = $3; 149 149 bus_add_el(&new_el); … … 288 288 ; 289 289 290 i2cbus_name:NAME291 { int res = sensors_parse_ i2cbus_name($1,&$$);290 bus_id: NAME 291 { int res = sensors_parse_bus_id($1,&$$); 292 292 free($1); 293 293 if (res) { 294 sensors_yyerror("Parse error in i2c bus name");294 sensors_yyerror("Parse error in bus id"); 295 295 YYERROR; 296 296 } lm-sensors/branches/lm-sensors-3.0.0/lib/data.c
r4686 r4687 168 168 } 169 169 170 int sensors_parse_ i2cbus_name(const char *name, int *res)170 int sensors_parse_bus_id(const char *name, sensors_bus_id *bus) 171 171 { 172 172 char *endptr; … … 176 176 } 177 177 name += 4; 178 *res = strtoul(name, &endptr, 10); 179 if (*name == '\0' || *endptr != '\0' || *res < 0) 178 bus->type = SENSORS_BUS_TYPE_I2C; 179 bus->nr = strtoul(name, &endptr, 10); 180 if (*name == '\0' || *endptr != '\0' || bus->nr < 0) 180 181 return -SENSORS_ERR_BUS_NAME; 181 182 return 0; … … 186 187 int i, j; 187 188 for (i = 0; i < sensors_config_busses_count; i++) 188 if ( name->bus.type == SENSORS_BUS_TYPE_I2C&&189 sensors_config_busses[i]. number == name->bus.nr)189 if (sensors_config_busses[i].bus.type == name->bus.type && 190 sensors_config_busses[i].bus.nr == name->bus.nr) 190 191 break; 191 192 192 193 if (i == sensors_config_busses_count) { 193 sensors_parse_error("Undeclared i2c busreferenced", lineno);194 sensors_parse_error("Undeclared bus id referenced", lineno); 194 195 name->bus.nr = sensors_proc_bus_count; 195 196 return -SENSORS_ERR_BUS_NAME; … … 200 201 if (!strcmp(sensors_config_busses[i].adapter, 201 202 sensors_proc_bus[j].adapter)) { 202 name->bus.nr = sensors_proc_bus[j]. number;203 name->bus.nr = sensors_proc_bus[j].bus.nr; 203 204 return 0; 204 205 } lm-sensors/branches/lm-sensors-3.0.0/lib/data.h
r4545 r4687 111 111 } sensors_chip; 112 112 113 /* Config file bus declaration: the i2c busnumber, combined with adapter113 /* Config file bus declaration: the bus type and number, combined with adapter 114 114 name */ 115 115 typedef struct sensors_bus { 116 int number;116 sensors_bus_id bus; 117 117 char *adapter; 118 118 int lineno; … … 176 176 177 177 178 /* Parse a n i2c bus nameinto its components. Returns 0 on succes, a value from178 /* Parse a bus id into its components. Returns 0 on succes, a value from 179 179 error.h on failure. */ 180 int sensors_parse_ i2cbus_name(const char *name, int *res);180 int sensors_parse_bus_id(const char *name, sensors_bus_id *bus); 181 181 182 182 #endif /* def LIB_SENSORS_DATA_H */ lm-sensors/branches/lm-sensors-3.0.0/lib/sysfs.c
r4686 r4687 381 381 continue; 382 382 383 if (sscanf(clsdev->name, "i2c-% d", &entry.number) != 1 ||384 entry. number == 9191) /* legacy ISA */383 if (sscanf(clsdev->name, "i2c-%hd", &entry.bus.nr) != 1 || 384 entry.bus.nr == 9191) /* legacy ISA */ 385 385 continue; 386 entry.bus.type = SENSORS_BUS_TYPE_I2C; 386 387 387 388 /* NB: attr->value[attr->len-1] == '\n'; chop that off */
