diff options
author | Alan Cox <alan@linux.intel.com> | 2011-07-05 15:45:13 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-07-05 08:20:45 -0700 |
commit | 9fdc5ff8b9082150a12d11c3a0ea429429bb8456 (patch) | |
tree | 91b7c71a6d21a4ea866b6fd68950bcfc7ffd8780 /drivers/staging/gma500 | |
parent | 398c44248984a18876059724519f87c79b859deb (diff) | |
download | blackbird-op-linux-9fdc5ff8b9082150a12d11c3a0ea429429bb8456.tar.gz blackbird-op-linux-9fdc5ff8b9082150a12d11c3a0ea429429bb8456.zip |
gma500: power can be touched in IRQ state
So we need to use a spinlock here
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/gma500')
-rw-r--r-- | drivers/staging/gma500/power.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/staging/gma500/power.c b/drivers/staging/gma500/power.c index 79eb6703a51b..5cd502306637 100644 --- a/drivers/staging/gma500/power.c +++ b/drivers/staging/gma500/power.c @@ -36,7 +36,7 @@ #include <linux/pm_runtime.h> static struct mutex power_mutex; /* Serialize power ops */ -static struct mutex power_ctrl_mutex; /* Serialize power claim */ +static spinlock_t power_ctrl_lock; /* Serialize power claim */ /** * gma_power_init - initialise power manager @@ -55,8 +55,8 @@ void gma_power_init(struct drm_device *dev) dev_priv->display_power = true; /* We start active */ dev_priv->display_count = 0; /* Currently no users */ dev_priv->suspended = false; /* And not suspended */ + spin_lock_init(&power_ctrl_lock); mutex_init(&power_mutex); - mutex_init(&power_ctrl_mutex); dev_priv->ops->init_pm(dev); } @@ -247,13 +247,14 @@ bool gma_power_begin(struct drm_device *dev, bool force_on) { struct drm_psb_private *dev_priv = dev->dev_private; int ret; + unsigned long flags; - mutex_lock(&power_ctrl_mutex); + spin_lock_irqsave(&power_ctrl_lock, flags); /* Power already on ? */ if (dev_priv->display_power) { dev_priv->display_count++; pm_runtime_get(&dev->pdev->dev); - mutex_unlock(&power_ctrl_mutex); + spin_unlock_irqrestore(&power_ctrl_lock, flags); return true; } if (force_on == false) @@ -266,11 +267,11 @@ bool gma_power_begin(struct drm_device *dev, bool force_on) psb_irq_postinstall(dev); pm_runtime_get(&dev->pdev->dev); dev_priv->display_count++; - mutex_unlock(&power_ctrl_mutex); + spin_unlock_irqrestore(&power_ctrl_lock, flags); return true; } out_false: - mutex_unlock(&power_ctrl_mutex); + spin_unlock_irqrestore(&power_ctrl_lock, flags); return false; } @@ -284,10 +285,11 @@ out_false: void gma_power_end(struct drm_device *dev) { struct drm_psb_private *dev_priv = dev->dev_private; - mutex_lock(&power_ctrl_mutex); + unsigned long flags; + spin_lock_irqsave(&power_ctrl_lock, flags); dev_priv->display_count--; WARN_ON(dev_priv->display_count < 0); - mutex_unlock(&power_ctrl_mutex); + spin_unlock_irqrestore(&power_ctrl_lock, flags); pm_runtime_put(&dev->pdev->dev); } |