[openib-general] [PATCH] sdp: cleanup brackets
Michael S. Tsirkin
mst at mellanox.co.il
Wed Aug 10 09:12:27 PDT 2005
I plan to commit the following tomorrow after a bit of testing.
---
Kill brackets around function parameters: , binds weaker than other operator.
+ some whitespace fixes.
Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>
Index: ulp/sdp/sdp_link.c
===================================================================
--- ulp/sdp/sdp_link.c (revision 3036)
+++ ulp/sdp/sdp_link.c (working copy)
@@ -436,16 +436,13 @@ static void do_link_path_lookup(void *da
info->path.pkey = cpu_to_be16(priv->pkey);
info->path.numb_path = 1;
- memcpy(&info->path.sgid,
- (info->dev->dev_addr + 4),
- sizeof(union ib_gid));
+ memcpy(&info->path.sgid, info->dev->dev_addr + 4, sizeof(union ib_gid));
/*
* If the routing device is loopback save the device address of
* the IB device which was found.
*/
if (rt->u.dst.neighbour->dev->flags & IFF_LOOPBACK) {
- memcpy(&info->path.dgid,
- (info->dev->dev_addr + 4),
+ memcpy(&info->path.dgid, info->dev->dev_addr + 4,
sizeof(union ib_gid));
goto path;
@@ -453,8 +450,7 @@ static void do_link_path_lookup(void *da
if ((NUD_CONNECTED|NUD_DELAY|NUD_PROBE) &
rt->u.dst.neighbour->nud_state) {
- memcpy(&info->path.dgid,
- (rt->u.dst.neighbour->ha + 4),
+ memcpy(&info->path.dgid, rt->u.dst.neighbour->ha + 4,
sizeof(union ib_gid));
goto path;
@@ -617,7 +613,7 @@ static void sdp_link_sweep(void *data)
if (jiffies > (info->use + SDP_LINK_INFO_TIMEOUT)) {
sdp_dbg_ctrl(NULL,
"info delete <%d.%d.%d.%d> <%lu:%lu>",
- (info->dst & 0x000000ff),
+ info->dst & 0x000000ff,
(info->dst & 0x0000ff00) >> 8,
(info->dst & 0x00ff0000) >> 16,
(info->dst & 0xff000000) >> 24,
@@ -648,7 +644,7 @@ static void sdp_link_arp_work(void *data
arp = (struct sdp_link_arp *)skb->nh.raw;
sdp_dbg_data(NULL, "Recv IB ARP ip <%d.%d.%d.%d> gid <" GID_FMT ">",
- (arp->src_ip & 0x000000ff),
+ arp->src_ip & 0x000000ff,
(arp->src_ip & 0x0000ff00) >> 8,
(arp->src_ip & 0x00ff0000) >> 16,
(arp->src_ip & 0xff000000) >> 24,
Index: ulp/sdp/sdp_rcvd.c
===================================================================
--- ulp/sdp/sdp_rcvd.c (revision 3036)
+++ ulp/sdp/sdp_rcvd.c (working copy)
@@ -851,7 +851,7 @@ static int sdp_rcvd_src_avail(struct sdp
sdp_dbg_warn(conn,
"SrcAvail mode <%d> mismatch. <%d:%d>",
conn->recv_mode,
- (conn->src_recv + conn->snk_recv), size);
+ conn->src_recv + conn->snk_recv, size);
result = -EPROTO;
goto advt_error;
Index: ulp/sdp/sdp_inet.c
===================================================================
--- ulp/sdp/sdp_inet.c (revision 3036)
+++ ulp/sdp/sdp_inet.c (working copy)
@@ -550,7 +550,7 @@ static int sdp_inet_connect(struct socke
/*
* wait for connection to complete.
*/
- timeout = sock_sndtimeo(sk, (O_NONBLOCK & flags));
+ timeout = sock_sndtimeo(sk, O_NONBLOCK & flags);
if (timeout > 0) {
DECLARE_WAITQUEUE(wait, current);
@@ -698,7 +698,7 @@ static int sdp_inet_accept(struct socket
goto listen_done;
}
- timeout = sock_rcvtimeo(listen_sk, (O_NONBLOCK & flags));
+ timeout = sock_rcvtimeo(listen_sk, O_NONBLOCK & flags);
/*
* if there is no socket on the queue, wait for one. It' done in a
* loop in case there is a problem with the first socket we hit.
@@ -791,11 +791,11 @@ listen_done:
sdp_dbg_ctrl(listen_conn,
"ACCEPT: complete <%d> <%08x:%04x><%08x:%04x>",
- (accept_conn ? accept_conn->hashent : SDP_DEV_SK_INVALID),
- (accept_sk ? accept_conn->src_addr : 0),
- (accept_sk ? accept_conn->src_port : 0),
- (accept_sk ? accept_conn->dst_addr : 0),
- (accept_sk ? accept_conn->dst_port : 0));
+ accept_conn ? accept_conn->hashent : SDP_DEV_SK_INVALID,
+ accept_sk ? accept_conn->src_addr : 0,
+ accept_sk ? accept_conn->src_port : 0,
+ accept_sk ? accept_conn->dst_addr : 0,
+ accept_sk ? accept_conn->dst_port : 0);
return result;
}
Index: ulp/sdp/sdp_send.c
===================================================================
--- ulp/sdp/sdp_send.c (revision 3036)
+++ ulp/sdp/sdp_send.c (working copy)
@@ -641,7 +641,7 @@ static int sdp_send_data_iocb_src(struct
goto error;
}
- memcpy(buff->tail, (addr + off), len);
+ memcpy(buff->tail, addr + off, len);
kunmap_atomic(iocb->page_array[pos], KM_IRQ0);
@@ -712,11 +712,11 @@ static int sdp_send_iocb_buff_write(stru
break;
}
- copy = min((PAGE_SIZE - offset),
+ copy = min(PAGE_SIZE - offset,
(unsigned long)(buff->end - buff->tail));
copy = min((unsigned long)iocb->len, copy);
#ifndef _SDP_DATA_PATH_NULL
- memcpy(buff->tail, (addr + offset), copy);
+ memcpy(buff->tail, addr + offset, copy);
#endif
buff->data_size += copy;
buff->tail += copy;
@@ -2021,8 +2021,8 @@ skip: /* entry point for IOCB based tran
* onetime setup of timeout, but only if it's needed.
*/
if (timeout < 0)
- timeout = sock_sndtimeo(sk, (MSG_DONTWAIT &
- msg->msg_flags));
+ timeout = sock_sndtimeo(sk,
+ MSG_DONTWAIT & msg->msg_flags);
if (sk->sk_err) {
result = (copied > 0) ? 0 : sock_error(sk);
Index: ulp/sdp/sdp_actv.c
===================================================================
--- ulp/sdp/sdp_actv.c (revision 3036)
+++ ulp/sdp/sdp_actv.c (working copy)
@@ -238,8 +238,8 @@ static int sdp_cm_hello_ack_check(struct
if ((0xF0 & hello_ack->hah.version) != (0xF0 & SDP_MSG_VERSION)) {
sdp_dbg_warn(NULL, "hello ack, version mismatch. <%d:%d>",
- ((0xF0 & hello_ack->hah.version) >> 4),
- ((0xF0 & SDP_MSG_VERSION) >> 4));
+ (0xF0 & hello_ack->hah.version) >> 4,
+ (0xF0 & SDP_MSG_VERSION) >> 4);
return -EINVAL;
}
Index: ulp/sdp/sdp_conn.c
===================================================================
--- ulp/sdp/sdp_conn.c (revision 3036)
+++ ulp/sdp/sdp_conn.c (working copy)
@@ -1337,8 +1337,8 @@ int sdp_proc_dump_conn_main(char *buffer
* header should only be printed once
*/
if (!start_index) {
- offset += sprintf((buffer + offset), SDP_PROC_CONN_MAIN_HEAD);
- offset += sprintf((buffer + offset), SDP_PROC_CONN_MAIN_SEP);
+ offset += sprintf(buffer + offset, SDP_PROC_CONN_MAIN_HEAD);
+ offset += sprintf(buffer + offset, SDP_PROC_CONN_MAIN_SEP);
}
/*
* lock table
@@ -1364,16 +1364,16 @@ int sdp_proc_dump_conn_main(char *buffer
d_guid = cpu_to_be64(conn->d_gid.global.interface_id);
s_guid = cpu_to_be64(conn->s_gid.global.interface_id);
- offset += sprintf((buffer + offset), SDP_PROC_CONN_MAIN_FORM,
- (conn->dst_addr & 0xff),
- ((conn->dst_addr >> 8) & 0xff),
- ((conn->dst_addr >> 16) & 0xff),
- ((conn->dst_addr >> 24) & 0xff),
+ offset += sprintf(buffer + offset, SDP_PROC_CONN_MAIN_FORM,
+ conn->dst_addr & 0xff,
+ (conn->dst_addr >> 8) & 0xff,
+ (conn->dst_addr >> 16) & 0xff,
+ (conn->dst_addr >> 24) & 0xff,
conn->dst_port,
- (conn->src_addr & 0xff),
- ((conn->src_addr >> 8) & 0xff),
- ((conn->src_addr >> 16) & 0xff),
- ((conn->src_addr >> 24) & 0xff),
+ conn->src_addr & 0xff,
+ (conn->src_addr >> 8) & 0xff,
+ (conn->src_addr >> 16) & 0xff,
+ (conn->src_addr >> 24) & 0xff,
conn->src_port,
conn->hashent,
conn->cm_id ? conn->cm_id->local_id : 0,
@@ -1440,8 +1440,8 @@ int sdp_proc_dump_conn_data(char *buffer
* header should only be printed once
*/
if (!start_index) {
- offset += sprintf((buffer + offset), SDP_PROC_CONN_DATA_HEAD);
- offset += sprintf((buffer + offset), SDP_PROC_CONN_DATA_SEP);
+ offset += sprintf(buffer + offset, SDP_PROC_CONN_DATA_HEAD);
+ offset += sprintf(buffer + offset, SDP_PROC_CONN_DATA_SEP);
}
/*
* lock table
@@ -1464,7 +1464,7 @@ int sdp_proc_dump_conn_data(char *buffer
conn = dev_root_s.sk_array[counter];
sk = sk_sdp(conn);
- offset += sprintf((buffer + offset), SDP_PROC_CONN_DATA_FORM,
+ offset += sprintf(buffer + offset, SDP_PROC_CONN_DATA_FORM,
conn->hashent,
conn->state,
conn->recv_mode,
@@ -1533,8 +1533,8 @@ int sdp_proc_dump_conn_rdma(char *buffer
* header should only be printed once
*/
if (!start_index) {
- offset += sprintf((buffer + offset), SDP_PROC_CONN_RDMA_HEAD);
- offset += sprintf((buffer + offset), SDP_PROC_CONN_RDMA_SEP);
+ offset += sprintf(buffer + offset, SDP_PROC_CONN_RDMA_HEAD);
+ offset += sprintf(buffer + offset, SDP_PROC_CONN_RDMA_SEP);
}
/*
* lock table
@@ -1556,7 +1556,7 @@ int sdp_proc_dump_conn_rdma(char *buffer
conn = dev_root_s.sk_array[counter];
- offset += sprintf((buffer + offset),SDP_PROC_CONN_RDMA_FORM,
+ offset += sprintf(buffer + offset, SDP_PROC_CONN_RDMA_FORM,
conn->hashent,
conn->src_recv,
conn->snk_recv,
@@ -1610,8 +1610,8 @@ int sdp_proc_dump_conn_sopt(char *buffer
* header should only be printed once
*/
if (!start_index) {
- offset += sprintf((buffer + offset), SDP_PROC_CONN_SOPT_HEAD);
- offset += sprintf((buffer + offset), SDP_PROC_CONN_SOPT_SEP);
+ offset += sprintf(buffer + offset, SDP_PROC_CONN_SOPT_HEAD);
+ offset += sprintf(buffer + offset, SDP_PROC_CONN_SOPT_SEP);
}
/*
* lock table
@@ -1633,16 +1633,16 @@ int sdp_proc_dump_conn_sopt(char *buffer
conn = dev_root_s.sk_array[counter];
- offset += sprintf((buffer + offset), SDP_PROC_CONN_SOPT_FORM,
- (conn->dst_addr & 0xff),
- ((conn->dst_addr >> 8) & 0xff),
- ((conn->dst_addr >> 16) & 0xff),
- ((conn->dst_addr >> 24) & 0xff),
+ offset += sprintf(buffer + offset, SDP_PROC_CONN_SOPT_FORM,
+ conn->dst_addr & 0xff,
+ (conn->dst_addr >> 8) & 0xff,
+ (conn->dst_addr >> 16) & 0xff,
+ (conn->dst_addr >> 24) & 0xff,
conn->dst_port,
- (conn->src_addr & 0xff),
- ((conn->src_addr >> 8) & 0xff),
- ((conn->src_addr >> 16) & 0xff),
- ((conn->src_addr >> 24) & 0xff),
+ conn->src_addr & 0xff,
+ (conn->src_addr >> 8) & 0xff,
+ (conn->src_addr >> 16) & 0xff,
+ (conn->src_addr >> 24) & 0xff,
conn->src_port,
conn->src_zthresh,
conn->snk_zthresh,
@@ -1668,29 +1668,29 @@ int sdp_proc_dump_device(char *buffer, i
* header should only be printed once
*/
if (!start_index) {
- offset += sprintf((buffer + offset),
+ offset += sprintf(buffer + offset,
"connection table maximum: <%d>\n",
dev_root_s.sk_size);
- offset += sprintf((buffer + offset),
+ offset += sprintf(buffer + offset,
"connection table entries: <%d>\n",
dev_root_s.sk_entry);
- offset += sprintf((buffer + offset),
+ offset += sprintf(buffer + offset,
"connection table rover: <%d>\n",
dev_root_s.sk_rover);
- offset += sprintf((buffer + offset),
+ offset += sprintf(buffer + offset,
"max send posted: <%d>\n",
dev_root_s.send_post_max);
- offset += sprintf((buffer + offset),
+ offset += sprintf(buffer + offset,
"max send buffered: <%d>\n",
dev_root_s.send_buff_max);
- offset += sprintf((buffer + offset),
+ offset += sprintf(buffer + offset,
"max send unsignalled: <%d>\n",
dev_root_s.send_usig_max);
- offset += sprintf((buffer + offset),
+ offset += sprintf(buffer + offset,
"max receive posted: <%d>\n",
dev_root_s.recv_post_max);
- offset += sprintf((buffer + offset),
+ offset += sprintf(buffer + offset,
"max receive buffered: <%d>\n",
dev_root_s.recv_buff_max);
}
Index: ulp/sdp/sdp_recv.c
===================================================================
--- ulp/sdp/sdp_recv.c (revision 3036)
+++ ulp/sdp/sdp_recv.c (working copy)
@@ -481,7 +481,7 @@ int sdp_recv_flush(struct sdp_sock *conn
* the buffered receive/receive posted queue, and the maximum
* number which are allowed to be posted at a given time.
*/
- counter = min((s32)((conn->rwin_max - conn->byte_strm)/
+ counter = min((s32)((conn->rwin_max - conn->byte_strm) /
conn->recv_size),
(s32) (conn->recv_max -
sdp_buff_q_size(&conn->recv_pool)));
@@ -594,11 +594,11 @@ static int sdp_read_buff_iocb(struct sdp
if (!addr)
break;
- copy = min((PAGE_SIZE - offset),
+ copy = min(PAGE_SIZE - offset,
(unsigned long)(buff->tail - buff->data));
copy = min((unsigned long)iocb->len, copy);
#ifndef _SDP_DATA_PATH_NULL
- memcpy((addr + offset), buff->data, copy);
+ memcpy(addr + offset, buff->data, copy);
#endif
buff->data += copy;
@@ -1120,8 +1120,8 @@ int sdp_inet_recv(struct kiocb *req, st
/*
* get socket values we'll need.
*/
- timeout = sock_rcvtimeo(sk, (flags & MSG_DONTWAIT));
- low_water = sock_rcvlowat(sk, (flags & MSG_WAITALL), size);
+ timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
+ low_water = sock_rcvlowat(sk, flags & MSG_WAITALL, size);
/*
* process data first, and then check condition, then wait
*/
Index: ulp/sdp/sdp_pass.c
===================================================================
--- ulp/sdp/sdp_pass.c (revision 3036)
+++ ulp/sdp/sdp_pass.c (working copy)
@@ -312,8 +312,8 @@ static int sdp_cm_hello_check(struct sdp
if ((0xF0 & msg_hello->hh.version) != (0xF0 & SDP_MSG_VERSION)) {
sdp_dbg_warn(NULL, "hello msg, version mismatch. <%d:%d>",
- ((0xF0 & msg_hello->hh.version) >> 4),
- ((0xF0 & SDP_MSG_VERSION) >> 4));
+ (0xF0 & msg_hello->hh.version) >> 4,
+ (0xF0 & SDP_MSG_VERSION) >> 4);
return -EINVAL;
}
#ifdef _SDP_MS_APRIL_ERROR_COMPAT
Index: ulp/sdp/sdp_iocb.c
===================================================================
--- ulp/sdp/sdp_iocb.c (revision 3049)
+++ ulp/sdp/sdp_iocb.c (working copy)
@@ -90,7 +90,7 @@ void sdp_iocb_unlock(struct sdpc_iocb *i
* try to get all pages in one go. */
/* TODO: use cache for allocations? Allocate by chunks? */
- pages = kmalloc((sizeof(struct page *) * iocb->page_count), GFP_KERNEL);
+ pages = kmalloc(sizeof(struct page *) * iocb->page_count, GFP_KERNEL);
down_read(&iocb->mm->mmap_sem);
if (pages) {
result = get_user_pages(iocb->tsk, iocb->mm, iocb->addr,
@@ -167,12 +167,11 @@ int sdp_iocb_lock(struct sdpc_iocb *iocb
*/
/* TODO: use cache for allocations? Allocate by chunks? */
- iocb->addr_array = kmalloc((sizeof(u64) * iocb->page_count),
- GFP_KERNEL);
+ iocb->addr_array = kmalloc(sizeof(u64) * iocb->page_count, GFP_KERNEL);
if (!iocb->addr_array)
goto err_addr;
- iocb->page_array = kmalloc((sizeof(struct page *) * iocb->page_count),
+ iocb->page_array = kmalloc(sizeof(struct page *) * iocb->page_count,
GFP_KERNEL);
if (!iocb->page_array)
goto err_page;
Index: ulp/sdp/sdp_buff.c
===================================================================
--- ulp/sdp/sdp_buff.c (revision 3036)
+++ ulp/sdp/sdp_buff.c (working copy)
@@ -342,8 +342,8 @@ static inline void sdp_buff_pool_release
* Always leave at least minimum buffers, otherwise remove
* either half of the pool, which is more then the mark
*/
- count = min((m_pool->buff_cur - m_pool->buff_min),
- (m_pool->free_mark/2));
+ count = min(m_pool->buff_cur - m_pool->buff_min,
+ m_pool->free_mark/2);
sdp_buff_pool_release(m_pool, count);
}
@@ -359,7 +359,7 @@ static int sdp_buff_pool_alloc(struct sd
/*
* Calculate the total number of buffers.
*/
- total = max(m_pool->buff_min, (m_pool->buff_cur + m_pool->alloc_inc));
+ total = max(m_pool->buff_min, m_pool->buff_cur + m_pool->alloc_inc);
total = min(total, m_pool->buff_max);
while (total > m_pool->buff_cur) {
@@ -719,28 +719,28 @@ int sdp_proc_dump_buff_pool(char *buffer
spin_lock_irqsave(&main_pool->lock, flags);
if (!start_index) {
- offset += sprintf((buffer + offset),
+ offset += sprintf(buffer + offset,
" buffer size: %8d\n",
main_pool->buff_size);
- offset += sprintf((buffer + offset),
+ offset += sprintf(buffer + offset,
" buffers maximum: %8d\n",
main_pool->buff_max);
- offset += sprintf((buffer + offset),
+ offset += sprintf(buffer + offset,
" buffers minimum: %8d\n",
main_pool->buff_min);
- offset += sprintf((buffer + offset),
+ offset += sprintf(buffer + offset,
" buffers increment: %8d\n",
main_pool->alloc_inc);
- offset += sprintf((buffer + offset),
+ offset += sprintf(buffer + offset,
" buffers decrement: %8d\n",
main_pool->free_mark);
- offset += sprintf((buffer + offset),
+ offset += sprintf(buffer + offset,
" buffers allocated: %8d\n",
main_pool->buff_cur);
- offset += sprintf((buffer + offset),
+ offset += sprintf(buffer + offset,
" buffers available: %8d\n",
main_pool->pool.size);
- offset += sprintf((buffer + offset),
+ offset += sprintf(buffer + offset,
" buffers outstanding: %8d\n",
main_pool->buff_cur - main_pool->pool.size);
}
--
MST
More information about the general
mailing list