[PATCH] Fix warnings on calls to P54P_READ() for which the result is discarded - Kernel

This is a discussion on [PATCH] Fix warnings on calls to P54P_READ() for which the result is discarded - Kernel ; Fix warnings on calls to P54P_READ() for which the result is discarded because the side-effect of accessing hardware is what's of interest, not the result of performing the read. The warnings are of the form: drivers/net/wireless/p54/p54pci.c:55: warning: value computed is ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: [PATCH] Fix warnings on calls to P54P_READ() for which the result is discarded

  1. [PATCH] Fix warnings on calls to P54P_READ() for which the result is discarded

    Fix warnings on calls to P54P_READ() for which the result is discarded because
    the side-effect of accessing hardware is what's of interest, not the result of
    performing the read.

    The warnings are of the form:

    drivers/net/wireless/p54/p54pci.c:55: warning: value computed is not used

    Casting to (void) gets rid of this.

    They were introduced in patch eff1a59c48e3c6a006eb4fe5f2e405a996f2259d.

    Signed-off-by: David Howells
    ---

    drivers/net/wireless/p54/p54pci.c | 32 ++++++++++++++++----------------
    1 files changed, 16 insertions(+), 16 deletions(-)


    diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c
    index 7dd4add..47a3654 100644
    --- a/drivers/net/wireless/p54/p54pci.c
    +++ b/drivers/net/wireless/p54/p54pci.c
    @@ -52,14 +52,14 @@ static int p54p_upload_firmware(struct ieee80211_hw *dev)
    u32 remains, left, device_addr;

    P54P_WRITE(int_enable, cpu_to_le32(0));
    - P54P_READ(int_enable);
    + (void) P54P_READ(int_enable);
    udelay(10);

    reg = P54P_READ(ctrl_stat);
    reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RESET);
    reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RAMBOOT);
    P54P_WRITE(ctrl_stat, reg);
    - P54P_READ(ctrl_stat);
    + (void) P54P_READ(ctrl_stat);
    udelay(10);

    reg |= cpu_to_le32(ISL38XX_CTRL_STAT_RESET);
    @@ -89,7 +89,7 @@ static int p54p_upload_firmware(struct ieee80211_hw *dev)
    u32 i = 0;
    left = min((u32)0x1000, remains);
    P54P_WRITE(direct_mem_base, cpu_to_le32(device_addr));
    - P54P_READ(int_enable);
    + (void) P54P_READ(int_enable);

    device_addr += 0x1000;
    while (i < left) {
    @@ -98,7 +98,7 @@ static int p54p_upload_firmware(struct ieee80211_hw *dev)
    }

    remains -= left;
    - P54P_READ(int_enable);
    + (void) P54P_READ(int_enable);
    }

    release_firmware(fw_entry);
    @@ -108,7 +108,7 @@ static int p54p_upload_firmware(struct ieee80211_hw *dev)
    reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RESET);
    reg |= cpu_to_le32(ISL38XX_CTRL_STAT_RAMBOOT);
    P54P_WRITE(ctrl_stat, reg);
    - P54P_READ(ctrl_stat);
    + (void) P54P_READ(ctrl_stat);
    udelay(10);

    reg |= cpu_to_le32(ISL38XX_CTRL_STAT_RESET);
    @@ -167,11 +167,11 @@ static int p54p_read_eeprom(struct ieee80211_hw *dev)

    memset(ring_control, 0, sizeof(*ring_control));
    P54P_WRITE(ring_control_base, cpu_to_le32(priv->ring_control_dma));
    - P54P_READ(ring_control_base);
    + (void) P54P_READ(ring_control_base);
    udelay(10);

    P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_INIT));
    - P54P_READ(int_enable);
    + (void) P54P_READ(int_enable);
    udelay(10);

    P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_RESET));
    @@ -184,7 +184,7 @@ static int p54p_read_eeprom(struct ieee80211_hw *dev)
    }

    P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_UPDATE));
    - P54P_READ(int_enable);
    + (void) P54P_READ(int_enable);

    hdr = eeprom + 0x2010;
    p54_fill_eeprom_readback(hdr);
    @@ -230,7 +230,7 @@ static int p54p_read_eeprom(struct ieee80211_hw *dev)
    out:
    kfree(eeprom);
    P54P_WRITE(int_enable, cpu_to_le32(0));
    - P54P_READ(int_enable);
    + (void) P54P_READ(int_enable);
    udelay(10);
    free_irq(priv->pdev->irq, priv);
    P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_RESET));
    @@ -397,7 +397,7 @@ static void p54p_tx(struct ieee80211_hw *dev, struct p54_control_hdr *data,
    spin_unlock_irqrestore(&priv->lock, flags);

    P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE));
    - P54P_READ(dev_int);
    + (void) P54P_READ(dev_int);

    /* FIXME: unlikely to happen because the device usually runs out of
    memory before we fill the ring up, but we can make it impossible */
    @@ -426,17 +426,17 @@ static int p54p_open(struct ieee80211_hw *dev)
    p54p_upload_firmware(dev);

    P54P_WRITE(ring_control_base, cpu_to_le32(priv->ring_control_dma));
    - P54P_READ(ring_control_base);
    + (void) P54P_READ(ring_control_base);
    wmb();
    udelay(10);

    P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_INIT));
    - P54P_READ(int_enable);
    + (void) P54P_READ(int_enable);
    wmb();
    udelay(10);

    P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_RESET));
    - P54P_READ(dev_int);
    + (void) P54P_READ(dev_int);

    if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ)) {
    printk(KERN_ERR "%s: Cannot boot firmware!\n",
    @@ -446,12 +446,12 @@ static int p54p_open(struct ieee80211_hw *dev)
    }

    P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_UPDATE));
    - P54P_READ(int_enable);
    + (void) P54P_READ(int_enable);
    wmb();
    udelay(10);

    P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE));
    - P54P_READ(dev_int);
    + (void) P54P_READ(dev_int);
    wmb();
    udelay(10);

    @@ -466,7 +466,7 @@ static void p54p_stop(struct ieee80211_hw *dev)
    struct p54p_desc *desc;

    P54P_WRITE(int_enable, cpu_to_le32(0));
    - P54P_READ(int_enable);
    + (void) P54P_READ(int_enable);
    udelay(10);

    free_irq(priv->pdev->irq, dev);

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  2. Re: [PATCH] Fix warnings on calls to P54P_READ() for which the result is discarded

    On Fri, 11 Jul 2008 15:14:43 +0100 David Howells wrote:

    > Fix warnings on calls to P54P_READ() for which the result is discarded because
    > the side-effect of accessing hardware is what's of interest, not the result of
    > performing the read.
    >
    > The warnings are of the form:
    >
    > drivers/net/wireless/p54/p54pci.c:55: warning: value computed is not used


    hm, why aren't I seeing these?

    > Casting to (void) gets rid of this.


    This makes the ugly uglier. Would it fix the warnings if we were to do

    -#define P54P_READ(r) (__force __le32)__raw_readl(&priv->map->r)
    +static inline __le32 p54p_read(__le32 *addr)
    +{
    + return (__force __le32)__raw_readl(addr);
    +}

    ....
    - P54P_READ(dev_int);
    + P54P_READ(&priv->map->dev_int);

    or something along those lines?

    Because the cpp trickery in there really isn't very nice.
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

+ Reply to Thread