lkml.org 
[lkml]   [2023]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] wifi: wfx: Remove some dead code
From
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 <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().

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)
>
>

\
 
 \ /
  Last update: 2023-03-27 00:27    [W:0.063 / U:0.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site