From: Eric Dumazet Date: Fri, 17 Mar 2023 15:55:37 +0000 (+0000) Subject: x25: preserve const qualifier in [a]x25_sk() X-Git-Tag: v6.4-rc1~132^2~263^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c7154ca8e075cc456fe773879263b33ae307a59e;p=thirdparty%2Flinux.git 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 Reviewed-by: Simon Horman Signed-off-by: David S. Miller --- diff --git a/include/net/ax25.h b/include/net/ax25.h index f8cf3629a4193..0d939e5aee4ec 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h @@ -260,10 +260,7 @@ struct ax25_sock { struct ax25_cb *cb; }; -static inline struct ax25_sock *ax25_sk(const struct sock *sk) -{ - return (struct ax25_sock *) sk; -} +#define ax25_sk(ptr) container_of_const(ptr, struct ax25_sock, sk) static inline struct ax25_cb *sk_to_ax25(const struct sock *sk) { diff --git a/include/net/x25.h b/include/net/x25.h index d7d6c2b4ffa71..597eb53c471e3 100644 --- a/include/net/x25.h +++ b/include/net/x25.h @@ -177,10 +177,7 @@ struct x25_forward { atomic_t refcnt; }; -static inline struct x25_sock *x25_sk(const struct sock *sk) -{ - return (struct x25_sock *)sk; -} +#define x25_sk(ptr) container_of_const(ptr, struct x25_sock, sk) /* af_x25.c */ extern int sysctl_x25_restart_request_timeout;