netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: David Miller <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, Jon Maloy <jon.maloy@ericsson.com>,
	Ying Xue <ying.xue@windriver.com>,
	Erik Hugne <erik.hugne@ericsson.com>,
	Paul Gortmaker <paul.gortmaker@windriver.com>
Subject: [PATCH net-next 11/12] tipc: save sock structure pointer instead of void pointer to tipc_port
Date: Thu, 30 May 2013 15:36:16 -0400	[thread overview]
Message-ID: <1369942577-39563-12-git-send-email-paul.gortmaker@windriver.com> (raw)
In-Reply-To: <1369942577-39563-1-git-send-email-paul.gortmaker@windriver.com>

From: Ying Xue <ying.xue@windriver.com>

Directly save sock structure pointer instead of void pointer to avoid
unnecessary cast conversions.

Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 net/tipc/port.c   | 4 ++--
 net/tipc/port.h   | 6 +++---
 net/tipc/socket.c | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/tipc/port.c b/net/tipc/port.c
index 84b2a57..0bb185a 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -206,7 +206,7 @@ exit:
  *
  * Returns pointer to (locked) TIPC port, or NULL if unable to create it
  */
-struct tipc_port *tipc_createport(void *usr_handle,
+struct tipc_port *tipc_createport(struct sock *sk,
 			u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
 			void (*wakeup)(struct tipc_port *),
 			const u32 importance)
@@ -227,7 +227,7 @@ struct tipc_port *tipc_createport(void *usr_handle,
 		return NULL;
 	}
 
-	p_ptr->usr_handle = usr_handle;
+	p_ptr->sk = sk;
 	p_ptr->max_pkt = MAX_PKT_DEFAULT;
 	p_ptr->ref = ref;
 	INIT_LIST_HEAD(&p_ptr->wait_list);
diff --git a/net/tipc/port.h b/net/tipc/port.h
index 6579e47..ef0df6a 100644
--- a/net/tipc/port.h
+++ b/net/tipc/port.h
@@ -46,7 +46,7 @@
 
 /**
  * struct tipc_port - TIPC port structure
- * @usr_handle: pointer to additional user-defined information about port
+ * @sk: pointer to socket handle
  * @lock: pointer to spinlock for controlling access to port
  * @connected: non-zero if port is currently connected to a peer port
  * @conn_type: TIPC type used when connection was established
@@ -72,7 +72,7 @@
  * @subscription: "node down" subscription used to terminate failed connections
  */
 struct tipc_port {
-	void *usr_handle;
+	struct sock *sk;
 	spinlock_t *lock;
 	int connected;
 	u32 conn_type;
@@ -104,7 +104,7 @@ struct tipc_port_list;
 /*
  * TIPC port manipulation routines
  */
-struct tipc_port *tipc_createport(void *usr_handle,
+struct tipc_port *tipc_createport(struct sock *sk,
 		u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
 		void (*wakeup)(struct tipc_port *), const u32 importance);
 
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 258e98d..8c135c5 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1407,7 +1407,7 @@ static int backlog_rcv(struct sock *sk, struct sk_buff *buf)
  */
 static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
 {
-	struct sock *sk = (struct sock *)tport->usr_handle;
+	struct sock *sk = tport->sk;
 	u32 res;
 
 	/*
@@ -1438,7 +1438,7 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
  */
 static void wakeupdispatch(struct tipc_port *tport)
 {
-	struct sock *sk = (struct sock *)tport->usr_handle;
+	struct sock *sk = tport->sk;
 
 	sk->sk_write_space(sk);
 }
-- 
1.8.1.2

  parent reply	other threads:[~2013-05-30 19:36 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30 19:36 [PATCH net-next 00/12] tipc: make use of kernel threads to simplify things Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 01/12] tipc: change socket buffer overflow control to respect sk_rcvbuf Paul Gortmaker
2013-05-31 13:36   ` Neil Horman
2013-06-03  9:55     ` Ying Xue
2013-06-03 13:16       ` Neil Horman
2013-06-04  1:37         ` Ying Xue
2013-06-04 13:40           ` Neil Horman
2013-05-30 19:36 ` [PATCH net-next 02/12] tipc: Add "max_ports" configuration parameter Paul Gortmaker
2013-05-30 22:49   ` David Miller
2013-05-31  8:25     ` Erik Hugne
2013-05-31  8:29       ` David Miller
2013-05-31  8:34         ` Erik Hugne
2013-05-31  8:40           ` David Miller
2013-05-31  9:23             ` Erik Hugne
2013-05-31  9:25               ` David Laight
2013-05-31  9:26               ` David Miller
2013-05-31  9:06       ` David Laight
2013-05-31 17:48     ` Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 03/12] tipc: allow implicit connect for stream sockets Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 04/12] tipc: introduce new TIPC server infrastructure Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 05/12] tipc: convert topology server to use new server facility Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 06/12] tipc: convert configuration " Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 07/12] tipc: delete code orphaned by new server infrastructure Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 08/12] tipc: remove user_port instance from tipc_port structure Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 09/12] tipc: rename tipc_createport_raw to tipc_createport Paul Gortmaker
2013-05-30 19:36 ` [PATCH net-next 10/12] tipc: convert config_lock from spinlock to mutex Paul Gortmaker
2013-05-30 19:36 ` Paul Gortmaker [this message]
2013-05-30 19:36 ` [PATCH net-next 12/12] tipc: cosmetic realignment of function arguments Paul Gortmaker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1369942577-39563-12-git-send-email-paul.gortmaker@windriver.com \
    --to=paul.gortmaker@windriver.com \
    --cc=davem@davemloft.net \
    --cc=erik.hugne@ericsson.com \
    --cc=jon.maloy@ericsson.com \
    --cc=netdev@vger.kernel.org \
    --cc=ying.xue@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).