Commit e6862430 authored by Axel Lin's avatar Axel Lin Committed by Bartosz Golaszewski
Browse files

gpio: mlxbf2: Fix sleeping while holding spinlock



mutex_lock() can sleep, don't call mutex_lock() while holding spin_lock.

Fixes: bc0ae0e7 ("gpio: add driver for Mellanox BlueField 2 GPIO controller")
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Acked-by: default avatar <asmaa@mellanox.com>
Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
parent e75dfba3
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -127,8 +127,8 @@ static int mlxbf2_gpio_lock_acquire(struct mlxbf2_gpio_context *gs)
{
	u32 arm_gpio_lock_val;

	spin_lock(&gs->gc.bgpio_lock);
	mutex_lock(yu_arm_gpio_lock_param.lock);
	spin_lock(&gs->gc.bgpio_lock);

	arm_gpio_lock_val = readl(yu_arm_gpio_lock_param.io);

@@ -136,8 +136,8 @@ static int mlxbf2_gpio_lock_acquire(struct mlxbf2_gpio_context *gs)
	 * When lock active bit[31] is set, ModeX is write enabled
	 */
	if (YU_LOCK_ACTIVE_BIT(arm_gpio_lock_val)) {
		mutex_unlock(yu_arm_gpio_lock_param.lock);
		spin_unlock(&gs->gc.bgpio_lock);
		mutex_unlock(yu_arm_gpio_lock_param.lock);
		return -EINVAL;
	}

@@ -152,8 +152,8 @@ static int mlxbf2_gpio_lock_acquire(struct mlxbf2_gpio_context *gs)
static void mlxbf2_gpio_lock_release(struct mlxbf2_gpio_context *gs)
{
	writel(YU_ARM_GPIO_LOCK_RELEASE, yu_arm_gpio_lock_param.io);
	mutex_unlock(yu_arm_gpio_lock_param.lock);
	spin_unlock(&gs->gc.bgpio_lock);
	mutex_unlock(yu_arm_gpio_lock_param.lock);
}

/*