2007-08-28 19:27:40

by cheng renquan

[permalink] [raw]
Subject: [PATCH] netlink: use container_of instead

this could make future redesign of struct netlink_sock easier.

Signed-off-by: Denis Cheng <[email protected]>
---
net/netlink/af_netlink.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 5681ce3..a78d962 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -88,7 +88,7 @@ struct netlink_sock {

static inline struct netlink_sock *nlk_sk(struct sock *sk)
{
- return (struct netlink_sock *)sk;
+ return container_of(sk, struct netlink_sock, sk);
}

struct nl_pid_hash {
--
1.5.3.rc5


2007-08-28 22:41:40

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] netlink: use container_of instead

From: Denis Cheng <[email protected]>
Date: Wed, 29 Aug 2007 03:12:04 +0800

> this could make future redesign of struct netlink_sock easier.
>
> Signed-off-by: Denis Cheng <[email protected]>

Seems reasonable, patch applied, thanks.