drm/i915: simplify sysfs setup code
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 31 May 2012 12:57:43 +0000 (14:57 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 1 Jun 2012 08:00:57 +0000 (10:00 +0200)
Positively checking for the required feature/gen is simpler than build
a cascade of negative "we need to bail" checks. And the later won't
scale if we add more stuff that doesn't fit in nicely.

Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_sysfs.c

index c2013273a4c65deb5297ca4e492b606300c04cfb..2f5388af8df9cdf775d66d4d4f72f50f29bdecc0 100644 (file)
@@ -205,20 +205,18 @@ void i915_setup_sysfs(struct drm_device *dev)
 {
        int ret;
 
-       /* ILK and below don't yet have relevant sysfs files */
-       if (INTEL_INFO(dev)->gen < 6)
-               return;
-
-       ret = sysfs_merge_group(&dev->primary->kdev.kobj, &rc6_attr_group);
-       if (ret)
-               DRM_ERROR("RC6 residency sysfs setup failed\n");
-
-       if (!IS_IVYBRIDGE(dev))
-               return;
+       if (INTEL_INFO(dev)->gen >= 6) {
+               ret = sysfs_merge_group(&dev->primary->kdev.kobj,
+                                       &rc6_attr_group);
+               if (ret)
+                       DRM_ERROR("RC6 residency sysfs setup failed\n");
+       }
 
-       ret = device_create_bin_file(&dev->primary->kdev, &dpf_attrs);
-       if (ret)
-               DRM_ERROR("l3 parity sysfs setup failed\n");
+       if (IS_IVYBRIDGE(dev)) {
+               ret = device_create_bin_file(&dev->primary->kdev, &dpf_attrs);
+               if (ret)
+                       DRM_ERROR("l3 parity sysfs setup failed\n");
+       }
 }
 
 void i915_teardown_sysfs(struct drm_device *dev)