Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1261795lqj; Mon, 3 Jun 2024 15:59:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX3rphJbJiok+IRg5NnmQwLtJtEkTsOfENNuGzNQkEXPSN65NWyAPEOxHFQMUdyy6FKMPTpse3Oh7QI6pNmugxHPo7grlN2/Pi1cTvH8w== X-Google-Smtp-Source: AGHT+IGsYGnIHr6Pj4kXGQuGaH9ENHCkfL3Eqlq8+Uq7zdK1Ir6xQU45m5qnOngxja7TjFrH0CCJ X-Received: by 2002:a05:6a00:847:b0:6f0:c79f:cd7e with SMTP id d2e1a72fcca58-70247663dbfmr13772861b3a.0.1717455559445; Mon, 03 Jun 2024 15:59:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717455559; cv=pass; d=google.com; s=arc-20160816; b=SHKGOK15/jYw2qMnyC5RE0fFJ1Q+r+c4lV2YLpZgU0+iAejd1lnhU/sil8yh21BsIJ +IP3mh/xfjNyOFhshJ8kgxohlV1ZGBwf50CecN5u0eYsyn6tY1c5Ic9u0beCsBoNTGYC Tz2pEKcotbnx+BfEbtlgcE5Jf8yGsOI4PtzpyWWPGD9U3oxXEOSI6JwMmQTqVR7iOwlt Oe9MBT/FYDCyaVVtdi0aZUtlm/irR0goAIu0w7GH/ktWZCc9aGVl2aekdSzhSD2BjDBY jTXY39vXs0FkTl2c13Xor8Uf7seus0cLJ0ekaqGIEhLgYlOnPELJDijzYw2cqEwy0Cnm 9kow== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Y4QY+F1FJbsM/wDJgEBzeFcAgoh0auxhIr9S0zEFsxk=; fh=2+dKQso+A3NxDYwPSU1+6kv58bzoBM7jlj+Hw2LiOTo=; b=u0ZF4GIkKbknDV1IcN/aNtDbbBCR/hA/kOLHHdSvjS27ovIdPF8+/2JsPdM9ApMFED 9f0QZI6nyGngZKKZec9NnqM1p7BLtuvCqKIB0/yaFD/sPK8qY0PeTh+zaJeiYm6rWK6I onVqS+vQgHflnWsS+C7FNaiaLwTfHfZLt6GTwO9VLiaHwKS5zrtYtnfVaakeFbE1gAq0 XevLazMSzaYCLoVGUfL1ZcieMrTLuIBDgdVxAamRupVNISTUzW9x9sOHIhnz6wCXhUcA 51ea98SEwqWHRazhdHLmZKOlXr633MZtjC7W1VbFRoNqFTC/D3KYRNiw9TXaY7+2A8nI pCvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=YYZMFLwx; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-8448-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8448-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2e1a72fcca58-702735d40f1si2037179b3a.156.2024.06.03.15.59.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 15:59:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8448-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=YYZMFLwx; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-8448-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8448-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0F5E2285FFA for ; Mon, 3 Jun 2024 22:57:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77CA913CABC; Mon, 3 Jun 2024 22:57:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="YYZMFLwx" X-Original-To: linux-wireless@vger.kernel.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1349F9E9; Mon, 3 Jun 2024 22:57:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717455468; cv=none; b=euIazc6mpU3veJiGyeRoCiXrO+dmVBr6sH8H8zEHapNooyFNfSDKrfCKlJp9GAuj1iVnzbqFfSePkZ9qcAebICgVkHMQhaXg3brJ6ZQRlseyy/e7MVWBkol6Var75N5o9tVTktbjfp35U9cicJ0TSbHzvBI4/PrHwO2Fh8Dsrbw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717455468; c=relaxed/simple; bh=KqPryLWc7zoc2VYG8QXuXcI0TeNlclWzwv+GWOys33s=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=bZrFOKckARhNwmaanuTcC8PsuhR7TfvCflBC8xQtOErmmteguTTJ9pgGlSXjrO/2dwwqt9t2/HPdjWm1izTIdTdbLJmQOU4biHswpsPasMPRvLh6aO9kiDpy09FEqt/8iL1z0lJV/+85jXnlkrVooGTft9S+TjajVRASBFinXuU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=YYZMFLwx; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 453Bl8qM017816; Mon, 3 Jun 2024 22:57:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Y4QY+F1FJbsM/wDJgEBzeFcAgoh0auxhIr9S0zEFsxk=; b=YYZMFLwxjWhT35F6 YBOKzW3GwNCoPchaIgQN2YgatIGOBj7Y3CFIM/b53d0mzsEQz9Mpw7jdAoAJ1I/F IYilULFa9UP9NWGIPE3i3YVt/WYMvx2vjWPyysVvOTkIRB/PmgEQ7SKDypuJ7Cp5 Zr5dYxXrL3Xo258U2toVn/U8G7MJhlahlEFj9U8UjCVxZ3yf/fplopQPqjLj0lqb 0uPCYgzj2aD1o95bn3d7B2fdqWj5wtXr5eMbixFMlCJhQMUzLVngvX+snstvWrho MZfUgCUEw95C97gqLJJpI0uNPABKiKrFFSwefio/9Q62DJj/5dJxsto907NGBgav dCZ1Eg== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yfw3r5e1q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 Jun 2024 22:57:36 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 453MvZjH001996 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 3 Jun 2024 22:57:35 GMT Received: from [10.48.241.139] (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 3 Jun 2024 15:57:28 -0700 Message-ID: <47cc9455-6efb-4b1c-8743-c992e502633d@quicinc.com> Date: Mon, 3 Jun 2024 15:57:28 -0700 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/6] wifi: ath11k: use 'time_left' variable with wait_event_timeout() Content-Language: en-US To: Wolfram Sang , CC: Kalle Valo , Jeff Johnson , , References: <20240603091541.8367-1-wsa+renesas@sang-engineering.com> <20240603091541.8367-2-wsa+renesas@sang-engineering.com> From: Jeff Johnson In-Reply-To: <20240603091541.8367-2-wsa+renesas@sang-engineering.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: gFeYGuRClnezr6hNISr4C3GIahKB3ZbI X-Proofpoint-GUID: gFeYGuRClnezr6hNISr4C3GIahKB3ZbI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-06-03_17,2024-05-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 spamscore=0 mlxscore=0 clxscore=1011 priorityscore=1501 malwarescore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406030186 On 6/3/2024 2:15 AM, Wolfram Sang wrote: > There is a confusing pattern in the kernel to use a variable named 'timeout' to > store the result of wait_event_timeout() causing patterns like: > > timeout = wait_event_timeout(...) > if (!timeout) return -ETIMEDOUT; > > with all kinds of permutations. Use 'time_left' as a variable to make the code > self explaining. > > Fix to the proper variable type 'long' while here. > > Signed-off-by: Wolfram Sang > --- > drivers/net/wireless/ath/ath11k/qmi.c | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c > index d4a243b64f6c..2fe0ef660456 100644 > --- a/drivers/net/wireless/ath/ath11k/qmi.c > +++ b/drivers/net/wireless/ath/ath11k/qmi.c > @@ -2859,7 +2859,7 @@ int ath11k_qmi_firmware_start(struct ath11k_base *ab, > > int ath11k_qmi_fwreset_from_cold_boot(struct ath11k_base *ab) > { > - int timeout; > + long time_left; > > if (!ath11k_core_coldboot_cal_support(ab) || > ab->hw_params.cbcal_restart_fw == 0) > @@ -2867,11 +2867,11 @@ int ath11k_qmi_fwreset_from_cold_boot(struct ath11k_base *ab) > > ath11k_dbg(ab, ATH11K_DBG_QMI, "wait for cold boot done\n"); > > - timeout = wait_event_timeout(ab->qmi.cold_boot_waitq, > - (ab->qmi.cal_done == 1), > - ATH11K_COLD_BOOT_FW_RESET_DELAY); > + time_left = wait_event_timeout(ab->qmi.cold_boot_waitq, > + (ab->qmi.cal_done == 1), > + ATH11K_COLD_BOOT_FW_RESET_DELAY); > > - if (timeout <= 0) { > + if (time_left <= 0) { > ath11k_warn(ab, "Coldboot Calibration timed out\n"); > return -ETIMEDOUT; > } > @@ -2886,7 +2886,7 @@ EXPORT_SYMBOL(ath11k_qmi_fwreset_from_cold_boot); > > static int ath11k_qmi_process_coldboot_calibration(struct ath11k_base *ab) > { > - int timeout; > + long time_left; > int ret; > > ret = ath11k_qmi_wlanfw_mode_send(ab, ATH11K_FIRMWARE_MODE_COLD_BOOT); > @@ -2897,10 +2897,10 @@ static int ath11k_qmi_process_coldboot_calibration(struct ath11k_base *ab) > > ath11k_dbg(ab, ATH11K_DBG_QMI, "Coldboot calibration wait started\n"); > > - timeout = wait_event_timeout(ab->qmi.cold_boot_waitq, > - (ab->qmi.cal_done == 1), > - ATH11K_COLD_BOOT_FW_RESET_DELAY); > - if (timeout <= 0) { > + time_left = wait_event_timeout(ab->qmi.cold_boot_waitq, > + (ab->qmi.cal_done == 1), > + ATH11K_COLD_BOOT_FW_RESET_DELAY); > + if (time_left <= 0) { > ath11k_warn(ab, "coldboot calibration timed out\n"); > return 0; > } This looks ok to me, but note that changes to ath11k go through the ath tree, so, unless Kalle has a different opinion, this should be submitted separately from changes that go through the wireless tree.