summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-04-13 15:03:45 +0200
committerTakashi Iwai <tiwai@suse.de>2015-04-13 15:04:48 +0200
commit0ddb8dfbbd639816cc134fe72fd24a5d0da04de0 (patch)
treeb80ae76f428ca530d3c51cf9f2a602aa31e21089
parentf3ab043c620574344afb4d34dffe82e8258522be (diff)
downloadalsa-driver-build-unstable-0ddb8dfbbd639816cc134fe72fd24a5d0da04de0.tar.gz
Fix build of hda_codec.c with older kernels
Define pm_runtime_force_suspend() and _resume() locally in hda_codec.c build stub. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--alsa/pci/hda/hda_codec.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/alsa/pci/hda/hda_codec.c b/alsa/pci/hda/hda_codec.c
index 39010da80..c122956e2 100644
--- a/alsa/pci/hda/hda_codec.c
+++ b/alsa/pci/hda/hda_codec.c
@@ -1,2 +1,53 @@
#include "adriver.h"
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 15, 0)
+#include <linux/device.h>
+static int pm_runtime_force_suspend(struct device *dev);
+static int pm_runtime_force_resume(struct device *dev);
+#endif
#include "../../alsa-kernel/pci/hda/hda_codec.c"
+
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 15, 0)
+static int pm_runtime_force_suspend(struct device *dev)
+{
+ int ret = 0;
+
+ pm_runtime_disable(dev);
+ if (pm_runtime_status_suspended(dev))
+ return 0;
+
+ if (!device->driver->pm || !device->driver->pm->runtime_suspend) {
+ ret = -ENOSYS;
+ goto err;
+ }
+
+ ret = device->driver->pm->runtime_suspend(dev);
+ if (ret)
+ goto err;
+
+ pm_runtime_set_suspended(dev);
+ return 0;
+err:
+ pm_runtime_enable(dev);
+ return ret;
+}
+
+static int pm_runtime_force_resume(struct device *dev)
+{
+ int ret = 0;
+
+ if (!device->driver->pm || !device->driver->pm->runtime_resume) {
+ ret = -ENOSYS;
+ goto out;
+ }
+
+ ret = device->driver->pm->runtime_resume(dev);
+ if (ret)
+ goto out;
+
+ pm_runtime_set_active(dev);
+ pm_runtime_mark_last_busy(dev);
+out:
+ pm_runtime_enable(dev);
+ return ret;
+}
+#endif /* <= 3.15 */