Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0fee8ac authored by Ying Xue's avatar Ying Xue Committed by David S. Miller
Browse files

tipc: save sock structure pointer instead of void pointer to tipc_port



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

Signed-off-by: default avatarYing Xue <ying.xue@windriver.com>
Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 28e52972
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -206,7 +206,7 @@ void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp)
 *
 *
 * Returns pointer to (locked) TIPC port, or NULL if unable to create it
 * 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 *),
			u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
			void (*wakeup)(struct tipc_port *),
			void (*wakeup)(struct tipc_port *),
			const u32 importance)
			const u32 importance)
@@ -227,7 +227,7 @@ struct tipc_port *tipc_createport(void *usr_handle,
		return NULL;
		return NULL;
	}
	}


	p_ptr->usr_handle = usr_handle;
	p_ptr->sk = sk;
	p_ptr->max_pkt = MAX_PKT_DEFAULT;
	p_ptr->max_pkt = MAX_PKT_DEFAULT;
	p_ptr->ref = ref;
	p_ptr->ref = ref;
	INIT_LIST_HEAD(&p_ptr->wait_list);
	INIT_LIST_HEAD(&p_ptr->wait_list);
+3 −3
Original line number Original line Diff line number Diff line
@@ -48,7 +48,7 @@


/**
/**
 * struct tipc_port - TIPC port structure
 * 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
 * @lock: pointer to spinlock for controlling access to port
 * @connected: non-zero if port is currently connected to a peer port
 * @connected: non-zero if port is currently connected to a peer port
 * @conn_type: TIPC type used when connection was established
 * @conn_type: TIPC type used when connection was established
@@ -74,7 +74,7 @@
 * @subscription: "node down" subscription used to terminate failed connections
 * @subscription: "node down" subscription used to terminate failed connections
 */
 */
struct tipc_port {
struct tipc_port {
	void *usr_handle;
	struct sock *sk;
	spinlock_t *lock;
	spinlock_t *lock;
	int connected;
	int connected;
	u32 conn_type;
	u32 conn_type;
@@ -106,7 +106,7 @@ struct tipc_port_list;
/*
/*
 * TIPC port manipulation routines
 * 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 *),
		u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
		void (*wakeup)(struct tipc_port *), const u32 importance);
		void (*wakeup)(struct tipc_port *), const u32 importance);


+2 −2
Original line number Original line Diff line number Diff line
@@ -1406,7 +1406,7 @@ static int backlog_rcv(struct sock *sk, struct sk_buff *buf)
 */
 */
static u32 dispatch(struct tipc_port *tport, 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;
	u32 res;


	/*
	/*
@@ -1437,7 +1437,7 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
 */
 */
static void wakeupdispatch(struct tipc_port *tport)
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);
	sk->sk_write_space(sk);
}
}