aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-02-25 10:31:47 +0100
committerTakashi Iwai <tiwai@suse.de>2015-02-25 10:31:47 +0100
commit512deee4523161571e723a565d9c0123635765da (patch)
tree68fb14f21f1d26515de4762db0eaa01741e00466
parent7eb60f08a289ffdaead43a73965382b9c936ad24 (diff)
downloadhda-emu-512deee4523161571e723a565d9c0123635765da.tar.gz
Fix build without hda_bus_template
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--configure.ac12
-rw-r--r--hda-emu.c27
2 files changed, 38 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index fe5c0e2..5d10a64 100644
--- a/configure.ac
+++ b/configure.ac
@@ -547,5 +547,17 @@ if test "$HAVE_CODEC_USER_MUTEX" = "1"; then
AC_DEFINE(HAVE_CODEC_USER_MUTEX)
fi
+HAVE_HDA_BUS_TEMPLATE=
+AC_MSG_CHECKING(for hda_bus_template)
+if grep -q hda_bus_template hda/hda_codec.h; then
+ AC_MSG_RESULT(yes)
+ HAVE_HDA_BUS_TEMPLATE=yes
+else
+ AC_MSG_RESULT(no)
+fi
+if test "$HAVE_HDA_BUS_TEMPLATE" = "yes"; then
+ AC_DEFINE(HAVE_HDA_BUS_TEMPLATE)
+fi
+
AC_OUTPUT(Makefile kernel/Makefile include/Makefile)
diff --git a/hda-emu.c b/hda-emu.c
index e8309d5..96a82d8 100644
--- a/hda-emu.c
+++ b/hda-emu.c
@@ -1281,6 +1281,15 @@ static FILE *file_open(const char *fname)
return fopen(fname, "r");
}
+#ifndef HAVE_HDA_BUS_TEMPLATE
+static struct hda_bus_ops bus_ops = {
+ .command = cmd_send,
+ .get_response = resp_get_caddr,
+ .attach_pcm = attach_pcm,
+ .pm_notify = new_pm_notify,
+};
+#endif /* HAVE_HDA_BUS_TEMPLATE */
+
int main(int argc, char **argv)
{
int c, err;
@@ -1292,7 +1301,9 @@ int main(int argc, char **argv)
char *logfile = NULL;
unsigned int log_flags = HDA_LOG_FLAG_COLOR;
struct pci_dev mypci;
+#ifdef HAVE_HDA_BUS_TEMPLATE
struct hda_bus_template temp;
+#endif
struct hda_codec *codec;
char *init_pincfg = NULL;
char *user_pincfg = NULL;
@@ -1414,6 +1425,7 @@ int main(int argc, char **argv)
pci_subvendor, pci_subdevice);
}
+#ifdef HAVE_HDA_BUS_TEMPLATE
memset(&temp, 0, sizeof(temp));
temp.pci = &mypci;
@@ -1447,13 +1459,26 @@ int main(int argc, char **argv)
temp.ops.pm_notify = pm_notify;
#endif
#endif /* OLD_HDA_CMD */
+#endif /* HAVE_HDA_BUS_TEMPLATE */
gather_codec_hooks();
- if (snd_hda_bus_new(&card, &temp, &bus) < 0) {
+#ifdef HAVE_HDA_BUS_TEMPLATE
+ err = snd_hda_bus_new(&card, &temp, &bus);
+#else
+ err = snd_hda_bus_new(&card, &bus);
+#endif
+ if (err < 0) {
hda_log(HDA_LOG_ERR, "cannot create snd_hda_bus\n");
return 1;
}
+#ifndef HAVE_HDA_BUS_TEMPLATE
+ bus->pci = &mypci;
+ bus->ops = bus_ops;
+ bus->power_save = &power_save;
+ bus->modelname = opt_model;
+#endif /* HAVE_HDA_BUS_TEMPLATE */
+
ignore_invalid_ftype = 1;
#ifdef OLD_HDA_CODEC_NEW
err = snd_hda_codec_new(bus, proc.addr, &codec);