Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x25: preserve const qualifier in [a]x25_sk()

We can change [a]x25_sk() to propagate their argument const qualifier,
thanks to container_of_const().

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eric Dumazet and committed by
David S. Miller
c7154ca8 407db475

+2 -8
+1 -4
include/net/ax25.h
··· 260 260 struct ax25_cb *cb; 261 261 }; 262 262 263 - static inline struct ax25_sock *ax25_sk(const struct sock *sk) 264 - { 265 - return (struct ax25_sock *) sk; 266 - } 263 + #define ax25_sk(ptr) container_of_const(ptr, struct ax25_sock, sk) 267 264 268 265 static inline struct ax25_cb *sk_to_ax25(const struct sock *sk) 269 266 {
+1 -4
include/net/x25.h
··· 177 177 atomic_t refcnt; 178 178 }; 179 179 180 - static inline struct x25_sock *x25_sk(const struct sock *sk) 181 - { 182 - return (struct x25_sock *)sk; 183 - } 180 + #define x25_sk(ptr) container_of_const(ptr, struct x25_sock, sk) 184 181 185 182 /* af_x25.c */ 186 183 extern int sysctl_x25_restart_request_timeout;