From: Basavaraj Natikar <bnatikar@amd.com>
To: Mario Limonciello <superm1@kernel.org>,
mario.limonciello@amd.com, basavaraj.natikar@amd.com,
jikos@kernel.org, bentiss@kernel.org
Cc: linux-input@vger.kernel.org
Subject: Re: [PATCH v2 2/2] HID: amd_sfh: Cleanup all sensors when init fails
Date: Mon, 7 Apr 2025 14:52:28 +0530 [thread overview]
Message-ID: <005cb38d-3f25-4312-86e5-77649e114f2f@amd.com> (raw)
In-Reply-To: <20250403150026.1657538-3-superm1@kernel.org>
On 4/3/2025 8:29 PM, Mario Limonciello wrote:
> From: Mario Limonciello <mario.limonciello@amd.com>
>
> If any sensors have been started when a failure occurs during client
> init they are left enabled by the firmware.
>
> As part of the cleanup routine check all sensors and if they're enabled
> stop them.
>
> Suggested-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> v2:
> * New patch
> ---
> drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> 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 c1bdf1e0d44af..c61cc42fa7a33 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
> @@ -235,12 +235,20 @@ static int amd_sfh1_1_hid_client_init(struct amd_mp2_dev *privdata)
> return 0;
>
> cleanup:
> - amd_sfh_hid_client_deinit(privdata);
> for (i = 0; i < cl_data->num_hid_devices; i++) {
> + if (cl_data->sensor_sts[i] == SENSOR_ENABLED) {
> + mp2_ops->stop(privdata, cl_data->sensor_idx[i]);
> + status = amd_sfh_wait_for_response
> + (privdata, cl_data->sensor_idx[i], DISABLE_SENSOR);
> + cl_data->sensor_sts[i] = (status == 0) ? SENSOR_ENABLED : SENSOR_DISABLED;
> + }
can we only add below condition as above case is already taken care in
amd_sfh_hid_client_deinit
Thanks,
--
Basavaraj
> + if (cl_data->sensor_idx[i] == SRA_IDX)
> + continue;
> devm_kfree(dev, cl_data->feature_report[i]);
> devm_kfree(dev, in_data->input_report[i]);
> devm_kfree(dev, cl_data->report_descr[i]);
> }
> + amd_sfh_hid_client_deinit(privdata);
> return rc;
> }
>
prev parent reply other threads:[~2025-04-07 9:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-03 14:59 [PATCH v2 0/2] Fixes for SRA sensor handling Mario Limonciello
2025-04-03 14:59 ` [PATCH v2 1/2] HID: amd_sfh: Fix SRA sensor when it's the only sensor Mario Limonciello
2025-04-03 14:59 ` [PATCH v2 2/2] HID: amd_sfh: Cleanup all sensors when init fails Mario Limonciello
2025-04-07 9:22 ` Basavaraj Natikar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=005cb38d-3f25-4312-86e5-77649e114f2f@amd.com \
--to=bnatikar@amd.com \
--cc=basavaraj.natikar@amd.com \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=superm1@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.