1From c8871d039815024fb1aba7a10942815bdb062d4d Mon Sep 17 00:00:00 2001
2From: Michael Forney <mforney@mforney.org>
3Date: Sun, 27 Jun 2021 01:17:55 -0700
4Subject: [PATCH] Fix build with --disable-ucm
5
6A recent change introduced a dependency on ucm to several of the
7other components, but this was not made conditional on whether
8BUILD_UCM is enabled.
9
10Signed-off-by: Michael Forney <mforney@mforney.org>
11---
12 src/control/control.c | 5 ++++-
13 src/pcm/pcm.c | 5 ++++-
14 src/rawmidi/rawmidi.c | 5 ++++-
15 src/seq/seq.c | 5 ++++-
16 src/timer/timer.c | 5 ++++-
17 5 files changed, 20 insertions(+), 5 deletions(-)
18
19diff --git a/src/control/control.c b/src/control/control.c
20index 4c2ae7f5..29eff715 100644
21--- a/src/control/control.c
22+++ b/src/control/control.c
23@@ -1611,11 +1611,14 @@ int snd_ctl_open(snd_ctl_t **ctlp, const char *name, int mode)
24 int err;
25
26 assert(ctlp && name);
27+#ifdef BUILD_UCM
28 if (_snd_is_ucm_device(name)) {
29 name = uc_mgr_alibcfg_by_device(&top, name);
30 if (name == NULL)
31 return -ENODEV;
32- } else {
33+ } else
34+#endif
35+ {
36 err = snd_config_update_ref(&top);
37 if (err < 0)
38 return err;
39diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
40index 18b1246e..23b27697 100644
41--- a/src/pcm/pcm.c
42+++ b/src/pcm/pcm.c
43@@ -2747,11 +2747,14 @@ int snd_pcm_open(snd_pcm_t **pcmp, const char *name,
44 int err;
45
46 assert(pcmp && name);
47+#ifdef BUILD_UCM
48 if (_snd_is_ucm_device(name)) {
49 name = uc_mgr_alibcfg_by_device(&top, name);
50 if (name == NULL)
51 return -ENODEV;
52- } else {
53+ } else
54+#endif
55+ {
56 err = snd_config_update_ref(&top);
57 if (err < 0)
58 return err;
59diff --git a/src/rawmidi/rawmidi.c b/src/rawmidi/rawmidi.c
60index c4b45fa2..bb09e58d 100644
61--- a/src/rawmidi/rawmidi.c
62+++ b/src/rawmidi/rawmidi.c
63@@ -316,11 +316,14 @@ int snd_rawmidi_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
64 int err;
65
66 assert((inputp || outputp) && name);
67+#ifdef BUILD_UCM
68 if (_snd_is_ucm_device(name)) {
69 name = uc_mgr_alibcfg_by_device(&top, name);
70 if (name == NULL)
71 return -ENODEV;
72- } else {
73+ } else
74+#endif
75+ {
76 err = snd_config_update_ref(&top);
77 if (err < 0)
78 return err;
79diff --git a/src/seq/seq.c b/src/seq/seq.c
80index 5eac4848..71b2624f 100644
81--- a/src/seq/seq.c
82+++ b/src/seq/seq.c
83@@ -978,11 +978,14 @@ int snd_seq_open(snd_seq_t **seqp, const char *name,
84 int err;
85
86 assert(seqp && name);
87+#if BUILD_UCM
88 if (_snd_is_ucm_device(name)) {
89 name = uc_mgr_alibcfg_by_device(&top, name);
90 if (name == NULL)
91 return -ENODEV;
92- } else {
93+ } else
94+#endif
95+ {
96 err = snd_config_update_ref(&top);
97 if (err < 0)
98 return err;
99diff --git a/src/timer/timer.c b/src/timer/timer.c
100index a139356b..1922981a 100644
101--- a/src/timer/timer.c
102+++ b/src/timer/timer.c
103@@ -205,11 +205,14 @@ int snd_timer_open(snd_timer_t **timer, const char *name, int mode)
104 int err;
105
106 assert(timer && name);
107+#ifdef BUILD_UCM
108 if (_snd_is_ucm_device(name)) {
109 name = uc_mgr_alibcfg_by_device(&top, name);
110 if (name == NULL)
111 return -ENODEV;
112- } else {
113+ } else
114+#endif
115+ {
116 err = snd_config_update_ref(&top);
117 if (err < 0)
118 return err;
119--
1202.44.0
121