[PATCH 2/2] nvmet: remove workarounds for gcc bug wrt unnamed fields in initializers
From: Niklas Cassel
Date: Thu Jun 18 2020 - 10:33:11 EST
Workarounds for gcc issues with initializers and anon unions was first
introduced in commit e44ac588cd61 ("drivers/block/nvme-core.c: fix build
with gcc-4.4.4").
The gcc bug in question has been fixed since gcc 4.6.0:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676
The minimum gcc version for building the kernel has been 4.6.0 since
commit cafa0010cd51 ("Raise the minimum required gcc version to 4.6"),
and has since been updated to gcc 4.8.0 in
commit 5429ef62bcf3 ("compiler/gcc: Raise minimum GCC version for
kernel builds to 4.8").
For that reason, it should now be safe to remove these workarounds
and make the code look like it did before
commit e44ac588cd61 ("drivers/block/nvme-core.c: fix build with gcc-4.4.4")
was introduced.
Signed-off-by: Niklas Cassel <niklas.cassel@xxxxxxx>
---
If, for some reason, we want to allow builds with gcc < 4.6.0
even though the minimum gcc version is now 4.8.0,
there is another less intrusive workaround where you add an extra pair of
curly braces, see e.g. commit 6cc65be4f6f2 ("locking/qspinlock: Fix build
for anonymous union in older GCC compilers").
drivers/nvme/target/rdma.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 6731e0349480..85c6ff0b0e44 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -1535,19 +1535,20 @@ static int nvmet_rdma_cm_accept(struct rdma_cm_id *cm_id,
struct nvmet_rdma_queue *queue,
struct rdma_conn_param *p)
{
- struct rdma_conn_param param = { };
- struct nvme_rdma_cm_rep priv = { };
+ struct rdma_conn_param param = {
+ .rnr_retry_count = 7,
+ .flow_control = 1,
+ .initiator_depth = min_t(u8, p->initiator_depth,
+ queue->dev->device->attrs.max_qp_init_rd_atom),
+ .private_data = &priv,
+ .private_data_len = sizeof(priv),
+ };
+ struct nvme_rdma_cm_rep priv = {
+ .recfmt = cpu_to_le16(NVME_RDMA_CM_FMT_1_0),
+ .crqsize = cpu_to_le16(queue->recv_queue_size),
+ };
int ret = -ENOMEM;
- param.rnr_retry_count = 7;
- param.flow_control = 1;
- param.initiator_depth = min_t(u8, p->initiator_depth,
- queue->dev->device->attrs.max_qp_init_rd_atom);
- param.private_data = &priv;
- param.private_data_len = sizeof(priv);
- priv.recfmt = cpu_to_le16(NVME_RDMA_CM_FMT_1_0);
- priv.crqsize = cpu_to_le16(queue->recv_queue_size);
-
ret = rdma_accept(cm_id, ¶m);
if (ret)
pr_err("rdma_accept failed (error code = %d)\n", ret);
--
2.26.2