[ofa-general] ***SPAM*** [PATCH] core: Fixed several coding style issues according to checkpatch.pl
Dotan Barak
dotanba at gmail.com
Fri Jul 18 01:17:36 PDT 2008
Fixed several coding style issues according to checkpatch.pl:
* removed braces {} for single statement blocks
* added missing space
* removed extra spaces
* sizeof (u64) was changed to sizeof u64 to be consistent
* assignment in a condition was resolved
* opening '{' was set in the right place in a switch statement
Signed-off-by: Dotan Barak <dotanba at gmail.com>
---
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 09a2bec..0a81fac 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -364,9 +364,8 @@ static int netevent_callback(struct notifier_block *self, unsigned long event,
if (event == NETEVENT_NEIGH_UPDATE) {
struct neighbour *neigh = ctx;
- if (neigh->nud_state & NUD_VALID) {
+ if (neigh->nud_state & NUD_VALID)
set_timeout(jiffies);
- }
}
return 0;
}
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 55738ee..6f14f9c 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -309,8 +309,8 @@ static void cm_free_msg(struct ib_mad_send_buf *msg)
ib_free_send_mad(msg);
}
-static void * cm_copy_private_data(const void *private_data,
- u8 private_data_len)
+static void *cm_copy_private_data(const void *private_data,
+ u8 private_data_len)
{
void *data;
@@ -389,7 +389,7 @@ static int cm_alloc_id(struct cm_id_private *cm_id_priv)
if (!ret)
next_id = ((unsigned) id + 1) & MAX_ID_MASK;
spin_unlock_irqrestore(&cm.lock, flags);
- } while( (ret == -EAGAIN) && idr_pre_get(&cm.local_id_table, GFP_KERNEL) );
+ } while ((ret == -EAGAIN) && idr_pre_get(&cm.local_id_table, GFP_KERNEL));
cm_id_priv->id.local_id = (__force __be32)id ^ cm.random_id_operand;
return ret;
@@ -403,7 +403,7 @@ static void cm_free_id(__be32 local_id)
spin_unlock_irq(&cm.lock);
}
-static struct cm_id_private * cm_get_id(__be32 local_id, __be32 remote_id)
+static struct cm_id_private *cm_get_id(__be32 local_id, __be32 remote_id)
{
struct cm_id_private *cm_id_priv;
@@ -419,7 +419,7 @@ static struct cm_id_private * cm_get_id(__be32 local_id, __be32 remote_id)
return cm_id_priv;
}
-static struct cm_id_private * cm_acquire_id(__be32 local_id, __be32 remote_id)
+static struct cm_id_private *cm_acquire_id(__be32 local_id, __be32 remote_id)
{
struct cm_id_private *cm_id_priv;
@@ -490,7 +490,7 @@ static int be64_gt(__be64 a, __be64 b)
return (__force u64) a > (__force u64) b;
}
-static struct cm_id_private * cm_insert_listen(struct cm_id_private *cm_id_priv)
+static struct cm_id_private *cm_insert_listen(struct cm_id_private *cm_id_priv)
{
struct rb_node **link = &cm.listen_service_table.rb_node;
struct rb_node *parent = NULL;
@@ -529,9 +529,9 @@ static struct cm_id_private * cm_insert_listen(struct cm_id_private *cm_id_priv)
return NULL;
}
-static struct cm_id_private * cm_find_listen(struct ib_device *device,
- __be64 service_id,
- u8 *private_data)
+static struct cm_id_private *cm_find_listen(struct ib_device *device,
+ __be64 service_id,
+ u8 *private_data)
{
struct rb_node *node = cm.listen_service_table.rb_node;
struct cm_id_private *cm_id_priv;
@@ -562,8 +562,8 @@ static struct cm_id_private * cm_find_listen(struct ib_device *device,
return NULL;
}
-static struct cm_timewait_info * cm_insert_remote_id(struct cm_timewait_info
- *timewait_info)
+static struct cm_timewait_info *cm_insert_remote_id(struct cm_timewait_info
+ *timewait_info)
{
struct rb_node **link = &cm.remote_id_table.rb_node;
struct rb_node *parent = NULL;
@@ -592,8 +592,8 @@ static struct cm_timewait_info * cm_insert_remote_id(struct cm_timewait_info
return NULL;
}
-static struct cm_timewait_info * cm_find_remote_id(__be64 remote_ca_guid,
- __be32 remote_id)
+static struct cm_timewait_info *cm_find_remote_id(__be64 remote_ca_guid,
+ __be32 remote_id)
{
struct rb_node *node = cm.remote_id_table.rb_node;
struct cm_timewait_info *timewait_info;
@@ -615,8 +615,8 @@ static struct cm_timewait_info * cm_find_remote_id(__be64 remote_ca_guid,
return NULL;
}
-static struct cm_timewait_info * cm_insert_remote_qpn(struct cm_timewait_info
- *timewait_info)
+static struct cm_timewait_info *cm_insert_remote_qpn(struct cm_timewait_info
+ *timewait_info)
{
struct rb_node **link = &cm.remote_qp_table.rb_node;
struct rb_node *parent = NULL;
@@ -645,8 +645,8 @@ static struct cm_timewait_info * cm_insert_remote_qpn(struct cm_timewait_info
return NULL;
}
-static struct cm_id_private * cm_insert_remote_sidr(struct cm_id_private
- *cm_id_priv)
+static struct cm_id_private *cm_insert_remote_sidr(struct cm_id_private
+ *cm_id_priv)
{
struct rb_node **link = &cm.remote_sidr_table.rb_node;
struct rb_node *parent = NULL;
@@ -722,7 +722,7 @@ error:
}
EXPORT_SYMBOL(ib_create_cm_id);
-static struct cm_work * cm_dequeue_work(struct cm_id_private *cm_id_priv)
+static struct cm_work *cm_dequeue_work(struct cm_id_private *cm_id_priv)
{
struct cm_work *work;
@@ -779,7 +779,7 @@ static void cm_cleanup_timewait(struct cm_timewait_info *timewait_info)
}
}
-static struct cm_timewait_info * cm_create_timewait_info(__be32 local_id)
+static struct cm_timewait_info *cm_create_timewait_info(__be32 local_id)
{
struct cm_timewait_info *timewait_info;
@@ -1350,7 +1350,7 @@ static void cm_format_rej(struct cm_rej_msg *rej_msg,
cm_format_mad_hdr(&rej_msg->hdr, CM_REJ_ATTR_ID, cm_id_priv->tid);
rej_msg->remote_comm_id = cm_id_priv->id.remote_id;
- switch(cm_id_priv->id.state) {
+ switch (cm_id_priv->id.state) {
case IB_CM_REQ_RCVD:
rej_msg->local_comm_id = 0;
cm_rej_set_msg_rejected(rej_msg, CM_MSG_RESPONSE_REQ);
@@ -1423,8 +1423,8 @@ unlock: spin_unlock_irq(&cm_id_priv->lock);
free: cm_free_msg(msg);
}
-static struct cm_id_private * cm_match_req(struct cm_work *work,
- struct cm_id_private *cm_id_priv)
+static struct cm_id_private *cm_match_req(struct cm_work *work,
+ struct cm_id_private *cm_id_priv)
{
struct cm_id_private *listen_cm_id_priv, *cur_cm_id_priv;
struct cm_timewait_info *timewait_info;
@@ -2281,7 +2281,7 @@ static void cm_format_rej_event(struct cm_work *work)
work->cm_event.private_data = &rej_msg->private_data;
}
-static struct cm_id_private * cm_acquire_rejected_id(struct cm_rej_msg *rej_msg)
+static struct cm_id_private *cm_acquire_rejected_id(struct cm_rej_msg *rej_msg)
{
struct cm_timewait_info *timewait_info;
struct cm_id_private *cm_id_priv;
@@ -2291,7 +2291,7 @@ static struct cm_id_private * cm_acquire_rejected_id(struct cm_rej_msg *rej_msg)
if (__be16_to_cpu(rej_msg->reason) == IB_CM_REJ_TIMEOUT) {
spin_lock_irq(&cm.lock);
- timewait_info = cm_find_remote_id( *((__be64 *) rej_msg->ari),
+ timewait_info = cm_find_remote_id(*((__be64 *) rej_msg->ari),
remote_id);
if (!timewait_info) {
spin_unlock_irq(&cm.lock);
@@ -2396,7 +2396,7 @@ int ib_send_cm_mra(struct ib_cm_id *cm_id,
cm_id_priv = container_of(cm_id, struct cm_id_private, id);
spin_lock_irqsave(&cm_id_priv->lock, flags);
- switch(cm_id_priv->id.state) {
+ switch (cm_id_priv->id.state) {
case IB_CM_REQ_RCVD:
cm_state = IB_CM_MRA_REQ_SENT;
lap_state = cm_id->lap_state;
@@ -2448,7 +2448,7 @@ error2: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
}
EXPORT_SYMBOL(ib_send_cm_mra);
-static struct cm_id_private * cm_acquire_mraed_id(struct cm_mra_msg *mra_msg)
+static struct cm_id_private *cm_acquire_mraed_id(struct cm_mra_msg *mra_msg)
{
switch (cm_mra_get_msg_mraed(mra_msg)) {
case CM_MSG_RESPONSE_REQ:
@@ -3270,8 +3270,7 @@ static int cm_establish(struct ib_cm_id *cm_id)
cm_id_priv = container_of(cm_id, struct cm_id_private, id);
spin_lock_irqsave(&cm_id_priv->lock, flags);
- switch (cm_id->state)
- {
+ switch (cm_id->state) {
case IB_CM_REP_SENT:
case IB_CM_MRA_REP_RCVD:
cm_id->state = IB_CM_ESTABLISHED;
diff --git a/drivers/infiniband/core/cm_msgs.h b/drivers/infiniband/core/cm_msgs.h
index aec9c7a..8df76ae 100644
--- a/drivers/infiniband/core/cm_msgs.h
+++ b/drivers/infiniband/core/cm_msgs.h
@@ -172,7 +172,7 @@ static inline void cm_req_set_remote_resp_timeout(struct cm_req_msg *req_msg,
static inline enum ib_qp_type cm_req_get_qp_type(struct cm_req_msg *req_msg)
{
u8 transport_type = (u8) (be32_to_cpu(req_msg->offset40) & 0x06) >> 1;
- switch(transport_type) {
+ switch (transport_type) {
case 0: return IB_QPT_RC;
case 1: return IB_QPT_UC;
default: return 0;
@@ -182,7 +182,7 @@ static inline enum ib_qp_type cm_req_get_qp_type(struct cm_req_msg *req_msg)
static inline void cm_req_set_qp_type(struct cm_req_msg *req_msg,
enum ib_qp_type qp_type)
{
- switch(qp_type) {
+ switch (qp_type) {
case IB_QPT_UC:
req_msg->offset40 = cpu_to_be32((be32_to_cpu(
req_msg->offset40) &
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index ae11d5c..895d88f 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -221,7 +221,8 @@ static int cma_comp_exch(struct rdma_id_private *id_priv,
int ret;
spin_lock_irqsave(&id_priv->lock, flags);
- if ((ret = (id_priv->state == comp)))
+ ret = (id_priv->state == comp);
+ if (ret)
id_priv->state = exch;
spin_unlock_irqrestore(&id_priv->lock, flags);
return ret;
@@ -2277,7 +2278,7 @@ static int cma_connect_iw(struct rdma_id_private *id_priv,
struct rdma_conn_param *conn_param)
{
struct iw_cm_id *cm_id;
- struct sockaddr_in* sin;
+ struct sockaddr_in *sin;
int ret;
struct iw_cm_conn_param iw_param;
@@ -2289,10 +2290,10 @@ static int cma_connect_iw(struct rdma_id_private *id_priv,
id_priv->cm_id.iw = cm_id;
- sin = (struct sockaddr_in*) &id_priv->id.route.addr.src_addr;
+ sin = (struct sockaddr_in *) &id_priv->id.route.addr.src_addr;
cm_id->local_addr = *sin;
- sin = (struct sockaddr_in*) &id_priv->id.route.addr.dst_addr;
+ sin = (struct sockaddr_in *) &id_priv->id.route.addr.dst_addr;
cm_id->remote_addr = *sin;
ret = cma_modify_qp_rtr(id_priv, conn_param);
@@ -2399,9 +2400,9 @@ static int cma_accept_iw(struct rdma_id_private *id_priv,
iw_param.ird = conn_param->responder_resources;
iw_param.private_data = conn_param->private_data;
iw_param.private_data_len = conn_param->private_data_len;
- if (id_priv->id.qp) {
+ if (id_priv->id.qp)
iw_param.qpn = id_priv->qp_num;
- } else
+ else
iw_param.qpn = conn_param->qp_num;
return iw_cm_accept(id_priv->cm_id.iw, &iw_param);
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 7913b80..272a3fe 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -49,7 +49,7 @@ MODULE_LICENSE("Dual BSD/GPL");
struct ib_client_data {
struct list_head list;
struct ib_client *client;
- void * data;
+ void *data;
};
static LIST_HEAD(device_list);
diff --git a/drivers/infiniband/core/fmr_pool.c b/drivers/infiniband/core/fmr_pool.c
index 4507043..078370e 100644
--- a/drivers/infiniband/core/fmr_pool.c
+++ b/drivers/infiniband/core/fmr_pool.c
@@ -92,7 +92,7 @@ struct ib_fmr_pool {
struct hlist_head *cache_bucket;
void (*flush_function)(struct ib_fmr_pool *pool,
- void * arg);
+ void *arg);
void *flush_arg;
struct task_struct *thread;
@@ -149,7 +149,7 @@ static void ib_fmr_batch_release(struct ib_fmr_pool *pool)
list_add_tail(&fmr->fmr->list, &fmr_list);
#ifdef DEBUG
- if (fmr->ref_count !=0) {
+ if (fmr->ref_count != 0) {
printk(KERN_WARNING PFX "Unmapping FMR 0x%08x with ref count %d\n",
fmr, fmr->ref_count);
}
@@ -161,9 +161,8 @@ static void ib_fmr_batch_release(struct ib_fmr_pool *pool)
spin_unlock_irq(&pool->pool_lock);
- if (list_empty(&unmap_list)) {
+ if (list_empty(&unmap_list))
return;
- }
ret = ib_unmap_fmr(&fmr_list);
if (ret)
@@ -306,7 +305,7 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
int bytes_per_fmr = sizeof *fmr;
if (pool->cache_bucket)
- bytes_per_fmr += params->max_pages_per_fmr * sizeof (u64);
+ bytes_per_fmr += params->max_pages_per_fmr * sizeof u64;
for (i = 0; i < params->pool_size; ++i) {
fmr = kmalloc(bytes_per_fmr, GFP_KERNEL);
@@ -452,9 +451,8 @@ struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,
if (fmr) {
/* found in cache */
++fmr->ref_count;
- if (fmr->ref_count == 1) {
+ if (fmr->ref_count == 1)
list_del(&fmr->list);
- }
spin_unlock_irqrestore(&pool->pool_lock, flags);
diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c
index 81c9195..53f53fc 100644
--- a/drivers/infiniband/core/iwcm.c
+++ b/drivers/infiniband/core/iwcm.c
@@ -158,7 +158,7 @@ static void free_cm_id(struct iwcm_id_private *cm_id_priv)
*/
static int iwcm_deref_id(struct iwcm_id_private *cm_id_priv)
{
- BUG_ON(atomic_read(&cm_id_priv->refcount)==0);
+ BUG_ON(atomic_read(&cm_id_priv->refcount) == 0);
if (atomic_dec_and_test(&cm_id_priv->refcount)) {
BUG_ON(!list_empty(&cm_id_priv->work_list));
complete(&cm_id_priv->destroy_comp);
@@ -652,7 +652,7 @@ static void cm_conn_req_handler(struct iwcm_id_private *listen_id_priv,
iw_cm_reject(cm_id, NULL, 0);
set_bit(IWCM_F_CALLBACK_DESTROY, &cm_id_priv->flags);
destroy_cm_id(cm_id);
- if (atomic_read(&cm_id_priv->refcount)==0)
+ if (atomic_read(&cm_id_priv->refcount) == 0)
free_cm_id(cm_id_priv);
}
@@ -857,7 +857,7 @@ static void cm_work_handler(struct work_struct *_work)
set_bit(IWCM_F_CALLBACK_DESTROY, &cm_id_priv->flags);
destroy_cm_id(&cm_id_priv->id);
}
- BUG_ON(atomic_read(&cm_id_priv->refcount)==0);
+ BUG_ON(atomic_read(&cm_id_priv->refcount) == 0);
destroy_id = test_bit(IWCM_F_CALLBACK_DESTROY, &cm_id_priv->flags);
if (iwcm_deref_id(cm_id_priv)) {
if (destroy_id) {
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 4d10421..f85a21a 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -687,7 +687,7 @@ static ssize_t show_##name(struct device *device, \
{ \
return show_protocol_stat(device, attr, buf, \
offsetof(struct iw_protocol_stats, name) / \
- sizeof (u64)); \
+ sizeof u64); \
} \
static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
diff --git a/drivers/infiniband/core/ud_header.c b/drivers/infiniband/core/ud_header.c
index 8ec7876..f1f6da2 100644
--- a/drivers/infiniband/core/ud_header.c
+++ b/drivers/infiniband/core/ud_header.c
@@ -202,9 +202,8 @@ void ib_ud_header_init(int payload_bytes,
IB_LRH_BYTES +
IB_BTH_BYTES +
IB_DETH_BYTES;
- if (grh_present) {
+ if (grh_present)
header_len += IB_GRH_BYTES;
- }
header->lrh.link_version = 0;
header->lrh.link_next_header =
More information about the general
mailing list