mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Basavaraj Natikar <bnatikar@amd.com>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>,
	Basavaraj Natikar <basavaraj.natikar@amd.com>,
	Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <bentiss@kernel.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] HID: amd_sfh: return an error when response wait times out
Date: Mon, 3 Aug 2026 23:06:48 +0530	[thread overview]
Message-ID: <9c636802-a9ec-4f14-878b-0492576cdfc4@amd.com> (raw)
In-Reply-To: <20260624143558.39306-1-pengpeng@iscas.ac.cn>


On 6/24/2026 8:05 PM, Pengpeng Hou wrote:
> [You don't often get email from pengpeng@iscas.ac.cn. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> amdtp_wait_for_response() waits for request_done before completing a
> report request. wait_event_interruptible_timeout() returns 0 when the
> wait expires, but the current code treats only negative values as errors
> and returns success on timeout.
>
> Return -ETIMEDOUT when the response wait expires while preserving the
> existing success path when the response has already been observed.
>
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
>   drivers/hid/amd-sfh-hid/amd_sfh_hid.c | 15 ++++++++-------
>   1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_hid.c b/drivers/hid/amd-sfh-hid/amd_sfh_hid.c
> index b04f675d4..8f88f965f 100644
> --- a/drivers/hid/amd-sfh-hid/amd_sfh_hid.c
> +++ b/drivers/hid/amd-sfh-hid/amd_sfh_hid.c
> @@ -87,16 +87,17 @@ static int amdtp_wait_for_response(struct hid_device *hid)
>                          break;
>          }
>
> -       if (!cli_data->request_done[i])
> +       if (!cli_data->request_done[i]) {
>                  ret = wait_event_interruptible_timeout(hid_data->hid_wait,
>                                                         cli_data->request_done[i],
>                                                         msecs_to_jiffies(AMD_SFH_RESPONSE_TIMEOUT));
> -       if (ret == -ERESTARTSYS)
> -               return -ERESTARTSYS;
> -       else if (ret < 0)
> -               return -ETIMEDOUT;
> -       else
> -               return 0;
> +               if (ret == -ERESTARTSYS)
> +                       return -ERESTARTSYS;
> +               if (ret <= 0)
> +                       return -ETIMEDOUT;
> +       }
> +
> +       return 0;
>   }

Acked-by: Basavaraj Natikar<Basavaraj.Natikar@amd.com>

Thanks,
--
Basavaraj

>
>   void amdtp_hid_wakeup(struct hid_device *hid)
> --
> 2.50.1 (Apple Git-155)
>


  parent reply	other threads:[~2026-08-03 17:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24 14:35 Pengpeng Hou
2026-08-03 17:29 ` Jiri Kosina
2026-08-03 17:36 ` Basavaraj Natikar [this message]
2026-08-03 17:38 ` Jiri Kosina

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=9c636802-a9ec-4f14-878b-0492576cdfc4@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=linux-kernel@vger.kernel.org \
    --cc=pengpeng@iscas.ac.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®