Commit 0ee46c9dadcbbd0daa12da30f226391896d90abb

Authored by Takashi Iwai
Committed by Linus Torvalds
1 parent 2c020a99e0

[ALSA] opl3 - Fix compilation without sequencer support

Add proper ifdef's to the patch loading code moved from the old instr
layer so that opl3 driver can be compiled without the sequencer support.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 2 changed files with 15 additions and 2 deletions Side-by-side Diff

include/sound/opl3.h
... ... @@ -370,12 +370,13 @@
370 370 int snd_opl3_open(struct snd_hwdep * hw, struct file *file);
371 371 int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file,
372 372 unsigned int cmd, unsigned long arg);
373   -long snd_opl3_write(struct snd_hwdep *hw, const char __user *buf, long count,
374   - loff_t *offset);
375 373 int snd_opl3_release(struct snd_hwdep * hw, struct file *file);
376 374  
377 375 void snd_opl3_reset(struct snd_opl3 * opl3);
378 376  
  377 +#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
  378 +long snd_opl3_write(struct snd_hwdep *hw, const char __user *buf, long count,
  379 + loff_t *offset);
379 380 int snd_opl3_load_patch(struct snd_opl3 *opl3,
380 381 int prog, int bank, int type,
381 382 const char *name,
... ... @@ -384,6 +385,10 @@
384 385 struct fm_patch *snd_opl3_find_patch(struct snd_opl3 *opl3, int prog, int bank,
385 386 int create_patch);
386 387 void snd_opl3_clear_patches(struct snd_opl3 *opl3);
  388 +#else
  389 +#define snd_opl3_write NULL
  390 +static inline void snd_opl3_clear_patches(struct snd_opl3 *opl3) {}
  391 +#endif
387 392  
388 393 #endif /* __SOUND_OPL3_H */
sound/drivers/opl3/opl3_synth.c
... ... @@ -22,6 +22,10 @@
22 22 #include <sound/opl3.h>
23 23 #include <sound/asound_fm.h>
24 24  
  25 +#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
  26 +#define OPL3_SUPPORT_SYNTH
  27 +#endif
  28 +
25 29 /*
26 30 * There is 18 possible 2 OP voices
27 31 * (9 in the left and 9 in the right).
28 32  
... ... @@ -155,9 +159,11 @@
155 159 #endif
156 160 return snd_opl3_set_connection(opl3, (int) arg);
157 161  
  162 +#ifdef OPL3_SUPPORT_SYNTH
158 163 case SNDRV_DM_FM_IOCTL_CLEAR_PATCHES:
159 164 snd_opl3_clear_patches(opl3);
160 165 return 0;
  166 +#endif
161 167  
162 168 #ifdef CONFIG_SND_DEBUG
163 169 default:
... ... @@ -178,6 +184,7 @@
178 184 return 0;
179 185 }
180 186  
  187 +#ifdef OPL3_SUPPORT_SYNTH
181 188 /*
182 189 * write the device - load patches
183 190 */
... ... @@ -341,6 +348,7 @@
341 348 }
342 349 memset(opl3->patch_table, 0, sizeof(opl3->patch_table));
343 350 }
  351 +#endif /* OPL3_SUPPORT_SYNTH */
344 352  
345 353 /* ------------------------------ */
346 354