diff options
Diffstat (limited to 'drivers/hwmon/pmbus')
-rw-r--r-- | drivers/hwmon/pmbus/pmbus_core.c | 9 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/ucd9000.c | 6 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/ucd9200.c | 6 |
3 files changed, 12 insertions, 9 deletions
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index a561c3a0e916..397fc59b5682 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c | |||
@@ -978,6 +978,8 @@ static void pmbus_find_max_attr(struct i2c_client *client, | |||
978 | struct pmbus_limit_attr { | 978 | struct pmbus_limit_attr { |
979 | u16 reg; /* Limit register */ | 979 | u16 reg; /* Limit register */ |
980 | bool update; /* True if register needs updates */ | 980 | bool update; /* True if register needs updates */ |
981 | bool low; /* True if low limit; for limits with compare | ||
982 | functions only */ | ||
981 | const char *attr; /* Attribute name */ | 983 | const char *attr; /* Attribute name */ |
982 | const char *alarm; /* Alarm attribute name */ | 984 | const char *alarm; /* Alarm attribute name */ |
983 | u32 sbit; /* Alarm attribute status bit */ | 985 | u32 sbit; /* Alarm attribute status bit */ |
@@ -1029,7 +1031,8 @@ static bool pmbus_add_limit_attrs(struct i2c_client *client, | |||
1029 | if (attr->compare) { | 1031 | if (attr->compare) { |
1030 | pmbus_add_boolean_cmp(data, name, | 1032 | pmbus_add_boolean_cmp(data, name, |
1031 | l->alarm, index, | 1033 | l->alarm, index, |
1032 | cbase, cindex, | 1034 | l->low ? cindex : cbase, |
1035 | l->low ? cbase : cindex, | ||
1033 | attr->sbase + page, l->sbit); | 1036 | attr->sbase + page, l->sbit); |
1034 | } else { | 1037 | } else { |
1035 | pmbus_add_boolean_reg(data, name, | 1038 | pmbus_add_boolean_reg(data, name, |
@@ -1366,11 +1369,13 @@ static const struct pmbus_sensor_attr power_attributes[] = { | |||
1366 | static const struct pmbus_limit_attr temp_limit_attrs[] = { | 1369 | static const struct pmbus_limit_attr temp_limit_attrs[] = { |
1367 | { | 1370 | { |
1368 | .reg = PMBUS_UT_WARN_LIMIT, | 1371 | .reg = PMBUS_UT_WARN_LIMIT, |
1372 | .low = true, | ||
1369 | .attr = "min", | 1373 | .attr = "min", |
1370 | .alarm = "min_alarm", | 1374 | .alarm = "min_alarm", |
1371 | .sbit = PB_TEMP_UT_WARNING, | 1375 | .sbit = PB_TEMP_UT_WARNING, |
1372 | }, { | 1376 | }, { |
1373 | .reg = PMBUS_UT_FAULT_LIMIT, | 1377 | .reg = PMBUS_UT_FAULT_LIMIT, |
1378 | .low = true, | ||
1374 | .attr = "lcrit", | 1379 | .attr = "lcrit", |
1375 | .alarm = "lcrit_alarm", | 1380 | .alarm = "lcrit_alarm", |
1376 | .sbit = PB_TEMP_UT_FAULT, | 1381 | .sbit = PB_TEMP_UT_FAULT, |
@@ -1399,11 +1404,13 @@ static const struct pmbus_limit_attr temp_limit_attrs[] = { | |||
1399 | static const struct pmbus_limit_attr temp_limit_attrs23[] = { | 1404 | static const struct pmbus_limit_attr temp_limit_attrs23[] = { |
1400 | { | 1405 | { |
1401 | .reg = PMBUS_UT_WARN_LIMIT, | 1406 | .reg = PMBUS_UT_WARN_LIMIT, |
1407 | .low = true, | ||
1402 | .attr = "min", | 1408 | .attr = "min", |
1403 | .alarm = "min_alarm", | 1409 | .alarm = "min_alarm", |
1404 | .sbit = PB_TEMP_UT_WARNING, | 1410 | .sbit = PB_TEMP_UT_WARNING, |
1405 | }, { | 1411 | }, { |
1406 | .reg = PMBUS_UT_FAULT_LIMIT, | 1412 | .reg = PMBUS_UT_FAULT_LIMIT, |
1413 | .low = true, | ||
1407 | .attr = "lcrit", | 1414 | .attr = "lcrit", |
1408 | .alarm = "lcrit_alarm", | 1415 | .alarm = "lcrit_alarm", |
1409 | .sbit = PB_TEMP_UT_FAULT, | 1416 | .sbit = PB_TEMP_UT_FAULT, |
diff --git a/drivers/hwmon/pmbus/ucd9000.c b/drivers/hwmon/pmbus/ucd9000.c index ace1c7319734..d0ddb60155c9 100644 --- a/drivers/hwmon/pmbus/ucd9000.c +++ b/drivers/hwmon/pmbus/ucd9000.c | |||
@@ -141,13 +141,11 @@ static int ucd9000_probe(struct i2c_client *client, | |||
141 | block_buffer[ret] = '\0'; | 141 | block_buffer[ret] = '\0'; |
142 | dev_info(&client->dev, "Device ID %s\n", block_buffer); | 142 | dev_info(&client->dev, "Device ID %s\n", block_buffer); |
143 | 143 | ||
144 | mid = NULL; | 144 | for (mid = ucd9000_id; mid->name[0]; mid++) { |
145 | for (i = 0; i < ARRAY_SIZE(ucd9000_id); i++) { | ||
146 | mid = &ucd9000_id[i]; | ||
147 | if (!strncasecmp(mid->name, block_buffer, strlen(mid->name))) | 145 | if (!strncasecmp(mid->name, block_buffer, strlen(mid->name))) |
148 | break; | 146 | break; |
149 | } | 147 | } |
150 | if (!mid || !strlen(mid->name)) { | 148 | if (!mid->name[0]) { |
151 | dev_err(&client->dev, "Unsupported device\n"); | 149 | dev_err(&client->dev, "Unsupported device\n"); |
152 | return -ENODEV; | 150 | return -ENODEV; |
153 | } | 151 | } |
diff --git a/drivers/hwmon/pmbus/ucd9200.c b/drivers/hwmon/pmbus/ucd9200.c index ffcc1cf3609d..c65e9da707cc 100644 --- a/drivers/hwmon/pmbus/ucd9200.c +++ b/drivers/hwmon/pmbus/ucd9200.c | |||
@@ -68,13 +68,11 @@ static int ucd9200_probe(struct i2c_client *client, | |||
68 | block_buffer[ret] = '\0'; | 68 | block_buffer[ret] = '\0'; |
69 | dev_info(&client->dev, "Device ID %s\n", block_buffer); | 69 | dev_info(&client->dev, "Device ID %s\n", block_buffer); |
70 | 70 | ||
71 | mid = NULL; | 71 | for (mid = ucd9200_id; mid->name[0]; mid++) { |
72 | for (i = 0; i < ARRAY_SIZE(ucd9200_id); i++) { | ||
73 | mid = &ucd9200_id[i]; | ||
74 | if (!strncasecmp(mid->name, block_buffer, strlen(mid->name))) | 72 | if (!strncasecmp(mid->name, block_buffer, strlen(mid->name))) |
75 | break; | 73 | break; |
76 | } | 74 | } |
77 | if (!mid || !strlen(mid->name)) { | 75 | if (!mid->name[0]) { |
78 | dev_err(&client->dev, "Unsupported device\n"); | 76 | dev_err(&client->dev, "Unsupported device\n"); |
79 | return -ENODEV; | 77 | return -ENODEV; |
80 | } | 78 | } |