netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tun: use tun_sk instead container_of
@ 2009-12-25 17:17 Vitaliy Gusev
  2009-12-27  4:26 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Vitaliy Gusev @ 2009-12-25 17:17 UTC (permalink / raw)
  To: David S. Miller; +Cc: Herbert Xu, netdev

Using macro tun_sk is more clear and shorter. However tun.c has tun_sk,
but doesn't use it. 

Signed-off-by: Vitaliy Gusev <vgusev@openvz.org>

---
 drivers/net/tun.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 01e99f2..2834a01 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -849,13 +849,13 @@ static void tun_sock_write_space(struct sock *sk)
 	if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
 		wake_up_interruptible_sync(sk->sk_sleep);
 
-	tun = container_of(sk, struct tun_sock, sk)->tun;
+	tun = tun_sk(sk)->tun;
 	kill_fasync(&tun->fasync, SIGIO, POLL_OUT);
 }
 
 static void tun_sock_destruct(struct sock *sk)
 {
-	free_netdev(container_of(sk, struct tun_sock, sk)->tun->dev);
+	free_netdev(tun_sk(sk)->tun->dev);
 }
 
 static struct proto tun_proto = {
@@ -990,7 +990,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
 		sk->sk_write_space = tun_sock_write_space;
 		sk->sk_sndbuf = INT_MAX;
 
-		container_of(sk, struct tun_sock, sk)->tun = tun;
+		tun_sk(sk)->tun = tun;
 
 		security_tun_dev_post_create(sk);
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tun: use tun_sk instead container_of
  2009-12-25 17:17 [PATCH] tun: use tun_sk instead container_of Vitaliy Gusev
@ 2009-12-27  4:26 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-12-27  4:26 UTC (permalink / raw)
  To: vgusev; +Cc: herbert, netdev

From: Vitaliy Gusev <vgusev@openvz.org>
Date: Fri, 25 Dec 2009 20:17:43 +0300

> Using macro tun_sk is more clear and shorter. However tun.c has tun_sk,
> but doesn't use it. 
> 
> Signed-off-by: Vitaliy Gusev <vgusev@openvz.org>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-27  4:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-25 17:17 [PATCH] tun: use tun_sk instead container_of Vitaliy Gusev
2009-12-27  4:26 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).