From: "Jérôme Pouiller" <jerome.pouiller@silabs.com>
To: Kalle Valo <kvalo@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-kernel@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] wifi: wfx: Remove some dead code
Date: Wed, 15 Feb 2023 14:23:56 +0100 [thread overview]
Message-ID: <5176724.BZd2XUeKfp@pc-42> (raw)
In-Reply-To: <809c4a645c8d1306c0d256345515865c40ec731c.1676464422.git.christophe.jaillet@wanadoo.fr>
Hello Christophe,
On Wednesday 15 February 2023 13:34:37 CET Christophe JAILLET wrote:
>
> wait_for_completion_timeout() can not return a <0 value.
> So simplify the logic and remove dead code.
>
> -ERESTARTSYS can not be returned by do_wait_for_common() for tasks with
> TASK_UNINTERRUPTIBLE, which is the case for wait_for_completion_timeout()
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/net/wireless/silabs/wfx/main.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/wireless/silabs/wfx/main.c b/drivers/net/wireless/silabs/wfx/main.c
> index 6b9864e478ac..0b50f7058bbb 100644
> --- a/drivers/net/wireless/silabs/wfx/main.c
> +++ b/drivers/net/wireless/silabs/wfx/main.c
> @@ -358,13 +358,9 @@ int wfx_probe(struct wfx_dev *wdev)
>
> wfx_bh_poll_irq(wdev);
> err = wait_for_completion_timeout(&wdev->firmware_ready, 1 * HZ);
> - if (err <= 0) {
> - if (err == 0) {
> - dev_err(wdev->dev, "timeout while waiting for startup indication\n");
> - err = -ETIMEDOUT;
> - } else if (err == -ERESTARTSYS) {
> - dev_info(wdev->dev, "probe interrupted by user\n");
This code is ran during modprobe/insmod. We would like to allow the user
to interrupt (Ctrl+C) the probing if something is going wrong with the
device.
So, the real issue is wait_for_completion_interruptible_timeout() should
be used instead of wait_for_completion_timeout().
(By reading this code again, it also seems the test "if (err <= 0)" is
useless)
--
Jérôme Pouiller
next prev parent reply other threads:[~2023-02-15 13:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-15 12:34 [PATCH] wifi: wfx: Remove some dead code Christophe JAILLET
2023-02-15 13:23 ` Jérôme Pouiller [this message]
2023-02-17 19:51 ` Christophe JAILLET
2023-02-21 17:02 ` Jérôme Pouiller
2023-02-22 12:29 ` Kalle Valo
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=5176724.BZd2XUeKfp@pc-42 \
--to=jerome.pouiller@silabs.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).