Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AFD8C05027 for ; Fri, 17 Feb 2023 19:51:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229584AbjBQTvb (ORCPT ); Fri, 17 Feb 2023 14:51:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjBQTva (ORCPT ); Fri, 17 Feb 2023 14:51:30 -0500 Received: from smtp.smtpout.orange.fr (smtp-14.smtpout.orange.fr [80.12.242.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A17F54FCA2 for ; Fri, 17 Feb 2023 11:51:28 -0800 (PST) Received: from [192.168.1.18] ([86.243.2.178]) by smtp.orange.fr with ESMTPA id T6lQpg4mYbhnbT6lQpVFTX; Fri, 17 Feb 2023 20:51:26 +0100 X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 17 Feb 2023 20:51:26 +0100 X-ME-IP: 86.243.2.178 Message-ID: Date: Fri, 17 Feb 2023 20:51:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH] wifi: wfx: Remove some dead code Content-Language: fr, en-US To: =?UTF-8?B?SsOpcsO0bWUgUG91aWxsZXI=?= , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org References: <809c4a645c8d1306c0d256345515865c40ec731c.1676464422.git.christophe.jaillet@wanadoo.fr> <5176724.BZd2XUeKfp@pc-42> From: Christophe JAILLET In-Reply-To: <5176724.BZd2XUeKfp@pc-42> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Le 15/02/2023 à 14:23, Jérôme Pouiller a écrit : > 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 >> --- >> 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(). Hmmm, not that clear. See commit 01088cd143a9. Let me know if you prefer this patch as-is or if 01088cd143a9 should be reverted. CJ > > (By reading this code again, it also seems the test "if (err <= 0)" is > useless) > >