Skip to contentSkip to conversation

IB/isert: remove unneeded new lines

PATCH In review Max Gurtovoy 4 participants 14 messages Jan 10, 2021 – Jan 18, 2021

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

PATCH 1/3 IB/isert: remove unneeded new lines

The Linux convention is to have only 1 new line between functions.

---
 drivers/infiniband/ulp/isert/ib_isert.c | 2 --
 1 file changed, 2 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +0 -2
index 2ba27221ea85..5958929b7dec 100644
@@ -71,7 +71,6 @@ static int isert_sg_tablesize_set(const char *val, const struct kernel_param *kp
 	return param_set_int(val, kp);
 }
 
-
 static inline bool
 isert_prot_cmd(struct isert_conn *conn, struct se_cmd *cmd)
 {
@@ -79,7 +78,6 @@ isert_prot_cmd(struct isert_conn *conn, struct se_cmd *cmd)
 		cmd->prot_op != TARGET_PROT_NORMAL);
 }
 
-
 static void
 isert_qp_event_callback(struct ib_event *e, void *context)
 {
Signature · 1 line
2.25.4
#1 lore raw

PATCH 2/3 IB/isert: remove unneeded semicolon

No need to add semicolon after closing bracket.

---
 drivers/infiniband/ulp/isert/ib_isert.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/isert/ib_isert.c +1 -1
index 5958929b7dec..96514f675427 100644
@@ -1991,7 +1991,7 @@ isert_set_dif_domain(struct se_cmd *se_cmd, struct ib_sig_domain *domain)
 	if (se_cmd->prot_type == TARGET_DIF_TYPE1_PROT ||
 	    se_cmd->prot_type == TARGET_DIF_TYPE2_PROT)
 		domain->sig.dif.ref_remap = true;
-};
+}
 
 static int
 isert_set_sig_attrs(struct se_cmd *se_cmd, struct ib_sig_attrs *sig_attrs)
Signature · 1 line
2.25.4
maintainer
#2 lore raw

Re: [PATCH 2/3] IB/isert: remove unneeded semicolon

Quoted 13 lines · Max Gurtovoy

No need to add semicolon after closing bracket.

---
 drivers/infiniband/ulp/isert/ib_isert.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/isert/ib_isert.c +0 -0
index 5958929b7dec..96514f675427 100644

drivers/infiniband/ulp/isert/ib_isert.c isert_set_dif_domain(struct se_cmd *se_cmd, struct ib_sig_domain *domain) · line 1994

Quoted 5 lines
drivers/infiniband/ulp/isert/ib_isert.c +1 -1
@@ -1991,7 +1991,7 @@ isert_set_dif_domain(struct se_cmd *se_cmd, struct ib_sig_domain *domain)
 	if (se_cmd->prot_type == TARGET_DIF_TYPE1_PROT ||
 	    se_cmd->prot_type == TARGET_DIF_TYPE2_PROT)
 		domain->sig.dif.ref_remap = true;
-};
+}

The same goes for iser_set_dif_domain() and iser_cleanup_handler().

Thanks

Quoted 6 lines
drivers/infiniband/ulp/isert/ib_isert.c +0 -1
 static int
 isert_set_sig_attrs(struct se_cmd *se_cmd, struct ib_sig_attrs *sig_attrs)
--

2.25.4

#3 lore raw

Re: [PATCH 2/3] IB/isert: remove unneeded semicolon

Quoted 9 lines · Leon Romanovsky
Quoted 8 lines · Max Gurtovoy

No need to add semicolon after closing bracket.

---
  drivers/infiniband/ulp/isert/ib_isert.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 11 lines

drivers/infiniband/ulp/isert/ib_isert.c isert_set_dif_domain(struct se_cmd *se_cmd, struct ib_sig_domain *domain) · line 1994

Quoted 10 lines
drivers/infiniband/ulp/isert/ib_isert.c +1 -1
index 5958929b7dec..96514f675427 100644
@@ -1991,7 +1991,7 @@ isert_set_dif_domain(struct se_cmd *se_cmd, struct ib_sig_domain *domain)
  	if (se_cmd->prot_type == TARGET_DIF_TYPE1_PROT ||
  	    se_cmd->prot_type == TARGET_DIF_TYPE2_PROT)
  		domain->sig.dif.ref_remap = true;
-};
+}

The same goes for iser_set_dif_domain() and iser_cleanup_handler().

Good catch, I'll send iSER fixes in different series.

This series is for minor fixes for iSERT.

Quoted 8 lines

Thanks

Quoted 5 lines
drivers/infiniband/ulp/isert/ib_isert.c +0 -1
  static int
  isert_set_sig_attrs(struct se_cmd *se_cmd, struct ib_sig_attrs *sig_attrs)
--

2.25.4

#5 lore raw

PATCH 3/3 IB/isert: simplify signature cap check

In reply to Max Gurtovoy

Use if/else clause instead of "condition ? val1 : val2" to make the code cleaner and simpler.

---
 drivers/infiniband/ulp/isert/ib_isert.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +4 -2
index 96514f675427..7305ed8976c2 100644
@@ -230,8 +230,10 @@ isert_create_device_ib_res(struct isert_device *device)
 	}
 
 	/* Check signature cap */
-	device->pi_capable = ib_dev->attrs.device_cap_flags &
-			     IB_DEVICE_INTEGRITY_HANDOVER ? true : false;
+	if (ib_dev->attrs.device_cap_flags & IB_DEVICE_INTEGRITY_HANDOVER)
+		device->pi_capable = true;
+	else
+		device->pi_capable = false;
 
 	return 0;
 }
Signature · 1 line
2.25.4
maintainer Acked-by on v1 3/3
#6 lore raw

Re: [PATCH 3/3] IB/isert: simplify signature cap check

Quoted 3 lines

Use if/else clause instead of "condition ? val1 : val2" to make the code cleaner and simpler.

Not sure what is cleaner and simpler for a simple condition, but I don't mind either way...

maintainer
#7 lore raw

Re: [PATCH 3/3] IB/isert: simplify signature cap check

Quoted 6 lines · Sagi Grimberg
Quoted 3 lines

Use if/else clause instead of "condition ? val1 : val2" to make the code cleaner and simpler.

Not sure what is cleaner and simpler for a simple condition, but I don't mind either way...

Agree, probably even more cleaner variant will be:
device->pi_capable = !!(ib_dev->attrs.device_cap_flags & IB_DEVICE_INTEGRITY_HANDOVER);

Thanks

maintainer
#8 lore raw

Re: [PATCH 3/3] IB/isert: simplify signature cap check

Quoted 10 lines · Leon Romanovsky
Quoted 6 lines · Sagi Grimberg
Quoted 3 lines

Use if/else clause instead of "condition ? val1 : val2" to make the code cleaner and simpler.

Not sure what is cleaner and simpler for a simple condition, but I don't mind either way...

Agree, probably even more cleaner variant will be:
device->pi_capable = !!(ib_dev->attrs.device_cap_flags & IB_DEVICE_INTEGRITY_HANDOVER);

Gah, !! is rarely a sign of something good..

Jason

#9 lore raw

Re: [PATCH 3/3] IB/isert: simplify signature cap check

Quoted 9 lines · Jason Gunthorpe
Quoted 7 lines · Leon Romanovsky
Quoted 4 lines · Sagi Grimberg
Quoted 2 lines

Use if/else clause instead of "condition ? val1 : val2" to make the code cleaner and simpler.

Not sure what is cleaner and simpler for a simple condition, but I don't mind either way...

Agree, probably even more cleaner variant will be:
device->pi_capable = !!(ib_dev->attrs.device_cap_flags & IB_DEVICE_INTEGRITY_HANDOVER);

Gah, !! is rarely a sign of something good..

can we take the series as-is ?

We have enough Acks and eyes on these minor cleanups.

Quoted 2 lines

Jason

maintainer
#10 lore raw

Re: [PATCH 3/3] IB/isert: simplify signature cap check

Quoted 6 lines · Max Gurtovoy
Quoted 4 lines · Jason Gunthorpe
Quoted 3 lines · Leon Romanovsky
Quoted 2 lines · Sagi Grimberg
Quoted 2 lines

Use if/else clause instead of "condition ? val1 : val2" to make the code cleaner and simpler.

Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

Not sure what is cleaner and simpler for a simple condition, but I don't mind either way...

Agree, probably even more cleaner variant will be:
device->pi_capable = !!(ib_dev->attrs.device_cap_flags & IB_DEVICE_INTEGRITY_HANDOVER);

Gah, !! is rarely a sign of something good..

can we take the series as-is ?

Of course :)

Thanks

maintainer
#11 lore raw

Re: [PATCH 3/3] IB/isert: simplify signature cap check

In reply to Jason Gunthorpe
Quoted 6 lines · Jason Gunthorpe
Quoted 5 lines · Leon Romanovsky
Quoted 4 lines · Sagi Grimberg
Quoted 3 lines

Use if/else clause instead of "condition ? val1 : val2" to make the code cleaner and simpler.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Not sure what is cleaner and simpler for a simple condition, but I don't mind either way...

Agree, probably even more cleaner variant will be:
device->pi_capable = !!(ib_dev->attrs.device_cap_flags & IB_DEVICE_INTEGRITY_HANDOVER);

Gah, !! is rarely a sign of something good..

You see, three of us see same code differently.

Quoted 2 lines

Jason