Uninterruptible context is not needed in the driver and causes lockdep
warning because of mutex taken in of_alias_get_id(). Convert the lock to
mutex to avoid the issue.
Cc: sta...@vger.kernel.org
Signed-off-by: Michał Mirosław
---
drivers/misc/atmel-ssc.c | 24
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index 1322e29bc37a..5cc032097476 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -10,7 +10,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -20,7 +20,7 @@
#include "../../sound/soc/atmel/atmel_ssc_dai.h"
/* Serialize access to ssc_list and user count */
-static DEFINE_SPINLOCK(user_lock);
+static DEFINE_MUTEX(user_lock);
static LIST_HEAD(ssc_list);
struct ssc_device *ssc_request(unsigned int ssc_num)
@@ -28,7 +28,7 @@ struct ssc_device *ssc_request(unsigned int ssc_num)
int ssc_valid = 0;
struct ssc_device *ssc;
- spin_lock(_lock);
+ mutex_lock(_lock);
list_for_each_entry(ssc, _list, list) {
if (ssc->pdev->dev.of_node) {
if (of_alias_get_id(ssc->pdev->dev.of_node, "ssc")
@@ -44,18 +44,18 @@ struct ssc_device *ssc_request(unsigned int ssc_num)
}
if (!ssc_valid) {
- spin_unlock(_lock);
+ mutex_unlock(_lock);
pr_err("ssc: ssc%d platform device is missing\n", ssc_num);
return ERR_PTR(-ENODEV);
}
if (ssc->user) {
- spin_unlock(_lock);
+ mutex_unlock(_lock);
dev_dbg(>pdev->dev, "module busy\n");
return ERR_PTR(-EBUSY);
}
ssc->user++;
- spin_unlock(_lock);
+ mutex_unlock(_lock);
clk_prepare(ssc->clk);
@@ -67,14 +67,14 @@ void ssc_free(struct ssc_device *ssc)
{
bool disable_clk = true;
- spin_lock(_lock);
+ mutex_lock(_lock);
if (ssc->user)
ssc->user--;
else {
disable_clk = false;
dev_dbg(>pdev->dev, "device already free\n");
}
- spin_unlock(_lock);
+ mutex_unlock(_lock);
if (disable_clk)
clk_unprepare(ssc->clk);
@@ -246,9 +246,9 @@ static int ssc_probe(struct platform_device *pdev)
return -ENXIO;
}
- spin_lock(_lock);
+ mutex_lock(_lock);
list_add_tail(>list, _list);
- spin_unlock(_lock);
+ mutex_unlock(_lock);
platform_set_drvdata(pdev, ssc);
@@ -267,9 +267,9 @@ static int ssc_remove(struct platform_device *pdev)
ssc_sound_dai_remove(ssc);
- spin_lock(_lock);
+ mutex_lock(_lock);
list_del(>list);
- spin_unlock(_lock);
+ mutex_unlock(_lock);
return 0;
}
--
2.20.1