Skip to contentSkip to conversation

RXE checkpatch cleanup

PATCH In review Leon Romanovsky 3 participants 10 messages Jun 15, 2017 – Jul 28, 2017 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover RXE checkpatch cleanup

This patchset from Kamal cleanups some of the warnings and errors that he got from applying checkpatch.pl script on RXE files.

Kamal Heib (5):
IB/rxe: Use "foo *bar" instead of "foo * bar" IB/rxe: Prefer 'unsigned int' to bare use of 'unsigned' IB/rxe: Use DEVICE_ATTR_RO macro to show parent field IB/rxe: Use __func__ to print function's name IB/rxe: Constify static rxe_vm_ops

 drivers/infiniband/sw/rxe/rxe.h       |  2 +-
 drivers/infiniband/sw/rxe/rxe_loc.h   |  2 +-
 drivers/infiniband/sw/rxe/rxe_mmap.c  |  2 +-
 drivers/infiniband/sw/rxe/rxe_pool.c  |  2 +-
 drivers/infiniband/sw/rxe/rxe_req.c   |  2 +-
 drivers/infiniband/sw/rxe/rxe_task.c  |  4 ++--
 drivers/infiniband/sw/rxe/rxe_verbs.c | 12 ++++++------
 7 files changed, 13 insertions(+), 13 deletions(-)

--
2.12.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20170615082907.5658-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#2 lore raw

PATCH 1/5 IB/rxe: Use "foo *bar" instead of "foo * bar"

From: Kamal Heib <[email protected]>

---
 drivers/infiniband/sw/rxe/rxe.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe.h +1 -1
index ecdba2fce083..40ff6b23ddbc 100644
@@ -94,7 +94,7 @@ int rxe_rcv(struct sk_buff *skb);
 
 void rxe_dev_put(struct rxe_dev *rxe);
 struct rxe_dev *net_to_rxe(struct net_device *ndev);
-struct rxe_dev *get_rxe_by_name(const char* name);
+struct rxe_dev *get_rxe_by_name(const char *name);
 
 void rxe_port_up(struct rxe_dev *rxe);
 void rxe_port_down(struct rxe_dev *rxe);
Signature · 6 lines
2.12.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

PATCH 2/5 IB/rxe: Prefer 'unsigned int' to bare use of 'unsigned'

In reply to a message not in the archive

From: Kamal Heib <[email protected]>

---
 drivers/infiniband/sw/rxe/rxe_loc.h  | 2 +-
 drivers/infiniband/sw/rxe/rxe_pool.c | 2 +-
 drivers/infiniband/sw/rxe/rxe_req.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/sw/rxe/rxe_loc.h +1 -1
index d6299edf9a5b..6b65c0132289 100644
@@ -250,7 +250,7 @@ void rxe_resp_queue_pkt(struct rxe_dev *rxe,
 void rxe_comp_queue_pkt(struct rxe_dev *rxe,
 			struct rxe_qp *qp, struct sk_buff *skb);
 
-static inline unsigned wr_opcode_mask(int opcode, struct rxe_qp *qp)
+static inline unsigned int wr_opcode_mask(int opcode, struct rxe_qp *qp)
 {
 	return rxe_wr_opcode_info[opcode].mask[qp->ibqp.qp_type];
 }
drivers/infiniband/sw/rxe/rxe_pool.c +1 -1
index 75d11ee635ec..c1b5f38f31a5 100644
@@ -188,7 +188,7 @@ int rxe_pool_init(
 	struct rxe_dev		*rxe,
 	struct rxe_pool		*pool,
 	enum rxe_elem_type	type,
-	unsigned		max_elem)
+	unsigned int		max_elem)
 {
 	int			err = 0;
 	size_t			size = rxe_type_info[type].size;
drivers/infiniband/sw/rxe/rxe_req.c +1 -1
index 7ee465d1a1e1..db7161456f45 100644
@@ -43,7 +43,7 @@ static int next_opcode(struct rxe_qp *qp, struct rxe_send_wqe *wqe,
 
 static inline void retry_first_write_send(struct rxe_qp *qp,
 					  struct rxe_send_wqe *wqe,
-					  unsigned mask, int npsn)
+					  unsigned int mask, int npsn)
 {
 	int i;
 
Signature · 6 lines
2.12.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw

PATCH 3/5 IB/rxe: Use DEVICE_ATTR_RO macro to show parent field

In reply to a message not in the archive

From: Kamal Heib <[email protected]>

Use DEVICE_ATTR RO() macro and rename the show function accordingly.

---
 drivers/infiniband/sw/rxe/rxe_verbs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/sw/rxe/rxe_verbs.c +3 -3
index 83d709e74dfb..92156025db73 100644
@@ -1212,8 +1212,8 @@ static int rxe_detach_mcast(struct ib_qp *ibqp, union ib_gid *mgid, u16 mlid)
 	return rxe_mcast_drop_grp_elem(rxe, qp, mgid);
 }
 
-static ssize_t rxe_show_parent(struct device *device,
-			       struct device_attribute *attr, char *buf)
+static ssize_t parent_show(struct device *device,
+			   struct device_attribute *attr, char *buf)
 {
 	struct rxe_dev *rxe = container_of(device, struct rxe_dev,
 					   ib_dev.dev);
@@ -1221,7 +1221,7 @@ static ssize_t rxe_show_parent(struct device *device,
 	return snprintf(buf, 16, "%s\n", rxe_parent_name(rxe, 1));
 }
 
-static DEVICE_ATTR(parent, S_IRUGO, rxe_show_parent, NULL);
+static DEVICE_ATTR_RO(parent);
 
 static struct device_attribute *rxe_dev_attributes[] = {
 	&dev_attr_parent,
Signature · 6 lines
2.12.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw

PATCH 4/5 IB/rxe: Use __func__ to print function's name

In reply to a message not in the archive

From: Kamal Heib <[email protected]>

Its better to use __func__ to print functions name instead of writing the name in the print statement.

---
 drivers/infiniband/sw/rxe/rxe_task.c  | 4 ++--
 drivers/infiniband/sw/rxe/rxe_verbs.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/infiniband/sw/rxe/rxe_task.c +2 -2
index d2a14a1bdc7f..ea3810b29273 100644
@@ -78,7 +78,7 @@ void rxe_do_task(unsigned long data)
 
 	default:
 		spin_unlock_irqrestore(&task->state_lock, flags);
-		pr_warn("bad state = %d in rxe_do_task\n", task->state);
+		pr_warn("%s failed with bad state %d\n", __func__, task->state);
 		return;
 	}
 
@@ -105,7 +105,7 @@ void rxe_do_task(unsigned long data)
 			break;
 
 		default:
-			pr_warn("bad state = %d in rxe_do_task\n",
+			pr_warn("%s failed with bad state %d\n", __func__,
 				task->state);
 		}
 		spin_unlock_irqrestore(&task->state_lock, flags);
drivers/infiniband/sw/rxe/rxe_verbs.c +3 -3
index 92156025db73..a65a330b15b6 100644
@@ -1336,15 +1336,15 @@ int rxe_register_device(struct rxe_dev *rxe)
 
 	err = ib_register_device(dev, NULL);
 	if (err) {
-		pr_warn("rxe_register_device failed, err = %d\n", err);
+		pr_warn("%s failed with error %d\n", __func__, err);
 		goto err1;
 	}
 
 	for (i = 0; i < ARRAY_SIZE(rxe_dev_attributes); ++i) {
 		err = device_create_file(&dev->dev, rxe_dev_attributes[i]);
 		if (err) {
-			pr_warn("device_create_file failed, i = %d, err = %d\n",
-				i, err);
+			pr_warn("%s failed with error %d for attr number %d\n",
+				__func__, err, i);
 			goto err2;
 		}
 	}
Signature · 6 lines
2.12.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20170615082907.5658-5-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#7 lore raw

Re: [PATCH rdma-next 4/5] IB/rxe: Use __func__ to print function's name

Quoted 44 lines · Leon Romanovsky

From: Kamal Heib <[email protected]>

Its better to use __func__ to print functions name instead of writing the name in the print statement.

---
 drivers/infiniband/sw/rxe/rxe_task.c  | 4 ++--
 drivers/infiniband/sw/rxe/rxe_verbs.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/infiniband/sw/rxe/rxe_task.c +2 -2
index d2a14a1bdc7f..ea3810b29273 100644
@@ -78,7 +78,7 @@ void rxe_do_task(unsigned long data)
 
 	default:
 		spin_unlock_irqrestore(&task->state_lock, flags);
-		pr_warn("bad state = %d in rxe_do_task\n", task->state);
+		pr_warn("%s failed with bad state %d\n", __func__, task->state);
 		return;
 	}
 
@@ -105,7 +105,7 @@ void rxe_do_task(unsigned long data)
 			break;
 
 		default:
-			pr_warn("bad state = %d in rxe_do_task\n",
+			pr_warn("%s failed with bad state %d\n", __func__,
 				task->state);
 		}
 		spin_unlock_irqrestore(&task->state_lock, flags);
drivers/infiniband/sw/rxe/rxe_verbs.c +1 -1
index 92156025db73..a65a330b15b6 100644
@@ -1336,15 +1336,15 @@ int rxe_register_device(struct rxe_dev *rxe)
 
 	err = ib_register_device(dev, NULL);
 	if (err) {
-		pr_warn("rxe_register_device failed, err = %d\n", err);
+		pr_warn("%s failed with error %d\n", __func__, err);

drivers/infiniband/sw/rxe/rxe_verbs.c int rxe_register_device(struct rxe_dev *rxe) · line 1347

Quoted 10 lines
drivers/infiniband/sw/rxe/rxe_verbs.c +2 -2
 		goto err1;
 	}
 
 	for (i = 0; i < ARRAY_SIZE(rxe_dev_attributes); ++i) {
 		err = device_create_file(&dev->dev, rxe_dev_attributes[i]);
 		if (err) {
-			pr_warn("device_create_file failed, i = %d, err = %d\n",
-				i, err);
+			pr_warn("%s failed with error %d for attr number %d\n",
+				__func__, err, i);

Before this fix the warn shows the call which fails (device_create_file) and now it will show the caller (rxe_register_device).
Hope it is still fine with you.

Quoted 10 lines
drivers/infiniband/sw/rxe/rxe_verbs.c +0 -0
 			goto err2;
 		}
 	}
Signature · 6 lines
2.12.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw

Re: [PATCH rdma-next 4/5] IB/rxe: Use __func__ to print function's name

Quoted 48 lines · Yuval Shaia
Quoted 47 lines · Leon Romanovsky

From: Kamal Heib <[email protected]>

Its better to use __func__ to print functions name instead of writing the name in the print statement.

---
 drivers/infiniband/sw/rxe/rxe_task.c  | 4 ++--
 drivers/infiniband/sw/rxe/rxe_verbs.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/infiniband/sw/rxe/rxe_task.c +2 -2
index d2a14a1bdc7f..ea3810b29273 100644
@@ -78,7 +78,7 @@ void rxe_do_task(unsigned long data)
 
 	default:
 		spin_unlock_irqrestore(&task->state_lock, flags);
-		pr_warn("bad state = %d in rxe_do_task\n", task->state);
+		pr_warn("%s failed with bad state %d\n", __func__, task->state);
 		return;
 	}
 
@@ -105,7 +105,7 @@ void rxe_do_task(unsigned long data)
 			break;
 
 		default:
-			pr_warn("bad state = %d in rxe_do_task\n",
+			pr_warn("%s failed with bad state %d\n", __func__,
 				task->state);
 		}
 		spin_unlock_irqrestore(&task->state_lock, flags);
drivers/infiniband/sw/rxe/rxe_verbs.c +1 -1
index 92156025db73..a65a330b15b6 100644
@@ -1336,15 +1336,15 @@ int rxe_register_device(struct rxe_dev *rxe)
 
 	err = ib_register_device(dev, NULL);
 	if (err) {
-		pr_warn("rxe_register_device failed, err = %d\n", err);
+		pr_warn("%s failed with error %d\n", __func__, err);
 		goto err1;
 	}
 
Quoted 11 lines

drivers/infiniband/sw/rxe/rxe_verbs.c int rxe_register_device(struct rxe_dev *rxe) · line 1347

Quoted 7 lines
drivers/infiniband/sw/rxe/rxe_verbs.c +2 -2
 	for (i = 0; i < ARRAY_SIZE(rxe_dev_attributes); ++i) {
 		err = device_create_file(&dev->dev, rxe_dev_attributes[i]);
 		if (err) {
-			pr_warn("device_create_file failed, i = %d, err = %d\n",
-				i, err);
+			pr_warn("%s failed with error %d for attr number %d\n",
+				__func__, err, i);

Before this fix the warn shows the call which fails (device_create_file) and now it will show the caller (rxe_register_device).
Hope it is still fine with you.

This warning is unique to this function, so it will be much easier to find the root cause. Instead of unknown place for "device_create_file failed", the user can go directly to rxe_register_device) and see the reason of the failure.

So, it is fine and it is intentionally :)

Thanks

Quoted 11 lines
Quoted 11 lines
drivers/infiniband/sw/rxe/rxe_verbs.c +0 -1
 			goto err2;
 		}
 	}
--

2.12.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw

PATCH 5/5 IB/rxe: Constify static rxe_vm_ops

In reply to a message not in the archive

From: Kamal Heib <[email protected]>

Constify static rxe_vm_ops that is never modified.

---
 drivers/infiniband/sw/rxe/rxe_mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_mmap.c +1 -1
index bd812e00988e..d22431e3a908 100644
@@ -76,7 +76,7 @@ static void rxe_vma_close(struct vm_area_struct *vma)
 	kref_put(&ip->ref, rxe_mmap_release);
 }
 
-static struct vm_operations_struct rxe_vm_ops = {
+static const struct vm_operations_struct rxe_vm_ops = {
 	.open = rxe_vma_open,
 	.close = rxe_vma_close,
 };
Signature · 6 lines
2.12.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reviewed-by
#10 lore raw
In reply to a message not in the archive
Quoted 10 lines · Leon Romanovsky

This patchset from Kamal cleanups some of the warnings and errors that he got from applying checkpatch.pl script on RXE files.

Kamal Heib (5):
IB/rxe: Use "foo *bar" instead of "foo * bar" IB/rxe: Prefer 'unsigned int' to bare use of 'unsigned' IB/rxe: Use DEVICE_ATTR_RO macro to show parent field IB/rxe: Use __func__ to print function's name IB/rxe: Constify static rxe_vm_ops

Besides some minor comment for #4.

Quoted 10 lines
 drivers/infiniband/sw/rxe/rxe.h       |  2 +-
 drivers/infiniband/sw/rxe/rxe_loc.h   |  2 +-
 drivers/infiniband/sw/rxe/rxe_mmap.c  |  2 +-
 drivers/infiniband/sw/rxe/rxe_pool.c  |  2 +-
 drivers/infiniband/sw/rxe/rxe_req.c   |  2 +-
 drivers/infiniband/sw/rxe/rxe_task.c  |  4 ++--
 drivers/infiniband/sw/rxe/rxe_verbs.c | 12 ++++++------
 7 files changed, 13 insertions(+), 13 deletions(-)
Quoted 7 lines

--
2.12.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw
In reply to a message not in the archive
Quoted 11 lines · Leon Romanovsky

This patchset from Kamal cleanups some of the warnings and errors that he got from applying checkpatch.pl script on RXE files.

Kamal Heib (5):
IB/rxe: Use "foo *bar" instead of "foo * bar" IB/rxe: Prefer 'unsigned int' to bare use of 'unsigned' IB/rxe: Use DEVICE_ATTR_RO macro to show parent field IB/rxe: Use __func__ to print function's name IB/rxe: Constify static rxe_vm_ops

Quoted 8 lines
 drivers/infiniband/sw/rxe/rxe.h       |  2 +-
 drivers/infiniband/sw/rxe/rxe_loc.h   |  2 +-
 drivers/infiniband/sw/rxe/rxe_mmap.c  |  2 +-
 drivers/infiniband/sw/rxe/rxe_pool.c  |  2 +-
 drivers/infiniband/sw/rxe/rxe_req.c   |  2 +-
 drivers/infiniband/sw/rxe/rxe_task.c  |  4 ++--
 drivers/infiniband/sw/rxe/rxe_verbs.c | 12 ++++++------
 7 files changed, 13 insertions(+), 13 deletions(-)

Series applied, thanks.

Signature · 8 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html