summaryrefslogtreecommitdiff
path: root/sound/pci/hda/hda_i915.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-04-29 12:28:52 +0200
committerTakashi Iwai <tiwai@suse.de>2015-04-29 12:28:52 +0200
commit85abf3ec5fa663c9638ef2d10d9623880a26458e (patch)
treece1cc6166cd34b4a49299ccf4aefaac657a34fcf /sound/pci/hda/hda_i915.c
parent49c4a4c5244d2c1a25ec1e01dbb4fba3813d237d (diff)
parent2bd1f73f4242ee19d8c610bcffe6e7a813451ce0 (diff)
Merge branch 'topic/hda' into for-next
Diffstat (limited to 'sound/pci/hda/hda_i915.c')
-rw-r--r--sound/pci/hda/hda_i915.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/sound/pci/hda/hda_i915.c b/sound/pci/hda/hda_i915.c
index 3052a2b095f7..d9d079330e55 100644
--- a/sound/pci/hda/hda_i915.c
+++ b/sound/pci/hda/hda_i915.c
@@ -42,10 +42,15 @@ int hda_display_power(struct hda_intel *hda, bool enable)
dev_dbg(&hda->chip.pci->dev, "display power %s\n",
enable ? "enable" : "disable");
- if (enable)
- acomp->ops->get_power(acomp->dev);
- else
- acomp->ops->put_power(acomp->dev);
+
+ if (enable) {
+ if (!hda->i915_power_refcount++)
+ acomp->ops->get_power(acomp->dev);
+ } else {
+ WARN_ON(!hda->i915_power_refcount);
+ if (!--hda->i915_power_refcount)
+ acomp->ops->put_power(acomp->dev);
+ }
return 0;
}
@@ -189,6 +194,11 @@ out_err:
int hda_i915_exit(struct hda_intel *hda)
{
struct device *dev = &hda->chip.pci->dev;
+ struct i915_audio_component *acomp = &hda->audio_component;
+
+ WARN_ON(hda->i915_power_refcount);
+ if (hda->i915_power_refcount > 0 && acomp->ops)
+ acomp->ops->put_power(acomp->dev);
component_master_del(dev, &hda_component_master_ops);