diff options
author | 2024-05-07 12:40:44 +0530 | |
---|---|---|
committer | 2024-05-07 15:18:47 +0200 | |
commit | 077e3e3bc84a51891e732507bbbd9acf6e0e4c8b (patch) | |
tree | f8226b93f896160d4c3c7187741159409d192dfc /drivers/hid/amd-sfh-hid | |
parent | HID: amd_sfh: Modify and log error only if case of functionality failures (diff) | |
download | linux-077e3e3bc84a51891e732507bbbd9acf6e0e4c8b.tar.gz linux-077e3e3bc84a51891e732507bbbd9acf6e0e4c8b.tar.bz2 linux-077e3e3bc84a51891e732507bbbd9acf6e0e4c8b.zip |
HID: amd_sfh: Handle "no sensors" in PM operations
Resume or suspend each sensor device based on the num_hid_devices.
Therefore, add a check to handle the special case where no sensors are
present.
Fixes: 93ce5e0231d7 ("HID: amd_sfh: Implement SFH1.1 functionality")
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Diffstat (limited to 'drivers/hid/amd-sfh-hid')
-rw-r--r-- | drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c index f46f9c670c6b..621793d92464 100644 --- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c +++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c @@ -227,6 +227,11 @@ static void amd_sfh_resume(struct amd_mp2_dev *mp2) struct amd_mp2_sensor_info info; int i, status; + if (!cl_data->is_any_sensor_enabled) { + amd_sfh_clear_intr(mp2); + return; + } + for (i = 0; i < cl_data->num_hid_devices; i++) { if (cl_data->sensor_sts[i] == SENSOR_DISABLED) { info.sensor_idx = cl_data->sensor_idx[i]; @@ -252,6 +257,11 @@ static void amd_sfh_suspend(struct amd_mp2_dev *mp2) struct amdtp_cl_data *cl_data = mp2->cl_data; int i, status; + if (!cl_data->is_any_sensor_enabled) { + amd_sfh_clear_intr(mp2); + return; + } + for (i = 0; i < cl_data->num_hid_devices; i++) { if (cl_data->sensor_idx[i] != HPD_IDX && cl_data->sensor_sts[i] == SENSOR_ENABLED) { |