Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp838002lqj; Mon, 3 Jun 2024 02:16:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWO2REvZn09q+XJKI6o9g4joJJnzD7JXMdpZcjfxyeqYgzMdTrvZEqhwvp1ywBS3J04BEm9QVoBDjio9jxvtdkW23uOTDppcqra2Xnwcg== X-Google-Smtp-Source: AGHT+IGhS/qbGu1eBYWVf7kIlqWWdJGyYHHP5zpv0xoqP+G5pzQ0MXlikDn4j9eYV/NK1y4zliuC X-Received: by 2002:a05:6358:470b:b0:199:37ee:6535 with SMTP id e5c5f4694b2df-19b492d666dmr1137556355d.32.1717406166364; Mon, 03 Jun 2024 02:16:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717406166; cv=pass; d=google.com; s=arc-20160816; b=heCsGm9YO1RH6EUHSF5k0WauhA+9QrJbnhjZpGmCtmteJJmpYLEzoODqpCshKUhPtX zswKlOTJnjbydwXswnqqp/zVQQh+PebWgmKN5hmjOyx3Jhov3MhgFVksHvwJQ5qSw3+W x37BNUSRfYHhCyC6XOuGVUyfCY8rHZYFldW5IQtU69xy7GLMRaRz8L2rxv6v+jbYrfAE WPf3r3wYga0w0og+TAle+nv13RmN/BoCkcPMYp2NbGH1xET8NDFfMDN6SnW/HJdDxcfi siR6EVaohdJJP1qpUltBbu0v8VTQQhKn0LcgKGHaNAnPJq0V2lzfxxY3kCyW/Zi81Szz +Bvg== 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=CdJ6gRXs+1B22Jl+/VUs3m4FLJ6sLe4o/fPCvArtSI0=; fh=33fmKjBkLbR7Be6evUTkgv76+cG2/jYmTUTec/JS0RY=; b=kdDWJOG+xVZelYIgh9RIwSj/+G3Nx0vxNqKlSAVJZYMZuEtehNeSGC+cPtpvajQqOX tl4r7DvmtuQNPAPWqt0Uf+CYqM8PiWBfnuCnR6HGO0xQYJrABX5o/pJgMIWaayJQsYa8 msQJ89JcuglhkIsWpyJfRp7fuXjhZbf0a4VmUjrZ4wx13IWwEwHJjtHcblU4JA6YDwoI jH+dY8mgHA9Kbo4OoLo+eiiW8NUplzoY7CJ7EgnrPertt03pcgdQdfshECcN9G8naQFH d/bdfUYws729a2d4v5sP+ZPWenqD4p1zOE213QKsUtTlvYUpmz1Zxxw7+H4ebOp9Vk/M AiXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=H5gTBkN3; 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-198846-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198846-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35b223023si4979223a12.448.2024.06.03.02.16.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 02:16:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198846-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=H5gTBkN3; 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-198846-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198846-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 B51CB282008 for ; Mon, 3 Jun 2024 09:16:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5053180632; Mon, 3 Jun 2024 09:15:52 +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="H5gTBkN3" 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 69F9F7E110 for ; Mon, 3 Jun 2024 09:15:49 +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=1717406151; cv=none; b=Z8Zg87cfiD7ksrXgmzY3I7niDx5GlmlYrFqPoaV2cj/mpo4GffE5+G0AQFnYnWjQ0SVjGiyAdhogSnXfBU9dZvPA6oGzHL3YnpSymigIWeM7dhsL0m+VO3/7HGY63ov8v5+O550hzfpkEBOiYksuEvQBdBRl5AvANhe/afDA2w0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717406151; c=relaxed/simple; bh=zqhSOx9TEsK+ntdJ3WpSkCqHwe22qFXbYtLRZFiNxlc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HXShnthrQEVe6ZWqtddreFnAjwpop3fz4Ojg0tto1WFk0sg13AR7AXv1pgD3VsqQYb8z5DQwxzkqbHcRZE5MCJNmEhiZJaS8Y6yGh7KT9MIOvaL66gb68+pN5Xf+Jv3lxt9Fp2/DxZJ6YWka5WnHYulrZPHPn6xezwULb3bfKME= 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=H5gTBkN3; 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=CdJ6gRXs+1B22Jl+/VUs3m4FLJ6sLe4o/fPCvArtSI0=; b=H5gTBk N3AuM5oQ1fxOx4oqj1HgM/wZEvUkmqF+OTSqLBsMFDZkX7vd+ZOCL5sGkSsmfyML G1NZWTNQxa8GfY8sBgh/xma7jryPqVu0dO80B168RvqgYpnJX8YJLqo3jTtsMH0Y L14SxeIuzB5nzwg5h+fJ3WFJuBSmXn7RuWxBaJHlR1TAA7GTFZ+kCoXLuHq/3CtK SzRhqLWIriJkXy0ZhVoS3B0Bv4NWQt4pCYqrKF5kQu/oYvWM5v6JciND1GiFqQ68 UcgC8B1dmTgEg3th0sjs+h18MisPp5PQLt4piO/d/JvlVK1lx0cBtAZQda9QfkPt lp9jEGT4IKtbOLYQ== Received: (qmail 1899341 invoked from network); 3 Jun 2024 11:15:47 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 3 Jun 2024 11:15:47 +0200 X-UD-Smtp-Session: l3s3148p1@861Xx/gZEoYgAwDPXzLGAH1eNELjOc3g From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: Wolfram Sang , Kalle Valo , linux-wireless@vger.kernel.org Subject: [PATCH 3/6] wifi: mac80211: use 'time_left' variable with wait_for_completion_timeout() Date: Mon, 3 Jun 2024 11:15:36 +0200 Message-ID: <20240603091541.8367-4-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_for_completion_timeout() causing patterns like: timeout = wait_for_completion_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the code self explaining. Signed-off-by: Wolfram Sang --- drivers/net/wireless/marvell/mwl8k.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/marvell/mwl8k.c b/drivers/net/wireless/marvell/mwl8k.c index d3d07bb26335..241a02a0accd 100644 --- a/drivers/net/wireless/marvell/mwl8k.c +++ b/drivers/net/wireless/marvell/mwl8k.c @@ -2211,7 +2211,7 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt_hdr *cmd dma_addr_t dma_addr; unsigned int dma_size; int rc; - unsigned long timeout = 0; + unsigned long time_left = 0; u8 buf[32]; u32 bitmap = 0; @@ -2258,8 +2258,8 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt_hdr *cmd iowrite32(MWL8K_H2A_INT_DUMMY, regs + MWL8K_HIU_H2A_INTERRUPT_EVENTS); - timeout = wait_for_completion_timeout(&cmd_wait, - msecs_to_jiffies(MWL8K_CMD_TIMEOUT_MS)); + time_left = wait_for_completion_timeout(&cmd_wait, + msecs_to_jiffies(MWL8K_CMD_TIMEOUT_MS)); priv->hostcmd_wait = NULL; @@ -2267,7 +2267,7 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt_hdr *cmd dma_unmap_single(&priv->pdev->dev, dma_addr, dma_size, DMA_BIDIRECTIONAL); - if (!timeout) { + if (!time_left) { wiphy_err(hw->wiphy, "Command %s timeout after %u ms\n", mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), MWL8K_CMD_TIMEOUT_MS); @@ -2275,7 +2275,7 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt_hdr *cmd } else { int ms; - ms = MWL8K_CMD_TIMEOUT_MS - jiffies_to_msecs(timeout); + ms = MWL8K_CMD_TIMEOUT_MS - jiffies_to_msecs(time_left); rc = cmd->result ? -EINVAL : 0; if (rc) -- 2.43.0