]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
HID: amd_sfh: Modify and log error only if case of functionality failures
authorBasavaraj Natikar <Basavaraj.Natikar@amd.com>
Tue, 7 May 2024 07:10:43 +0000 (12:40 +0530)
committerJiri Kosina <jkosina@suse.com>
Tue, 7 May 2024 13:18:47 +0000 (15:18 +0200)
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>
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c

index 9e97c26c4482e12838fb25ddaa6a5de1e19dcd8b..0c28ca349bcd37888529490c8000fb5bfea6e617 100644 (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;
index 5b24d5f63701a62e49ed7191a70fca288c252cc2..f46f9c670c6bc0b49a5f751a6ead1994db075343 100644 (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;
        }