brcmfmac: use atomic_t for statistic counter in struct brcmf_bus
authorArend Van Spriel <arend.vanspriel@broadcom.com>
Thu, 22 Jun 2017 10:01:02 +0000 (11:01 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 28 Jun 2017 17:53:05 +0000 (20:53 +0300)
The statistic counter is used in common layer and in the bus layer
in different thread contexts so change to use atomic operations.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c

index e2c895bc1e68161ceb93f36d2f122d64e5bf29e0..e1a4d9e0eb10d45920ebbc355a02c54b2d28017b 100644 (file)
@@ -138,7 +138,7 @@ struct brcmf_bus {
        struct brcmf_pub *drvr;
        enum brcmf_bus_state state;
        uint maxctl;
-       unsigned long tx_realloc;
+       atomic_t tx_realloc;
        u32 chip;
        u32 chiprev;
        bool always_use_fws_queue;
index fd7b5addc54f7f2f8835cde721045925f173454e..eb67d7d5be9d87718c9842f804cb64c47d651ed3 100644 (file)
@@ -2046,7 +2046,7 @@ static int brcmf_sdio_txpkt_hdalign(struct brcmf_sdio *bus, struct sk_buff *pkt)
        head_pad = ((unsigned long)dat_buf % bus->head_align);
        if (head_pad) {
                if (skb_headroom(pkt) < head_pad) {
-                       bus->sdiodev->bus_if->tx_realloc++;
+                       atomic_inc(&bus->sdiodev->bus_if->tx_realloc);
                        head_pad = 0;
                        if (skb_cow(pkt, head_pad))
                                return -ENOMEM;