1

HID: amd_sfh: Modify and log error only if case of functionality failures

Modify log messages, but only log errors when sensors are missing or a
true failure occurs to avoid misleading "failed" messages.

Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
This commit is contained in:
Basavaraj Natikar 2024-05-07 12:40:43 +05:30 committed by Jiri Kosina
parent 3e78a6c0d3
commit 6856f079cd
2 changed files with 5 additions and 7 deletions

View File

@ -333,14 +333,11 @@ static const struct dmi_system_id dmi_nodevs[] = {
static void sfh1_1_init_work(struct work_struct *work)
{
struct amd_mp2_dev *mp2 = container_of(work, struct amd_mp2_dev, work);
struct pci_dev *pdev = mp2->pdev;
int rc;
rc = mp2->sfh1_1_ops->init(mp2);
if (rc) {
dev_err(&pdev->dev, "sfh1_1_init failed err %d\n", rc);
if (rc)
return;
}
amd_sfh_clear_intr(mp2);
mp2->init_done = 1;

View File

@ -202,7 +202,7 @@ static int amd_sfh1_1_hid_client_init(struct amd_mp2_dev *privdata)
}
if (!cl_data->is_any_sensor_enabled) {
dev_warn(dev, "Failed to discover, sensors not enabled is %d\n",
dev_warn(dev, "No sensor registered, sensors not enabled is %d\n",
cl_data->is_any_sensor_enabled);
rc = -EOPNOTSUPP;
goto cleanup;
@ -320,7 +320,7 @@ int amd_sfh1_1_init(struct amd_mp2_dev *mp2)
memcpy_fromio(&binfo, mp2->vsbase, sizeof(struct sfh_base_info));
if (binfo.sbase.fw_info.fw_ver == 0 || binfo.sbase.s_list.sl.sensors == 0) {
dev_dbg(dev, "failed to get sensors\n");
dev_dbg(dev, "No sensor registered\n");
return -EOPNOTSUPP;
}
dev_dbg(dev, "firmware version 0x%x\n", binfo.sbase.fw_info.fw_ver);
@ -337,7 +337,8 @@ int amd_sfh1_1_init(struct amd_mp2_dev *mp2)
rc = amd_sfh1_1_hid_client_init(mp2);
if (rc) {
sfh_deinit_emp2();
dev_err(dev, "amd_sfh1_1_hid_client_init failed\n");
if ((rc != -ENODEV) && (rc != -EOPNOTSUPP))
dev_err(dev, "amd_sfh1_1_hid_client_init failed\n");
return rc;
}