[PATCH] Re: [openib-general] 0 op factor
Bernhard Fischer
blist at aon.at
Sat May 7 10:47:18 PDT 2005
On Thu, May 05, 2005 at 05:21:22PM -0700, Libor Michalek wrote:
> No point other then the obvious, changing the sign of the variables
>value. It's just a style convention that I have no problem changing.
- remove '0 operator factor' statements.
- a bit of whitespace removal.
- remove return at end of void functions.
- remove expect from _sdp_cm_path_complete().
- comment out empty if(var&FLAG){}else{} in _sdp_inet_release().
untested.
hw/mthca/mthca_cmd.c | 2 -
ulp/sdp/sdp_actv.c | 12 +++-------
ulp/sdp/sdp_inet.c | 58 ++++++++++++++++++++++-----------------------------
ulp/sdp/sdp_rcvd.c | 3 --
ulp/sdp/sdp_wall.c | 4 +--
5 files changed, 34 insertions(+), 45 deletions(-)
-------------- next part --------------
diff -rup infiniband.oorig/hw/mthca/mthca_cmd.c infiniband/hw/mthca/mthca_cmd.c
--- infiniband.oorig/hw/mthca/mthca_cmd.c 2005-01-19 15:53:15.000000000 +0100
+++ infiniband/hw/mthca/mthca_cmd.c 2005-05-07 19:28:34.924018992 +0200
@@ -219,7 +219,7 @@ static int mthca_cmd_post(struct mthca_d
* (and some architectures such as ia64 implement memcpy_toio
* in terms of writeb).
*/
- __raw_writel(cpu_to_be32(in_param >> 32), dev->hcr + 0 * 4);
+ __raw_writel(cpu_to_be32(in_param >> 32), dev->hcr/*+0 * 4*/);
__raw_writel(cpu_to_be32(in_param & 0xfffffffful), dev->hcr + 1 * 4);
__raw_writel(cpu_to_be32(in_modifier), dev->hcr + 2 * 4);
__raw_writel(cpu_to_be32(out_param >> 32), dev->hcr + 3 * 4);
diff -rup infiniband.oorig/ulp/sdp/sdp_actv.c infiniband/ulp/sdp/sdp_actv.c
--- infiniband.oorig/ulp/sdp/sdp_actv.c 2005-02-19 14:33:28.000000000 +0100
+++ infiniband/ulp/sdp/sdp_actv.c 2005-05-07 19:04:41.244971336 +0200
@@ -385,7 +385,6 @@ static void _sdp_cm_path_complete(u64 id
struct sdp_opt *conn = (struct sdp_opt *) arg;
struct sdpc_buff *buff;
int result = 0;
- int expect;
/*
* lock the socket
*/
@@ -491,8 +490,7 @@ static void _sdp_cm_path_complete(u64 id
sdp_dbg_warn(conn, "Error <%d> buffering hello msg.", result);
- expect = sdp_buff_pool_put(buff);
- SDP_EXPECT(!(0 > expect));
+ sdp_buff_pool_put(buff);
goto failed;
}
@@ -560,20 +558,18 @@ static void _sdp_cm_path_complete(u64 id
goto done;
failed:
- result = sdp_wall_recv_reject(conn, (0 - status));
+ result = sdp_wall_recv_reject(conn, -status);
if (0 > result) {
sdp_dbg_warn(conn, "Error <%d> rejecting connection", result);
-
- expect = sdp_wall_recv_drop(conn);
- SDP_EXPECT(!(0 > expect));
+
+ sdp_wall_recv_drop(conn);
}
/* if */
done:
SDP_CONN_UNLOCK(conn);
SDP_CONN_PUT(conn);
- return;
} /* _sdp_cm_path_complete */
/*
diff -rup infiniband.oorig/ulp/sdp/sdp_inet.c infiniband/ulp/sdp/sdp_inet.c
--- infiniband.oorig/ulp/sdp/sdp_inet.c 2005-02-19 14:33:28.000000000 +0100
+++ infiniband/ulp/sdp/sdp_inet.c 2005-05-07 19:21:34.928867960 +0200
@@ -103,11 +103,11 @@ void sdp_inet_wake_send(struct sock *sk)
{
struct sdp_opt *conn;
- if (NULL == sk ||
+ if (NULL == sk ||
NULL == (conn = SDP_GET_CONN(sk))) {
return;
- }
+ }
if (NULL != sk->sk_socket &&
0 < test_bit(SOCK_NOSPACE, &sk->sk_socket->flags) &&
@@ -128,7 +128,6 @@ void sdp_inet_wake_send(struct sock *sk)
read_unlock(&sk->sk_callback_lock);
}
- return;
} /* sdp_inet_wake_send */
/*
@@ -149,7 +148,6 @@ void sdp_inet_wake_generic(struct sock *
read_unlock(&sk->sk_callback_lock);
}
- return;
} /* sdp_inet_wake_generic */
/*
@@ -161,7 +159,7 @@ void sdp_inet_wake_recv(struct sock *sk,
read_lock(&sk->sk_callback_lock);
if (NULL != sk->sk_sleep) {
-
+
wake_up_interruptible(sk->sk_sleep);
}
@@ -169,7 +167,6 @@ void sdp_inet_wake_recv(struct sock *sk,
read_unlock(&sk->sk_callback_lock);
}
- return;
} /* sdp_inet_wake_recv */
/*
@@ -181,7 +178,7 @@ void sdp_inet_wake_error(struct sock *sk
read_lock(&sk->sk_callback_lock);
if (NULL != sk->sk_sleep) {
-
+
wake_up_interruptible(sk->sk_sleep);
}
@@ -189,7 +186,6 @@ void sdp_inet_wake_error(struct sock *sk
read_unlock(&sk->sk_callback_lock);
}
- return;
} /* sdp_inet_wake_error */
/*
@@ -205,7 +201,6 @@ void sdp_inet_wake_urg(struct sock *sk)
sk_send_sigurg(sk);
}
- return;
} /* sdp_inet_wake_urg */
/*
@@ -384,7 +379,7 @@ static int _sdp_inet_release(struct sock
*/
result = sdp_inet_listen_stop(conn);
if (0 > result) {
-
+
sdp_dbg_warn(conn, "Error <%d> while releasing listen",
result);
}
@@ -417,7 +412,7 @@ static int _sdp_inet_release(struct sock
*/
result = _sdp_inet_abort(conn);
if (0 > result) {
-
+
sdp_dbg_warn(conn, "Error <%d> while aborting socket",
result);
}
@@ -429,7 +424,7 @@ static int _sdp_inet_release(struct sock
*/
result = _sdp_inet_disconnect(conn);
if (0 > result) {
-
+
sdp_dbg_warn(conn, "Error <%d> while disconnecting socket",
result);
goto done;
@@ -449,7 +444,7 @@ static int _sdp_inet_release(struct sock
DECLARE_WAITQUEUE(wait, current);
timeout = sk->sk_lingertime;
-
+
add_wait_queue(sk->sk_sleep, &wait);
set_current_state(TASK_INTERRUPTIBLE);
@@ -461,7 +456,7 @@ static int _sdp_inet_release(struct sock
SDP_CONN_LOCK(conn);
if (signal_pending(current)) {
-
+
break;
}
}
@@ -487,6 +482,7 @@ static int _sdp_inet_release(struct sock
} /* if (blocking) */
done:
+#if 0
if (0 < (SDP_ST_MASK_CLOSED & conn->istate)) {
/*
* pass
@@ -495,6 +491,7 @@ done:
else {
}
+#endif
/*
* finally drop socket reference. (socket API reference)
*/
@@ -878,7 +875,7 @@ done:
* _sdp_inet_accept - accept a new socket from a listen socket
*/
static int _sdp_inet_accept(struct socket *listen_sock,
- struct socket *accept_sock,
+ struct socket *accept_sock,
int flags)
{
struct sock *listen_sk;
@@ -1043,7 +1040,7 @@ static int _sdp_inet_accept(struct socke
listen_done:
SDP_CONN_UNLOCK(listen_conn);
- sdp_dbg_ctrl(listen_conn,
+ sdp_dbg_ctrl(listen_conn,
"ACCEPT: complete <%d> <%08x:%04x><%08x:%04x>",
(NULL == accept_conn ?
SDP_DEV_SK_INVALID : accept_conn->hashent),
@@ -1074,7 +1071,7 @@ static int _sdp_inet_getname(struct sock
conn = SDP_GET_CONN(sk);
sdp_dbg_ctrl(conn, "GETNAME: src <%08x:%04x> dst <%08x:%04x>",
- conn->src_addr, conn->src_port,
+ conn->src_addr, conn->src_port,
conn->dst_addr, conn->dst_port);
addr->sin_family = _proto_family;
@@ -1163,8 +1160,8 @@ static unsigned int _sdp_inet_poll(struc
mask |= POLLIN | POLLRDNORM;
}
/*
- * send EOF _or_ send data space.
- * (Some poll() Linux documentation says that POLLHUP is
+ * send EOF _or_ send data space.
+ * (Some poll() Linux documentation says that POLLHUP is
* incompatible with the POLLOUT/POLLWR flags)
*/
if (0 < (SEND_SHUTDOWN & conn->shutdown)) {
@@ -1174,7 +1171,7 @@ static unsigned int _sdp_inet_poll(struc
else {
/*
* avoid race by setting flags, and only clearing
- * them if the test is passed. Setting after the
+ * them if the test is passed. Setting after the
* test, we can end up with them set and a passing
* test.
*/
@@ -1196,10 +1193,9 @@ static unsigned int _sdp_inet_poll(struc
}
}
- sdp_dbg_data(conn, "POLL: mask <%08x> flags <%08lx> <%d:%d:%d>",
+ sdp_dbg_data(conn, "POLL: mask <%08x> flags <%08lx> <%d:%d:%d>",
mask, sock->flags, conn->send_buf, conn->send_qud,
__sdp_inet_writable(conn));
-
return mask;
} /* _sdp_inet_poll */
@@ -1352,7 +1348,7 @@ static int _sdp_inet_ioctl(struct socket
/*
* _sdp_inet_setopt - set a socket option
*/
-static int _sdp_inet_setopt(struct socket *sock, int level, int optname,
+static int _sdp_inet_setopt(struct socket *sock, int level, int optname,
char __user *optval, int optlen)
{
struct sock *sk;
@@ -1367,7 +1363,7 @@ static int _sdp_inet_setopt(struct socke
sk = sock->sk;
conn = SDP_GET_CONN(sk);
- sdp_dbg_ctrl(conn, "SETSOCKOPT: level <%d> option <%d>",
+ sdp_dbg_ctrl(conn, "SETSOCKOPT: level <%d> option <%d>",
level, optname);
if (SOL_TCP != level && SOL_SDP != level) {
@@ -1668,7 +1664,7 @@ static int _sdp_inet_create(struct socke
sdp_dbg_ctrl(NULL, "SOCKET: type <%d> proto <%d> state <%u:%08lx>",
sock->type, protocol, sock->state, sock->flags);
-
+
if (SOCK_STREAM != sock->type ||
(IPPROTO_IP != protocol && IPPROTO_TCP != protocol)) {
@@ -1680,7 +1676,7 @@ static int _sdp_inet_create(struct socke
conn = sdp_conn_alloc(GFP_KERNEL);
if (NULL == conn) {
-
+
sdp_dbg_warn(conn, "SOCKET: failed to create socekt <%d:%d>",
sock->type, protocol);
return -ENOMEM;
@@ -1758,9 +1754,9 @@ static int __init sdp_init(void)
/*
* buffer memory
*/
- result = sdp_buff_pool_init(_buff_min,
- _buff_max,
- _alloc_inc,
+ result = sdp_buff_pool_init(_buff_min,
+ _buff_max,
+ _alloc_inc,
_free_mark);
if (0 > result) {
@@ -1771,7 +1767,7 @@ static int __init sdp_init(void)
* connection table
*/
result = sdp_conn_table_init(_proto_family,
- _conn_size,
+ _conn_size,
_recv_post_max,
_recv_buff_max,
_send_post_max,
@@ -1841,8 +1837,6 @@ static void __exit sdp_exit(void)
* proc tables
*/
(void)sdp_main_proc_cleanup();
-
- return;
} /* sdp_exit */
module_init(sdp_init);
diff -rup infiniband.oorig/ulp/sdp/sdp_rcvd.c infiniband/ulp/sdp/sdp_rcvd.c
--- infiniband.oorig/ulp/sdp/sdp_rcvd.c 2005-02-19 14:33:28.000000000 +0100
+++ infiniband/ulp/sdp/sdp_rcvd.c 2005-05-07 19:31:40.217850048 +0200
@@ -1032,8 +1032,7 @@ static int _sdp_rcvd_src_avail(struct sd
}
advt->rkey = srcah->r_key;
- advt->post =
- 0 - ((SDP_SRC_AVAIL_RECV > size) ? size : 0);
+ advt->post = (SDP_SRC_AVAIL_RECV > size) ? -size : 0;
advt->size =
srcah->size -
((SDP_SRC_AVAIL_RECV > size) ? 0 : size);
diff -rup infiniband.oorig/ulp/sdp/sdp_wall.c infiniband/ulp/sdp/sdp_wall.c
--- infiniband.oorig/ulp/sdp/sdp_wall.c 2005-02-19 14:33:28.000000000 +0100
+++ infiniband/ulp/sdp/sdp_wall.c 2005-05-07 19:09:02.698224400 +0200
@@ -320,9 +320,9 @@ int sdp_wall_recv_reject(struct sdp_opt
conn->istate = SDP_SOCK_ST_ERROR;
conn->shutdown = SHUTDOWN_MASK;
- result = sdp_iocb_q_cancel_all(conn, (0 - error));
+ result = sdp_iocb_q_cancel_all(conn, -error);
if (0 > result) {
-
+
sdp_dbg_warn(conn, "Error <%d> canceling outstanding IOCBs",
result);
}
More information about the general
mailing list