@@ -306,6 +306,8 @@ struct lm85_data {
306306 const int * freq_map ;
307307 enum chips type ;
308308
309+ bool has_vid5 ; /* true if VID5 is configured for ADT7463 or ADT7468 */
310+
309311 struct mutex update_lock ;
310312 int valid ; /* !=0 if following fields are valid */
311313 unsigned long last_reading ; /* In jiffies */
@@ -420,8 +422,7 @@ static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr,
420422 struct lm85_data * data = lm85_update_device (dev );
421423 int vid ;
422424
423- if ((data -> type == adt7463 || data -> type == adt7468 ) &&
424- (data -> vid & 0x80 )) {
425+ if (data -> has_vid5 ) {
425426 /* 6-pin VID (VRM 10) */
426427 vid = vid_from_reg (data -> vid & 0x3f , data -> vrm );
427428 } else {
@@ -1321,9 +1322,13 @@ static int lm85_probe(struct i2c_client *client,
13211322
13221323 /* The ADT7463/68 have an optional VRM 10 mode where pin 21 is used
13231324 as a sixth digital VID input rather than an analog input. */
1324- data -> vid = lm85_read_value (client , LM85_REG_VID );
1325- if (!((data -> type == adt7463 || data -> type == adt7468 ) &&
1326- (data -> vid & 0x80 )))
1325+ if (data -> type == adt7463 || data -> type == adt7468 ) {
1326+ u8 vid = lm85_read_value (client , LM85_REG_VID );
1327+ if (vid & 0x80 )
1328+ data -> has_vid5 = true;
1329+ }
1330+
1331+ if (!data -> has_vid5 )
13271332 if ((err = sysfs_create_group (& client -> dev .kobj ,
13281333 & lm85_group_in4 )))
13291334 goto err_remove_files ;
@@ -1457,11 +1462,8 @@ static struct lm85_data *lm85_update_device(struct device *dev)
14571462 lm85_read_value (client , LM85_REG_FAN (i ));
14581463 }
14591464
1460- if (!((data -> type == adt7463 || data -> type == adt7468 ) &&
1461- (data -> vid & 0x80 ))) {
1462- data -> in [4 ] = lm85_read_value (client ,
1463- LM85_REG_IN (4 ));
1464- }
1465+ if (!data -> has_vid5 )
1466+ data -> in [4 ] = lm85_read_value (client , LM85_REG_IN (4 ));
14651467
14661468 if (data -> type == adt7468 )
14671469 data -> cfg5 = lm85_read_value (client , ADT7468_REG_CFG5 );
@@ -1528,8 +1530,7 @@ static struct lm85_data *lm85_update_device(struct device *dev)
15281530 lm85_read_value (client , LM85_REG_FAN_MIN (i ));
15291531 }
15301532
1531- if (!((data -> type == adt7463 || data -> type == adt7468 ) &&
1532- (data -> vid & 0x80 ))) {
1533+ if (!data -> has_vid5 ) {
15331534 data -> in_min [4 ] = lm85_read_value (client ,
15341535 LM85_REG_IN_MIN (4 ));
15351536 data -> in_max [4 ] = lm85_read_value (client ,
0 commit comments