Skip to content

Commit

Permalink
hwmon: Hide error message in OCC hwmon driver
Browse files Browse the repository at this point in the history
User application will poll OCC when host is powered off. OCC can handle
the poll request, but no sensor data will be responded. Currently OCC driver
will report error message when reading sysfs hwmon sensor attribute in this case.
The error message is harmless but is anoying.

This patch hides the error message. Reading sysfs hwmon attribute in this case
will still get an error code, but no more error message.

Signed-off-by: Yi Li <adamliyi@msn.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
  • Loading branch information
Yi Li authored and Joel Stanley committed Mar 29, 2016
1 parent 5583285 commit d741944
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions drivers/hwmon/power8_occ_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,15 +370,15 @@ static int parse_occ_response(struct i2c_client *client,

/* check if the data is valid */
if (strncmp(&data[SENSOR_STR_OFFSET], "SENSOR", 6) != 0) {
dev_err(&client->dev,
dev_dbg(&client->dev,
"ERROR: no SENSOR String in response\n");
ret = -1;
goto err;
}

sensor_block_num = data[SENSOR_BLOCK_NUM_OFFSET];
if (sensor_block_num == 0) {
dev_err(&client->dev, "ERROR: SENSOR block num is 0\n");
dev_dbg(&client->dev, "ERROR: SENSOR block num is 0\n");
ret = -1;
goto err;
}
Expand Down Expand Up @@ -526,7 +526,7 @@ static int parse_occ_response(struct i2c_client *client,
}

} else {
dev_err(&client->dev,
dev_dbg(&client->dev,
"ERROR: sensor type %s not supported\n",
resp->blocks[b].sensor_type);
ret = -1;
Expand Down Expand Up @@ -617,13 +617,13 @@ static int occ_get_all(struct i2c_client *client, struct occ_response *occ_resp)
dev_dbg(&client->dev, "OCC data length: %d\n", num_bytes);

if (num_bytes > OCC_DATA_MAX) {
dev_err(&client->dev, "ERROR: OCC data length must be < 4KB\n");
dev_dbg(&client->dev, "ERROR: OCC data length must be < 4KB\n");
ret = -EINVAL;
goto out;
}

if (num_bytes <= 0) {
dev_err(&client->dev, "ERROR: OCC data length is zero\n");
dev_dbg(&client->dev, "ERROR: OCC data length is zero\n");
ret = -EINVAL;
goto out;
}
Expand Down Expand Up @@ -670,7 +670,7 @@ static void *occ_get_sensor(struct device *hwmon_dev, enum sensor_t t)

ret = occ_update_device(dev);
if (ret != 0) {
dev_err(dev, "ERROR: cannot get occ sensor data: %d\n", ret);
dev_dbg(dev, "ERROR: cannot get occ sensor data: %d\n", ret);
return NULL;
}

Expand Down Expand Up @@ -1161,10 +1161,12 @@ static ssize_t set_user_powercap(struct device *hwmon_dev,
val = cpu_to_le16(val);
err = occ_send_cmd(client, 0, 0x22, 2, (uint8_t *)&val, resp);
if (err != 0) {
dev_err(dev, "Set User Powercap: wrong return status: %x\n",
dev_dbg(dev,
"ERROR: Set User Powercap: wrong return status: %x\n",
err);
if (err == 0x13)
dev_err(dev, "invalid powercap value: %x\n", val);
dev_info(dev,
"ERROR: set invalid powercap value: %x\n", val);
return -EINVAL;
}
data->user_powercap = val;
Expand Down Expand Up @@ -1219,7 +1221,7 @@ static int occ_create_hwmon_attribute(struct device *dev)

ret = occ_update_device(dev);
if (ret != 0) {
dev_err(dev, "ERROR: cannot get occ sensor data: %d\n", ret);
dev_dbg(dev, "ERROR: cannot get occ sensor data: %d\n", ret);
return ret;
}

Expand All @@ -1244,7 +1246,8 @@ static int occ_create_hwmon_attribute(struct device *dev)
ret = sysfs_create_group(&drv_data->hwmon_dev->kobj,
&occ_temp_attr_group[i]);
if (ret) {
dev_err(dev, "error create temp sysfs entry\n");
dev_dbg(dev,
"ERROR: cannot create sysfs entry\n");
goto error;
}
}
Expand All @@ -1258,7 +1261,8 @@ static int occ_create_hwmon_attribute(struct device *dev)
ret = sysfs_create_group(&drv_data->hwmon_dev->kobj,
&occ_freq_attr_group[i]);
if (ret) {
dev_err(dev, "error create freq sysfs entry\n");
dev_dbg(dev,
"ERROR: cannot create sysfs entry\n");
goto error;
}
}
Expand All @@ -1272,7 +1276,8 @@ static int occ_create_hwmon_attribute(struct device *dev)
ret = sysfs_create_group(&drv_data->hwmon_dev->kobj,
&occ_power_attr_group[i]);
if (ret) {
dev_err(dev, "error create power sysfs entry\n");
dev_dbg(dev,
"ERROR: cannot create sysfs entry\n");
goto error;
}
}
Expand All @@ -1286,7 +1291,8 @@ static int occ_create_hwmon_attribute(struct device *dev)
ret = sysfs_create_group(&drv_data->hwmon_dev->kobj,
&occ_caps_attr_group[i]);
if (ret) {
dev_err(dev, "error create caps sysfs entry\n");
dev_dbg(dev,
"ERROR: cannot create sysfs entry\n");
goto error;
}
}
Expand Down

0 comments on commit d741944

Please sign in to comment.