All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 -next] mlx5: use DEFINE_MUTEX() for mutex lock
@ 2020-12-24 13:23 Zheng Yongjun
  2020-12-27  5:58 ` Leon Romanovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Zheng Yongjun @ 2020-12-24 13:23 UTC (permalink / raw)
  To: linux-rdma, linux-kernel; +Cc: leon, dledford, jgg, Zheng Yongjun

mutex lock can be initialized automatically with DEFINE_MUTEX()
rather than explicitly calling mutex_init().

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
 drivers/infiniband/hw/mlx5/main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 246e3cbe0b2c..8a260773722f 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -79,7 +79,7 @@ static DEFINE_MUTEX(mlx5_ib_multiport_mutex);
  * doesn't work on kernel modules memory
  */
 static unsigned long xlt_emergency_page;
-static struct mutex xlt_emergency_page_mutex;
+static DEFINE_MUTEX(xlt_emergency_page_mutex);
 
 struct mlx5_ib_dev *mlx5_ib_get_ibdev_from_mpi(struct mlx5_ib_multiport_info *mpi)
 {
@@ -4874,8 +4874,6 @@ static int __init mlx5_ib_init(void)
 	if (!xlt_emergency_page)
 		return -ENOMEM;
 
-	mutex_init(&xlt_emergency_page_mutex);
-
 	mlx5_ib_event_wq = alloc_ordered_workqueue("mlx5_ib_event_wq", 0);
 	if (!mlx5_ib_event_wq) {
 		free_page(xlt_emergency_page);
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 -next] mlx5: use DEFINE_MUTEX() for mutex lock
  2020-12-24 13:23 [PATCH v2 -next] mlx5: use DEFINE_MUTEX() for mutex lock Zheng Yongjun
@ 2020-12-27  5:58 ` Leon Romanovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2020-12-27  5:58 UTC (permalink / raw)
  To: Zheng Yongjun; +Cc: linux-rdma, linux-kernel, dledford, jgg

On Thu, Dec 24, 2020 at 09:23:23PM +0800, Zheng Yongjun wrote:
> mutex lock can be initialized automatically with DEFINE_MUTEX()
> rather than explicitly calling mutex_init().
>
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
> ---
>  drivers/infiniband/hw/mlx5/main.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

As I wrote earlier, this patch can't be applied, because the xlt_emergency_page_mutex
mutex was moved in the commit f22c30aa6d27 ("RDMA/mlx5: Move xlt_emergency_page_mutex into mr.c")

Thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-27  5:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-24 13:23 [PATCH v2 -next] mlx5: use DEFINE_MUTEX() for mutex lock Zheng Yongjun
2020-12-27  5:58 ` Leon Romanovsky

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.