All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Doug Ledford <dledford@redhat.com>, Jason Gunthorpe <jgg@mellanox.com>
Cc: Leon Romanovsky <leonro@mellanox.com>,
	RDMA mailing list <linux-rdma@vger.kernel.org>,
	Erez Alfasi <ereza@mellanox.com>,
	Parav Pandit <parav@mellanox.com>
Subject: [PATCH rdma-next 4/4] IB/cm: Use container_of() instead of typecast
Date: Wed,  2 Oct 2019 15:25:17 +0300	[thread overview]
Message-ID: <20191002122517.17721-5-leon@kernel.org> (raw)
In-Reply-To: <20191002122517.17721-1-leon@kernel.org>

From: Parav Pandit <parav@mellanox.com>

Use container_of() macro to get to timewait info structure instead of
typecasting.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/cm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index da10e6ccb43c..c0aa3a4b4cfd 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -246,7 +246,7 @@ struct cm_work {
 };
 
 struct cm_timewait_info {
-	struct cm_work work;			/* Must be first. */
+	struct cm_work work;
 	struct list_head list;
 	struct rb_node remote_qp_node;
 	struct rb_node remote_id_node;
@@ -3434,7 +3434,7 @@ static int cm_timewait_handler(struct cm_work *work)
 	struct cm_id_private *cm_id_priv;
 	int ret;
 
-	timewait_info = (struct cm_timewait_info *)work;
+	timewait_info = container_of(work, struct cm_timewait_info, work);
 	spin_lock_irq(&cm.lock);
 	list_del(&timewait_info->list);
 	spin_unlock_irq(&cm.lock);
-- 
2.20.1


  parent reply	other threads:[~2019-10-02 12:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 12:25 [PATCH rdma-next 0/4] Unrelated code cleanups Leon Romanovsky
2019-10-02 12:25 ` [PATCH rdma-next 1/4] RDMA/mlx5: Group boolean parameters to take less space Leon Romanovsky
2019-10-02 12:25 ` [PATCH rdma-next 2/4] IB/mlx5: Remove unnecessary return statement Leon Romanovsky
2019-10-02 12:25 ` [PATCH rdma-next 3/4] IB/mlx5: Remove unnecessary else statement Leon Romanovsky
2019-10-02 12:25 ` Leon Romanovsky [this message]
2019-10-04 18:49 ` [PATCH rdma-next 0/4] Unrelated code cleanups Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191002122517.17721-5-leon@kernel.org \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=ereza@mellanox.com \
    --cc=jgg@mellanox.com \
    --cc=leonro@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=parav@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.