|
@@ -141,10 +141,18 @@ static unsigned long clk_enable_lock(void)
|
|
|
{
|
|
|
unsigned long flags;
|
|
|
|
|
|
- if (!spin_trylock_irqsave(&enable_lock, flags)) {
|
|
|
+ /*
|
|
|
+ * On UP systems, spin_trylock_irqsave() always returns true, even if
|
|
|
+ * we already hold the lock. So, in that case, we rely only on
|
|
|
+ * reference counting.
|
|
|
+ */
|
|
|
+ if (!IS_ENABLED(CONFIG_SMP) ||
|
|
|
+ !spin_trylock_irqsave(&enable_lock, flags)) {
|
|
|
if (enable_owner == current) {
|
|
|
enable_refcnt++;
|
|
|
__acquire(enable_lock);
|
|
|
+ if (!IS_ENABLED(CONFIG_SMP))
|
|
|
+ local_save_flags(flags);
|
|
|
return flags;
|
|
|
}
|
|
|
spin_lock_irqsave(&enable_lock, flags);
|