]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
wifi: p54: use 'time_left' variable with wait_for_completion_interruptible_timeout()
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Mon, 3 Jun 2024 09:15:37 +0000 (11:15 +0200)
committerKalle Valo <kvalo@kernel.org>
Wed, 12 Jun 2024 12:01:09 +0000 (15:01 +0300)
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 <wsa+renesas@sang-engineering.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240603091541.8367-5-wsa+renesas@sang-engineering.com
drivers/net/wireless/intersil/p54/fwio.c
drivers/net/wireless/intersil/p54/p54pci.c
drivers/net/wireless/intersil/p54/p54spi.c

index c4fe70e05b9b87771613d8569b216a1cf91ac550..772084a9bd8d7c360cba143e8dc07bae2811432b 100644 (file)
@@ -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;
index e97ee547b9f39b0d1c6ab02bb5063f45523853fd..6588f5477762767e965fca62e984ea2d780ae87e 100644 (file)
@@ -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));
index 0073b5e0f9c90ba473e71f1902724d8979bdc792..d33a994906a7bb182907052a5cb827119aeb95b0 100644 (file)
@@ -518,7 +518,7 @@ out:
 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;