Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp838199lqj; Mon, 3 Jun 2024 02:16:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX1m8u6bglmzFLCU34I0WixzSnKUN0QTx+UfO5sITI/uQl1c49Kq1ZYTLOBPLJkp06ZDRuYPe9lZzomFz+hl80/jj9l9MnJDfegLMT/JQ== X-Google-Smtp-Source: AGHT+IEHVaxeqwHeyZG01DHc9W5/i64hvtV3B7/TCxSFlXYrjztlUhLvcVtEzraB2ocCs7woNswg X-Received: by 2002:a05:6870:1702:b0:24f:e3a3:4431 with SMTP id 586e51a60fabf-2508b9efb87mr8087772fac.13.1717406195232; Mon, 03 Jun 2024 02:16:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717406195; cv=pass; d=google.com; s=arc-20160816; b=ysxf1Y5acLViZW8n+wiwxqPPUfI4d6/RaUtetQYfaMinLWF3qXpuHBOrGilszh6iCn paRlIjyNA5yaDEr3ok2vfSxW+P2dRMR7wGAg6kllbi+rH3IrunqGkt0lCgE6j+HTlEX7 ELmYbZ+lqjXRSRicXJ/7sOuDqYgTW5Cm1FQ9tIaA2o7X51AxWEwNATv4FuS4X7H5LPRL KGqmY/LZ0bWcSHhPeeiuoemI9Q/vCtymqZOcKkIbc+0/cfWbHxO7qDxeX18ESZ/8MCgi 9OmwYg33Dyk6zFaJ2EI5fKAuHKif2ft/H3lWTrMOLkVPQbssx0qBr9btAx/EcQGhX5R5 KeiQ== 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=9OJSdBKqUt1d4Vs+wHfk7HzuxjMx44r5nI8Q9nIvLBM=; fh=CNTZx9yHceg3Gi1fFyheu27VfWR4XwabY8HV3hykwBo=; b=Bl1uQLfDP4LdUo9YTuDtKp2ypvUpba/GQWeOh3o4yL1MNMP7YyCxQELyVwAcYbKyKG kq7ABRAqcfuTKVay4FL+GJ81Fco3KjH0zfsPf5jipkuyD2IonhslZsR9dGGIHkwWraw+ AYJBN191Sbb021Ca0rqsTYEELEBhLvTgMiVQggBZ569Fh8p567Q01eJWMuQGv3saqe/g OWTPLHXmOK2Am0SeboMRYCHugFyoK+mFBe3sfgibwwSJujbAXIIbAO/zmQKHEzdvK3Yd S3ZoKUzlFPCfrC8AdDiPDeu6FWYns/YAOsYXPcLXQ250eoL6TY+3FKqmHoNuxcz+eJBU wa5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=EvD5HKBD; 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-198849-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198849-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 d2e1a72fcca58-7026e1248a8si1501976b3a.219.2024.06.03.02.16.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 02:16:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198849-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=EvD5HKBD; 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-198849-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198849-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 A538628260A for ; Mon, 3 Jun 2024 09:16:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 410E1824B7; Mon, 3 Jun 2024 09:15:53 +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="EvD5HKBD" 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 8545A3D549 for ; Mon, 3 Jun 2024 09:15:50 +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=1717406152; cv=none; b=IkfJhmYCuIUDwlbu+SqbCMlyzCsq/F80jwX3mFcGvlmICGM3xcusM7ssf3te37WXS3+Py9sfp6od9Xm+1enuYgHqfPJ6ojms+bxYU2fXezSuAHhfW2hJMI5jJbj1370MntFmlSILdWcql3rBAc08QgCLuHyUr5sQJRHT1BrxrzE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717406152; c=relaxed/simple; bh=HhBt6/7iPORMx5Kl1Z9ooKI2OQsHyjjVeOMZLg9WLBM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e+RPbedpQpSU/uCoYLUcTOjAroVV9uDu3+HbA2XSS4eH1L+twQsubOyQvsJo7bkvDIZO1HstIKPG6MctfJiB+bmnfb30plLLHbMCrW8SoJ2kYnh+8wT/Ox9YL6yHrcovvz98/ehq9g3qhW7O21VuEhiRv48I9x9iAhHHY9lGpn8= 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=EvD5HKBD; 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=9OJSdBKqUt1d4Vs+wHfk7HzuxjMx44r5nI8Q9nIvLBM=; b=EvD5HK BDgvJx56of1aDyIKNpwjw6wHq9xxahazmkblmjiw/RXovc5RWigo85Cxs68OYQ63 yK88U4RKeeMnliv5NAjtC3ljHYNh3Dnmk74bpipBrElhtnI3qxLhP+F7TTWG6HnV 2mjbm1sjwCuHbcXg2lO+Krkb60giVZ4vIF8eh9jbuecAeLTq4rNxwoRvoJcLwkQp YT7JTjLugYjBumkonA/TdeVYD572H2cRmAzuczTJ6MpWLfz0WFCqrSbYbr200i4K 2yzTvDSUD1pU/jhm84uewpv58Ghx4rzmsSsFafTfjwjziymdZ+GWkUwN8RjHHSu0 uV/MhEpw2/qsB13g== Received: (qmail 1899365 invoked from network); 3 Jun 2024 11:15:48 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 3 Jun 2024 11:15:48 +0200 X-UD-Smtp-Session: l3s3148p1@A4Rmx/gZHIYgAwDPXzLGAH1eNELjOc3g From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: Wolfram Sang , Christian Lamparter , Kalle Valo , linux-wireless@vger.kernel.org Subject: [PATCH 4/6] wifi: p54: use 'time_left' variable with wait_for_completion_interruptible_timeout() Date: Mon, 3 Jun 2024 11:15:37 +0200 Message-ID: <20240603091541.8367-5-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_interruptible_timeout() causing patterns like: timeout = wait_for_completion_interruptible_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/intersil/p54/fwio.c | 6 +++--- drivers/net/wireless/intersil/p54/p54pci.c | 8 ++++---- drivers/net/wireless/intersil/p54/p54spi.c | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/intersil/p54/fwio.c b/drivers/net/wireless/intersil/p54/fwio.c index c4fe70e05b9b..772084a9bd8d 100644 --- a/drivers/net/wireless/intersil/p54/fwio.c +++ b/drivers/net/wireless/intersil/p54/fwio.c @@ -216,7 +216,7 @@ int p54_download_eeprom(struct p54_common *priv, void *buf, struct sk_buff *skb; size_t eeprom_hdr_size; int ret = 0; - long timeout; + long time_left; if (priv->fw_var >= 0x509) eeprom_hdr_size = sizeof(*eeprom_hdr); @@ -245,9 +245,9 @@ int p54_download_eeprom(struct p54_common *priv, void *buf, p54_tx(priv, skb); - timeout = wait_for_completion_interruptible_timeout( + time_left = wait_for_completion_interruptible_timeout( &priv->eeprom_comp, HZ); - if (timeout <= 0) { + if (time_left <= 0) { wiphy_err(priv->hw->wiphy, "device does not respond or signal received!\n"); ret = -EBUSY; diff --git a/drivers/net/wireless/intersil/p54/p54pci.c b/drivers/net/wireless/intersil/p54/p54pci.c index e97ee547b9f3..6588f5477762 100644 --- a/drivers/net/wireless/intersil/p54/p54pci.c +++ b/drivers/net/wireless/intersil/p54/p54pci.c @@ -434,7 +434,7 @@ static int p54p_open(struct ieee80211_hw *dev) { struct p54p_priv *priv = dev->priv; int err; - long timeout; + long time_left; init_completion(&priv->boot_comp); err = request_irq(priv->pdev->irq, p54p_interrupt, @@ -472,12 +472,12 @@ static int p54p_open(struct ieee80211_hw *dev) P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_RESET)); P54P_READ(dev_int); - timeout = wait_for_completion_interruptible_timeout( + time_left = wait_for_completion_interruptible_timeout( &priv->boot_comp, HZ); - if (timeout <= 0) { + if (time_left <= 0) { wiphy_err(dev->wiphy, "Cannot boot firmware!\n"); p54p_stop(dev); - return timeout ? -ERESTARTSYS : -ETIMEDOUT; + return time_left ? -ERESTARTSYS : -ETIMEDOUT; } P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_UPDATE)); diff --git a/drivers/net/wireless/intersil/p54/p54spi.c b/drivers/net/wireless/intersil/p54/p54spi.c index 0073b5e0f9c9..d33a994906a7 100644 --- a/drivers/net/wireless/intersil/p54/p54spi.c +++ b/drivers/net/wireless/intersil/p54/p54spi.c @@ -518,7 +518,7 @@ static void p54spi_work(struct work_struct *work) static int p54spi_op_start(struct ieee80211_hw *dev) { struct p54s_priv *priv = dev->priv; - unsigned long timeout; + long time_left; int ret = 0; if (mutex_lock_interruptible(&priv->mutex)) { @@ -538,10 +538,10 @@ static int p54spi_op_start(struct ieee80211_hw *dev) mutex_unlock(&priv->mutex); - timeout = msecs_to_jiffies(2000); - timeout = wait_for_completion_interruptible_timeout(&priv->fw_comp, - timeout); - if (!timeout) { + time_left = msecs_to_jiffies(2000); + time_left = wait_for_completion_interruptible_timeout(&priv->fw_comp, + time_left); + if (!time_left) { dev_err(&priv->spi->dev, "firmware boot failed"); p54spi_power_off(priv); ret = -1; -- 2.43.0