]> git.hungrycats.org Git - linux/commitdiff
drm/i915, HD-audio: Don't continue probing when nomodeset is given
authorTakashi Iwai <tiwai@suse.de>
Fri, 13 Jun 2014 13:14:34 +0000 (15:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Jul 2014 18:21:26 +0000 (11:21 -0700)
commit 74b0c2d75fb4cc89173944e6d8f9eb47aca0c343 upstream.

When a machine is booted with nomodeset option, i915 driver skips the
whole initialization.  Meanwhile, HD-audio tries to bind wth i915 just
by request_symbol() without knowing that the initialization was
skipped, and eventually it hits WARN_ON() in i915_request_power_well()
and i915_release_power_well() wrongly but still continues probing,
even though it doesn't work at all.

In this patch, both functions are changed to return an error in case
of uninitialized state instead of WARN_ON(), so that HD-audio driver
can give up HDMI controller initialization at the right time.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/i915/intel_pm.c
include/drm/i915_powerwell.h
sound/pci/hda/hda_i915.c
sound/pci/hda/hda_i915.h
sound/pci/hda/hda_intel.c

index d430f2767a34e61e4009b0346c07e5d8963b9c42..51e3e5cf5fff5af5de42e3bd249346f3e56486c9 100644 (file)
@@ -5705,30 +5705,32 @@ void intel_display_power_put(struct drm_i915_private *dev_priv,
 static struct i915_power_domains *hsw_pwr;
 
 /* Display audio driver power well request */
-void i915_request_power_well(void)
+int i915_request_power_well(void)
 {
        struct drm_i915_private *dev_priv;
 
-       if (WARN_ON(!hsw_pwr))
-               return;
+       if (!hsw_pwr)
+               return -ENODEV;
 
        dev_priv = container_of(hsw_pwr, struct drm_i915_private,
                                power_domains);
        intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
+       return 0;
 }
 EXPORT_SYMBOL_GPL(i915_request_power_well);
 
 /* Display audio driver power well release */
-void i915_release_power_well(void)
+int i915_release_power_well(void)
 {
        struct drm_i915_private *dev_priv;
 
-       if (WARN_ON(!hsw_pwr))
-               return;
+       if (!hsw_pwr)
+               return -ENODEV;
 
        dev_priv = container_of(hsw_pwr, struct drm_i915_private,
                                power_domains);
        intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);
+       return 0;
 }
 EXPORT_SYMBOL_GPL(i915_release_power_well);
 
index cfdc884405b749abd37f703fbab073ee8062e703..2baba99960948d8fd9eac0cb1a9ea217fe511843 100644 (file)
@@ -30,7 +30,7 @@
 #define _I915_POWERWELL_H_
 
 /* For use by hda_i915 driver */
-extern void i915_request_power_well(void);
-extern void i915_release_power_well(void);
+extern int i915_request_power_well(void);
+extern int i915_release_power_well(void);
 
 #endif                         /* _I915_POWERWELL_H_ */
index 9d07e4edacdb4026fcd1b7cbdb7c85974b2a8489..e9e8a4a4a9a14bd003a3a5d806405744262096ff 100644 (file)
 #include <drm/i915_powerwell.h>
 #include "hda_i915.h"
 
-static void (*get_power)(void);
-static void (*put_power)(void);
+static int (*get_power)(void);
+static int (*put_power)(void);
 
-void hda_display_power(bool enable)
+int hda_display_power(bool enable)
 {
        if (!get_power || !put_power)
-               return;
+               return -ENODEV;
 
        pr_debug("HDA display power %s \n",
                        enable ? "Enable" : "Disable");
        if (enable)
-               get_power();
+               return get_power();
        else
-               put_power();
+               return put_power();
 }
 
 int hda_i915_init(void)
index 5a63da2c53e5d0c9ec3efcb7e82e9e58ffa12bde..bfd835f8f1aa75683cc33da612c64d22ab478b31 100644 (file)
 #define __SOUND_HDA_I915_H
 
 #ifdef CONFIG_SND_HDA_I915
-void hda_display_power(bool enable);
+int hda_display_power(bool enable);
 int hda_i915_init(void);
 int hda_i915_exit(void);
 #else
-static inline void hda_display_power(bool enable) {}
+static inline int hda_display_power(bool enable) { return 0; }
 static inline int hda_i915_init(void)
 {
        return -ENODEV;
index 0176cf0e01d9f253a14e82311fead9a7620a4e4e..0ba4f4fadb6e95ef7dbdda1cc2dfbdc5fd4033bb 100644 (file)
@@ -1707,8 +1707,13 @@ static int azx_probe_continue(struct azx *chip)
                                "Error request power-well from i915\n");
                        goto out_free;
                }
+               err = hda_display_power(true);
+               if (err < 0) {
+                       dev_err(chip->card->dev,
+                               "Cannot turn on display power on i915\n");
+                       goto out_free;
+               }
 #endif
-               hda_display_power(true);
        }
 
        err = azx_first_init(chip);