Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp838324lqj; Mon, 3 Jun 2024 02:17:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXytjJawdrwid2OoAtRMmnlLPBi1KosK8bqBzAk9ewWybbsDaMp3zyNpsvh9EG9/+M0/8jD85ner2kXmhe5uXLD9Pyt1IDYIzOrhEuqJw== X-Google-Smtp-Source: AGHT+IG9TFWHMQ/edmEVtKCw3/EpdANHZsCML3A9MphWy29S7Dl12bWApCNeH2HFmwQATR1CaVmF X-Received: by 2002:a05:6a20:7495:b0:1af:fca1:b692 with SMTP id adf61e73a8af0-1b26f16e7e5mr11012653637.35.1717406219859; Mon, 03 Jun 2024 02:16:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717406219; cv=pass; d=google.com; s=arc-20160816; b=aKu9+17y5XJA5dwlSPbtRikwPHME79P8TkAT4GdEru+PEaLn8smitrcorzCwljb0Lv ObBWUijYLUZFU2Ub4zgDpy199/i/RTUSbLrcdZZHvTlCym2yFZoSMjb23PHnIK6Utp+9 ERaSmFQJZwH8umXqtdr6TVLO2IAEflb8kK0CtqWc89Sh2qFExXAiSBWihPl1zot0xrx5 tyKxXdpZvsuuq1FHMCmBCEq3RFMBdaMyubpKn6ZabsFTASWSij8gdHN2FEdYzkSobLVR 1HUmLjKSlItbCo1jzLH+ZF93O0+6xEX1nDyGpXx845tvkwbl3/gdS2hz6S9Ob4L8RvLs rPiQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=LdfEPpYp2q55Lbd2/moAUzqffW0IB2tS5IgblPD0OA8=; fh=7I5tFk6X+THgOvbEeFxO7R8f+oMQg3I1xZAbLbWxjfI=; b=X8zuhbeOeQ0XWAyZpleLuVqPWTYG+bIu7Mqy5XZbD7G+lvXFo7SSRZcCk9evgs9j8Z CqbwA2XV+FeobAidJ6/olytdu2Kbnj/RVdrqZcU1A460dwzzWnyFxgXrfb1XY0ZSzmvN vnACnQznVBgvhgosp+idLrOZJIDMDMsk0shDcpIAamZtqpsN6eYF7FrVVVoh18fCAUMW mq9PMFEg6HCoWpDlWxXH5/WDJkcuTyP6SUMMNtxwO/X4c0rMmV2PG4LPh3yYxXh8jKPJ ATZTVFCArC6ycjwUtWqO1uXpULCLXucNr8c8/pFxT5onK93Gkief9nMcADDrh1jYTVdo yi2w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=NGzWmaCV; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-kernel+bounces-198850-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198850-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f63236ce3asi61756645ad.183.2024.06.03.02.16.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 02:16:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198850-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=@sang-engineering.com header.s=k1 header.b=NGzWmaCV; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-kernel+bounces-198850-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198850-linux.lists.archive=gmail.com@vger.kernel.org" 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 61D5428107D for ; Mon, 3 Jun 2024 09:16:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7A36A82D9E; Mon, 3 Jun 2024 09:15:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="NGzWmaCV" Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (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 D89B45026B for ; Mon, 3 Jun 2024 09:15:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717406153; cv=none; b=hmBchXdLQsOTja9yEgV8Ca06ALnb0UPHTVHkxVERTnWPBrXjzOST+9OONuY+ed+xbhcPsKvLAf0jByETYLJNqss2VbnWuw+ahWHEDUl7yvvsab7nLvnRsD2arPeWOd3gnAY3B15tGVsKEkvf7RNLaqIKNDXVIkHGAra0qHHjZGw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717406153; c=relaxed/simple; bh=PnSLEwaMRIhusLOj1H7+hLN1hV3Obq2sv6Ok+7+MTZ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C9tS8rrx3lKAyjO5MQXJ6lUYzIPSSADUYSvvvaMiYibbaQ6m0ug6z+DSRj8QHF1cWWLxRGZhqas1Qkmy05pu4/xTS+LjqWhIiQd7grRRuR5WhN/dECnymUbSdYkiYbzY/gFT99mk5aAncSR2Iog/QMwYRk0GBBl/2FhW/RgirAM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=NGzWmaCV; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=LdfEPpYp2q55Lbd2/moAUzqffW0IB2tS5IgblPD0OA8=; b=NGzWma CVcolg6ZPrhBUwk1hNWstW5WslGXGh9X4xJVd+aOGNFRTOtgzHi77MTYd1szZseA pjQ/5aoNkBnm7yMiViL5bZf/RwXmeNX1D4MH30dmXReeZOax9ewXf0zIw9jDDbQQ +byec288G7tXebFyoMNuk/9U7Z7zgB3SwHo93MrGQssLsAHWawlWYsSLKsbLtH/N +d7s/0PbfaJn1MNRoj+l3p9cH7ZnK8MXY2roydMSCoXhL2VOqwWWVY1iDhhc95hx qH8eeJqOdEHkl77DLg/m98mnPN8jWld5wcttt0yq6C5S12vrdHys15Nndax2Qbad Aq5lFb08sx2QJhQA== Received: (qmail 1899265 invoked from network); 3 Jun 2024 11:15:45 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 3 Jun 2024 11:15:45 +0200 X-UD-Smtp-Session: l3s3148p1@fPQ9x/gZ+oUgAwDPXzLGAH1eNELjOc3g From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: Wolfram Sang , Kalle Valo , Jeff Johnson , linux-wireless@vger.kernel.org, ath11k@lists.infradead.org Subject: [PATCH 1/6] wifi: ath11k: use 'time_left' variable with wait_event_timeout() Date: Mon, 3 Jun 2024 11:15:34 +0200 Message-ID: <20240603091541.8367-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240603091541.8367-1-wsa+renesas@sang-engineering.com> References: <20240603091541.8367-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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; } -- 2.43.0