hwspinlock: stm32: implement the relax() ops
authorFabien Dessenne <fabien.dessenne@st.com>
Thu, 7 Mar 2019 15:42:16 +0000 (16:42 +0100)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Sun, 30 Jun 2019 04:04:24 +0000 (21:04 -0700)
Implement this optional ops, called by hwspinlock core while spinning on
a lock, between two successive invocations of trylock().

Reviewed-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/hwspinlock/stm32_hwspinlock.c

index 4418392..c8eacf4 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 #include <linux/clk.h>
+#include <linux/delay.h>
 #include <linux/hwspinlock.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
@@ -42,9 +43,15 @@ static void stm32_hwspinlock_unlock(struct hwspinlock *lock)
        writel(STM32_MUTEX_COREID, lock_addr);
 }
 
+static void stm32_hwspinlock_relax(struct hwspinlock *lock)
+{
+       ndelay(50);
+}
+
 static const struct hwspinlock_ops stm32_hwspinlock_ops = {
        .trylock        = stm32_hwspinlock_trylock,
        .unlock         = stm32_hwspinlock_unlock,
+       .relax          = stm32_hwspinlock_relax,
 };
 
 static int stm32_hwspinlock_probe(struct platform_device *pdev)