diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-07-23 22:42:31 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-07-23 22:42:31 +0200 |
commit | fc9196579b8f62d4bd703839652ae7eae6f1e279 (patch) | |
tree | 496176163bd95f1545b675c0c4229c8dc6f1e2c7 | |
parent | 5eb2aa265a9a7bec0f34a2592aa2ccf74365edfa (diff) |
fixup for despiseful midlayer bullcraprps-locking
-rw-r--r-- | drivers/gpu/drm/i915/i915_debugfs.c | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 974bb2e39442..05087fa25ddf 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -1711,6 +1711,9 @@ i915_max_freq_read(struct file *filp, char buf[80]; int len; + if (!(IS_GEN6(dev) || IS_GEN7(dev))) + return -ENODEV; + mutex_lock(&dev->struct_mutex); len = snprintf(buf, sizeof(buf), "max freq: %d\n", dev_priv->rps.max_delay * 50); @@ -1733,6 +1736,9 @@ i915_max_freq_write(struct file *filp, char buf[20]; int val = 1; + if (!(IS_GEN6(dev) || IS_GEN7(dev))) + return -ENODEV; + if (cnt > 0) { if (cnt > sizeof(buf) - 1) return -EINVAL; @@ -1775,6 +1781,9 @@ i915_min_freq_read(struct file *filp, char __user *ubuf, size_t max, char buf[80]; int len; + if (!(IS_GEN6(dev) || IS_GEN7(dev))) + return -ENODEV; + mutex_lock(&dev->struct_mutex); len = snprintf(buf, sizeof(buf), "min freq: %d\n", dev_priv->rps.min_delay * 50); @@ -1795,6 +1804,9 @@ i915_min_freq_write(struct file *filp, const char __user *ubuf, size_t cnt, char buf[20]; int val = 1; + if (!(IS_GEN6(dev) || IS_GEN7(dev))) + return -ENODEV; + if (cnt > 0) { if (cnt > sizeof(buf) - 1) return -EINVAL; @@ -1840,6 +1852,9 @@ i915_cache_sharing_read(struct file *filp, u32 snpcr; int len; + if (!(IS_GEN6(dev) || IS_GEN7(dev))) + return -ENODEV; + mutex_lock(&dev_priv->dev->struct_mutex); snpcr = I915_READ(GEN6_MBCUNIT_SNPCR); mutex_unlock(&dev_priv->dev->struct_mutex); @@ -1866,6 +1881,9 @@ i915_cache_sharing_write(struct file *filp, u32 snpcr; int val = 1; + if (!(IS_GEN6(dev) || IS_GEN7(dev))) + return -ENODEV; + if (cnt > 0) { if (cnt > sizeof(buf) - 1) return -EINVAL; @@ -2041,7 +2059,6 @@ static struct drm_info_list i915_debugfs_list[] = { int i915_debugfs_init(struct drm_minor *minor) { - struct drm_device *dev = minor->dev; int ret; ret = i915_debugfs_create(minor->debugfs_root, minor, @@ -2054,25 +2071,23 @@ int i915_debugfs_init(struct drm_minor *minor) if (ret) return ret; - if (IS_GEN6(dev) || IS_GEN7(dev)) { - ret = i915_debugfs_create(minor->debugfs_root, minor, - "i915_max_freq", - &i915_max_freq_fops); - if (ret) - return ret; + ret = i915_debugfs_create(minor->debugfs_root, minor, + "i915_max_freq", + &i915_max_freq_fops); + if (ret) + return ret; - ret = i915_debugfs_create(minor->debugfs_root, minor, - "i915_min_freq", - &i915_min_freq_fops); - if (ret) - return ret; + ret = i915_debugfs_create(minor->debugfs_root, minor, + "i915_min_freq", + &i915_min_freq_fops); + if (ret) + return ret; - ret = i915_debugfs_create(minor->debugfs_root, minor, - "i915_cache_sharing", - &i915_cache_sharing_fops); - if (ret) - return ret; - } + ret = i915_debugfs_create(minor->debugfs_root, minor, + "i915_cache_sharing", + &i915_cache_sharing_fops); + if (ret) + return ret; ret = i915_debugfs_create(minor->debugfs_root, minor, "i915_ring_stop", |