]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915: Simplify intel_gpu_reset
authorRobert Beckett <robert.beckett@intel.com>
Tue, 3 Jun 2014 08:08:26 +0000 (10:08 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 11 Jun 2014 14:57:43 +0000 (16:57 +0200)
Replaced ever growing switch for gen version with chained conditionals.
Futre gen's only need to add a new one if they require something different.

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Robert Beckett <robert.beckett@intel.com>
[danvet: Picked from internal tree and white-wash commit message.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_uncore.c

index 871c2841af04b2550215aedc674fdd5bd924af7d..c90222dfe5ecf99680de4b275aac12e176334a28 100644 (file)
@@ -1154,18 +1154,16 @@ static int gen6_do_reset(struct drm_device *dev)
 
 int intel_gpu_reset(struct drm_device *dev)
 {
-       switch (INTEL_INFO(dev)->gen) {
-       case 8:
-       case 7:
-       case 6: return gen6_do_reset(dev);
-       case 5: return ironlake_do_reset(dev);
-       case 4:
-               if (IS_G4X(dev))
-                       return g4x_do_reset(dev);
-               else
-                       return i965_do_reset(dev);
-       default: return -ENODEV;
-       }
+       if (INTEL_INFO(dev)->gen >= 6)
+               return gen6_do_reset(dev);
+       else if (IS_GEN5(dev))
+               return ironlake_do_reset(dev);
+       else if (IS_G4X(dev))
+               return g4x_do_reset(dev);
+       else if (IS_GEN4(dev))
+               return i965_do_reset(dev);
+       else
+               return -ENODEV;
 }
 
 void intel_uncore_check_errors(struct drm_device *dev)