aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSabrina Dubroca <sd@queasysnail.net>2014-09-17 17:23:12 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-19 17:22:31 -0400
commit54003f119c26573d3bb86a5efc64f3e5fd43b8c6 (patch)
treed527ec830c793164276b5642507ccbaf90a5aaf3
parentfb5690d2458340b645ea3b36e8db560cb3272e65 (diff)
net: fix sparse warnings in SNMP_UPD_PO_STATS(_BH)
ptr used to be a non __percpu pointer (result of a this_cpu_ptr assignment, 7d720c3e4f0c4 ("percpu: add __percpu sparse annotations to net")). Since d25398df59b56 ("net: avoid reloads in SNMP_UPD_PO_STATS"), that's no longer the case, SNMP_UPD_PO_STATS uses this_cpu_add and ptr is now __percpu. Silence sparse warnings by preserving the original type and annotation, and remove the out-of-date comment. warning: incorrect type in initializer (different address spaces) expected unsigned long long *ptr got unsigned long long [noderef] <asn:3>*<noident> warning: incorrect type in initializer (different address spaces) expected void const [noderef] <asn:3>*__vpp_verify got unsigned long long *<noident> warning: incorrect type in initializer (different address spaces) expected void const [noderef] <asn:3>*__vpp_verify got unsigned long long *<noident> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/snmp.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/include/net/snmp.h b/include/net/snmp.h
index f1f27fdbb0d5..8fd2f498782e 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -146,19 +146,15 @@ struct linux_xfrm_mib {
146 146
147#define SNMP_ADD_STATS(mib, field, addend) \ 147#define SNMP_ADD_STATS(mib, field, addend) \
148 this_cpu_add(mib->mibs[field], addend) 148 this_cpu_add(mib->mibs[field], addend)
149/*
150 * Use "__typeof__(*mib) *ptr" instead of "__typeof__(mib) ptr"
151 * to make @ptr a non-percpu pointer.
152 */
153#define SNMP_UPD_PO_STATS(mib, basefield, addend) \ 149#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
154 do { \ 150 do { \
155 __typeof__(*mib->mibs) *ptr = mib->mibs; \ 151 __typeof__((mib->mibs) + 0) ptr = mib->mibs; \
156 this_cpu_inc(ptr[basefield##PKTS]); \ 152 this_cpu_inc(ptr[basefield##PKTS]); \
157 this_cpu_add(ptr[basefield##OCTETS], addend); \ 153 this_cpu_add(ptr[basefield##OCTETS], addend); \
158 } while (0) 154 } while (0)
159#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ 155#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
160 do { \ 156 do { \
161 __typeof__(*mib->mibs) *ptr = mib->mibs; \ 157 __typeof__((mib->mibs) + 0) ptr = mib->mibs; \
162 __this_cpu_inc(ptr[basefield##PKTS]); \ 158 __this_cpu_inc(ptr[basefield##PKTS]); \
163 __this_cpu_add(ptr[basefield##OCTETS], addend); \ 159 __this_cpu_add(ptr[basefield##OCTETS], addend); \
164 } while (0) 160 } while (0)