diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-08-09 16:33:58 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-08-12 05:28:49 -0400 |
commit | 20d5a540e55a29daeef12706f9ee73baf5641c16 (patch) | |
tree | 71d1ba4e14dd164ef8b9ad5888b630868df35ca5 | |
parent | 126e9be816e7c0322f5dac994f94d65a8fabcc56 (diff) |
drm/i915: don't grab dev->struct_mutex for userspace forcewak
Since forcewake is now protected by a spinlock, we don't need to grab
dev->struct_mutex any more. This way we can also get rid of a stale
comment, noticed by Ben Widawsky while reviewing some locking changes.
v2: Kill the unused variable ret, noticed by Fengguang Wu.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/i915_debugfs.c | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 0e8f14d04cda..a18e93687b8b 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -1956,16 +1956,11 @@ static int i915_forcewake_open(struct inode *inode, struct file *file) | |||
1956 | { | 1956 | { |
1957 | struct drm_device *dev = inode->i_private; | 1957 | struct drm_device *dev = inode->i_private; |
1958 | struct drm_i915_private *dev_priv = dev->dev_private; | 1958 | struct drm_i915_private *dev_priv = dev->dev_private; |
1959 | int ret; | ||
1960 | 1959 | ||
1961 | if (INTEL_INFO(dev)->gen < 6) | 1960 | if (INTEL_INFO(dev)->gen < 6) |
1962 | return 0; | 1961 | return 0; |
1963 | 1962 | ||
1964 | ret = mutex_lock_interruptible(&dev->struct_mutex); | ||
1965 | if (ret) | ||
1966 | return ret; | ||
1967 | gen6_gt_force_wake_get(dev_priv); | 1963 | gen6_gt_force_wake_get(dev_priv); |
1968 | mutex_unlock(&dev->struct_mutex); | ||
1969 | 1964 | ||
1970 | return 0; | 1965 | return 0; |
1971 | } | 1966 | } |
@@ -1974,24 +1969,11 @@ static int i915_forcewake_release(struct inode *inode, struct file *file) | |||
1974 | { | 1969 | { |
1975 | struct drm_device *dev = inode->i_private; | 1970 | struct drm_device *dev = inode->i_private; |
1976 | struct drm_i915_private *dev_priv = dev->dev_private; | 1971 | struct drm_i915_private *dev_priv = dev->dev_private; |
1977 | int ret; | ||
1978 | 1972 | ||
1979 | if (INTEL_INFO(dev)->gen < 6) | 1973 | if (INTEL_INFO(dev)->gen < 6) |
1980 | return 0; | 1974 | return 0; |
1981 | 1975 | ||
1982 | /* | ||
1983 | * It's bad that we can potentially hang userspace if struct_mutex gets | ||
1984 | * forever stuck. However, if we cannot acquire this lock it means that | ||
1985 | * almost certainly the driver has hung, is not unload-able. Therefore | ||
1986 | * hanging here is probably a minor inconvenience not to be seen my | ||
1987 | * almost every user. | ||
1988 | */ | ||
1989 | ret = mutex_lock_interruptible(&dev->struct_mutex); | ||
1990 | if (ret) | ||
1991 | return ret; | ||
1992 | |||
1993 | gen6_gt_force_wake_put(dev_priv); | 1976 | gen6_gt_force_wake_put(dev_priv); |
1994 | mutex_unlock(&dev->struct_mutex); | ||
1995 | 1977 | ||
1996 | return 0; | 1978 | return 0; |
1997 | } | 1979 | } |