[ALSA] Optimize for config without PROC_FS (pci drivers)

Optimize the code when compiled without CONFIG_PROC_FS for some pci drivers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2005-12-01 10:49:58 +01:00 committed by Jaroslav Kysela
parent 8cb7b63f5b
commit adf1b3d25e
16 changed files with 92 additions and 40 deletions

View File

@ -184,42 +184,6 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = {
{ 0, 0, NULL, NULL, NULL } { 0, 0, NULL, NULL, NULL }
}; };
const char *snd_ac97_stereo_enhancements[] =
{
/* 0 */ "No 3D Stereo Enhancement",
/* 1 */ "Analog Devices Phat Stereo",
/* 2 */ "Creative Stereo Enhancement",
/* 3 */ "National Semi 3D Stereo Enhancement",
/* 4 */ "YAMAHA Ymersion",
/* 5 */ "BBE 3D Stereo Enhancement",
/* 6 */ "Crystal Semi 3D Stereo Enhancement",
/* 7 */ "Qsound QXpander",
/* 8 */ "Spatializer 3D Stereo Enhancement",
/* 9 */ "SRS 3D Stereo Enhancement",
/* 10 */ "Platform Tech 3D Stereo Enhancement",
/* 11 */ "AKM 3D Audio",
/* 12 */ "Aureal Stereo Enhancement",
/* 13 */ "Aztech 3D Enhancement",
/* 14 */ "Binaura 3D Audio Enhancement",
/* 15 */ "ESS Technology Stereo Enhancement",
/* 16 */ "Harman International VMAx",
/* 17 */ "Nvidea/IC Ensemble/KS Waves 3D Stereo Enhancement",
/* 18 */ "Philips Incredible Sound",
/* 19 */ "Texas Instruments 3D Stereo Enhancement",
/* 20 */ "VLSI Technology 3D Stereo Enhancement",
/* 21 */ "TriTech 3D Stereo Enhancement",
/* 22 */ "Realtek 3D Stereo Enhancement",
/* 23 */ "Samsung 3D Stereo Enhancement",
/* 24 */ "Wolfson Microelectronics 3D Enhancement",
/* 25 */ "Delta Integration 3D Enhancement",
/* 26 */ "SigmaTel 3D Enhancement",
/* 27 */ "IC Ensemble/KS Waves",
/* 28 */ "Rockwell 3D Stereo Enhancement",
/* 29 */ "Reserved 29",
/* 30 */ "Reserved 30",
/* 31 */ "Reserved 31"
};
/* /*
* I/O routines * I/O routines
@ -1895,10 +1859,12 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
init_MUTEX(&ac97->reg_mutex); init_MUTEX(&ac97->reg_mutex);
init_MUTEX(&ac97->page_mutex); init_MUTEX(&ac97->page_mutex);
#ifdef CONFIG_PCI
if (ac97->pci) { if (ac97->pci) {
pci_read_config_word(ac97->pci, PCI_SUBSYSTEM_VENDOR_ID, &ac97->subsystem_vendor); pci_read_config_word(ac97->pci, PCI_SUBSYSTEM_VENDOR_ID, &ac97->subsystem_vendor);
pci_read_config_word(ac97->pci, PCI_SUBSYSTEM_ID, &ac97->subsystem_device); pci_read_config_word(ac97->pci, PCI_SUBSYSTEM_ID, &ac97->subsystem_device);
} }
#endif
if (bus->ops->reset) { if (bus->ops->reset) {
bus->ops->reset(ac97); bus->ops->reset(ac97);
goto __access_ok; goto __access_ok;

View File

@ -57,7 +57,6 @@ struct ac97_enum {
.private_value = (unsigned long)&xenum } .private_value = (unsigned long)&xenum }
/* ac97_codec.c */ /* ac97_codec.c */
extern const char *snd_ac97_stereo_enhancements[];
extern const struct snd_kcontrol_new snd_ac97_controls_3d[]; extern const struct snd_kcontrol_new snd_ac97_controls_3d[];
extern const struct snd_kcontrol_new snd_ac97_controls_spdif[]; extern const struct snd_kcontrol_new snd_ac97_controls_spdif[];
struct snd_kcontrol *snd_ac97_cnew(const struct snd_kcontrol_new *_template, struct snd_ac97 * ac97); struct snd_kcontrol *snd_ac97_cnew(const struct snd_kcontrol_new *_template, struct snd_ac97 * ac97);

View File

@ -68,6 +68,42 @@ static void snd_ac97_proc_read_functions(struct snd_ac97 *ac97, struct snd_info_
} }
} }
static const char *snd_ac97_stereo_enhancements[] =
{
/* 0 */ "No 3D Stereo Enhancement",
/* 1 */ "Analog Devices Phat Stereo",
/* 2 */ "Creative Stereo Enhancement",
/* 3 */ "National Semi 3D Stereo Enhancement",
/* 4 */ "YAMAHA Ymersion",
/* 5 */ "BBE 3D Stereo Enhancement",
/* 6 */ "Crystal Semi 3D Stereo Enhancement",
/* 7 */ "Qsound QXpander",
/* 8 */ "Spatializer 3D Stereo Enhancement",
/* 9 */ "SRS 3D Stereo Enhancement",
/* 10 */ "Platform Tech 3D Stereo Enhancement",
/* 11 */ "AKM 3D Audio",
/* 12 */ "Aureal Stereo Enhancement",
/* 13 */ "Aztech 3D Enhancement",
/* 14 */ "Binaura 3D Audio Enhancement",
/* 15 */ "ESS Technology Stereo Enhancement",
/* 16 */ "Harman International VMAx",
/* 17 */ "Nvidea/IC Ensemble/KS Waves 3D Stereo Enhancement",
/* 18 */ "Philips Incredible Sound",
/* 19 */ "Texas Instruments 3D Stereo Enhancement",
/* 20 */ "VLSI Technology 3D Stereo Enhancement",
/* 21 */ "TriTech 3D Stereo Enhancement",
/* 22 */ "Realtek 3D Stereo Enhancement",
/* 23 */ "Samsung 3D Stereo Enhancement",
/* 24 */ "Wolfson Microelectronics 3D Enhancement",
/* 25 */ "Delta Integration 3D Enhancement",
/* 26 */ "SigmaTel 3D Enhancement",
/* 27 */ "IC Ensemble/KS Waves",
/* 28 */ "Rockwell 3D Stereo Enhancement",
/* 29 */ "Reserved 29",
/* 30 */ "Reserved 30",
/* 31 */ "Reserved 31"
};
static void snd_ac97_proc_read_main(struct snd_ac97 *ac97, struct snd_info_buffer *buffer, int subidx) static void snd_ac97_proc_read_main(struct snd_ac97 *ac97, struct snd_info_buffer *buffer, int subidx)
{ {
char name[64]; char name[64];

View File

@ -30,7 +30,11 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
MODULE_DESCRIPTION("Universal routines for AK4531 codec"); MODULE_DESCRIPTION("Universal routines for AK4531 codec");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#ifdef CONFIG_PROC_FS
static void snd_ak4531_proc_init(struct snd_card *card, struct snd_ak4531 *ak4531); static void snd_ak4531_proc_init(struct snd_card *card, struct snd_ak4531 *ak4531);
#else
#define snd_ak4531_proc_init(card,ak)
#endif
/* /*
* *
@ -425,8 +429,9 @@ void snd_ak4531_resume(struct snd_ak4531 *ak4531)
} }
#endif #endif
#ifdef CONFIG_PROC_FS
/* /*
* /proc interface
*/ */
static void snd_ak4531_proc_read(struct snd_info_entry *entry, static void snd_ak4531_proc_read(struct snd_info_entry *entry,
@ -448,6 +453,7 @@ static void snd_ak4531_proc_init(struct snd_card *card, struct snd_ak4531 *ak453
if (! snd_card_proc_new(card, "ak4531", &entry)) if (! snd_card_proc_new(card, "ak4531", &entry))
snd_info_set_text_ops(entry, ak4531, 1024, snd_ak4531_proc_read); snd_info_set_text_ops(entry, ak4531, 1024, snd_ak4531_proc_read);
} }
#endif
EXPORT_SYMBOL(snd_ak4531_mixer); EXPORT_SYMBOL(snd_ak4531_mixer);
#ifdef CONFIG_PM #ifdef CONFIG_PM

View File

@ -1477,6 +1477,7 @@ static int snd_atiixp_resume(struct pci_dev *pci)
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
#ifdef CONFIG_PROC_FS
/* /*
* proc interface for register dump * proc interface for register dump
*/ */
@ -1498,7 +1499,9 @@ static void __devinit snd_atiixp_proc_init(struct atiixp *chip)
if (! snd_card_proc_new(chip->card, "atiixp", &entry)) if (! snd_card_proc_new(chip->card, "atiixp", &entry))
snd_info_set_text_ops(entry, chip, 1024, snd_atiixp_proc_read); snd_info_set_text_ops(entry, chip, 1024, snd_atiixp_proc_read);
} }
#else /* !CONFIG_PROC_FS */
#define snd_atiixp_proc_init(chip)
#endif
/* /*

View File

@ -1156,6 +1156,7 @@ static int snd_atiixp_resume(struct pci_dev *pci)
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
#ifdef CONFIG_PROC_FS
/* /*
* proc interface for register dump * proc interface for register dump
*/ */
@ -1177,7 +1178,9 @@ static void __devinit snd_atiixp_proc_init(struct atiixp_modem *chip)
if (! snd_card_proc_new(chip->card, "atiixp-modem", &entry)) if (! snd_card_proc_new(chip->card, "atiixp-modem", &entry))
snd_info_set_text_ops(entry, chip, 1024, snd_atiixp_proc_read); snd_info_set_text_ops(entry, chip, 1024, snd_atiixp_proc_read);
} }
#else
#define snd_atiixp_proc_init(chip)
#endif
/* /*

View File

@ -1456,7 +1456,9 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci,
} }
snd_printdd(" done.\n"); snd_printdd(" done.\n");
#ifdef CONFIG_PROC_FS
snd_ca0106_proc_init(chip); snd_ca0106_proc_init(chip);
#endif
if ((err = snd_card_register(card)) < 0) { if ((err = snd_card_register(card)) < 0) {
snd_card_free(card); snd_card_free(card);

View File

@ -77,6 +77,8 @@
#include "ca0106.h" #include "ca0106.h"
#ifdef CONFIG_PROC_FS
struct snd_ca0106_category_str { struct snd_ca0106_category_str {
int val; int val;
const char *name; const char *name;
@ -459,3 +461,4 @@ int __devinit snd_ca0106_proc_init(struct snd_ca0106 * emu)
return 0; return 0;
} }
#endif /* CONFIG_PROC_FS */

View File

@ -2747,6 +2747,7 @@ int __devinit snd_cs46xx_gameport(struct snd_cs46xx *chip) { return -ENOSYS; }
static inline void snd_cs46xx_remove_gameport(struct snd_cs46xx *chip) { } static inline void snd_cs46xx_remove_gameport(struct snd_cs46xx *chip) { }
#endif /* CONFIG_GAMEPORT */ #endif /* CONFIG_GAMEPORT */
#ifdef CONFIG_PROC_FS
/* /*
* proc interface * proc interface
*/ */
@ -2800,6 +2801,10 @@ static int snd_cs46xx_proc_done(struct snd_cs46xx *chip)
#endif #endif
return 0; return 0;
} }
#else /* !CONFIG_PROC_FS */
#define snd_cs46xx_proc_init(card, chip)
#define snd_cs46xx_proc_done(chip)
#endif
/* /*
* stop the h/w * stop the h/w

View File

@ -88,8 +88,13 @@ void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip);
int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * module); int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * module);
struct dsp_symbol_entry *cs46xx_dsp_lookup_symbol (struct snd_cs46xx * chip, char * symbol_name, struct dsp_symbol_entry *cs46xx_dsp_lookup_symbol (struct snd_cs46xx * chip, char * symbol_name,
int symbol_type); int symbol_type);
#ifdef CONFIG_PROC_FS
int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip); int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip);
int cs46xx_dsp_proc_done (struct snd_cs46xx *chip); int cs46xx_dsp_proc_done (struct snd_cs46xx *chip);
#else
#define cs46xx_dsp_proc_init(card, chip)
#define cs46xx_dsp_proc_done(chip)
#endif
int cs46xx_dsp_scb_and_task_init (struct snd_cs46xx *chip); int cs46xx_dsp_scb_and_task_init (struct snd_cs46xx *chip);
int snd_cs46xx_download (struct snd_cs46xx *chip, u32 *src, unsigned long offset, int snd_cs46xx_download (struct snd_cs46xx *chip, u32 *src, unsigned long offset,
unsigned long len); unsigned long len);
@ -106,9 +111,14 @@ int cs46xx_dsp_disable_adc_capture (struct snd_cs46xx *chip);
int cs46xx_poke_via_dsp (struct snd_cs46xx *chip, u32 address, u32 data); int cs46xx_poke_via_dsp (struct snd_cs46xx *chip, u32 address, u32 data);
struct dsp_scb_descriptor * cs46xx_dsp_create_scb (struct snd_cs46xx *chip, char * name, struct dsp_scb_descriptor * cs46xx_dsp_create_scb (struct snd_cs46xx *chip, char * name,
u32 * scb_data, u32 dest); u32 * scb_data, u32 dest);
#ifdef CONFIG_PROC_FS
void cs46xx_dsp_proc_free_scb_desc (struct dsp_scb_descriptor * scb); void cs46xx_dsp_proc_free_scb_desc (struct dsp_scb_descriptor * scb);
void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip, void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip,
struct dsp_scb_descriptor * scb); struct dsp_scb_descriptor * scb);
#else
#define cs46xx_dsp_proc_free_scb_desc(scb)
#define cs46xx_dsp_proc_register_scb_desc(chip, scb)
#endif
struct dsp_scb_descriptor * cs46xx_dsp_create_timing_master_scb (struct snd_cs46xx *chip); struct dsp_scb_descriptor * cs46xx_dsp_create_timing_master_scb (struct snd_cs46xx *chip);
struct dsp_scb_descriptor * struct dsp_scb_descriptor *
cs46xx_dsp_create_codec_out_scb(struct snd_cs46xx * chip, cs46xx_dsp_create_codec_out_scb(struct snd_cs46xx * chip,

View File

@ -439,6 +439,7 @@ cs46xx_dsp_lookup_symbol (struct snd_cs46xx * chip, char * symbol_name, int symb
} }
#ifdef CONFIG_PROC_FS
static struct dsp_symbol_entry * static struct dsp_symbol_entry *
cs46xx_dsp_lookup_symbol_addr (struct snd_cs46xx * chip, u32 address, int symbol_type) cs46xx_dsp_lookup_symbol_addr (struct snd_cs46xx * chip, u32 address, int symbol_type)
{ {
@ -912,6 +913,7 @@ int cs46xx_dsp_proc_done (struct snd_cs46xx *chip)
return 0; return 0;
} }
#endif /* CONFIG_PROC_FS */
static int debug_tree; static int debug_tree;
static void _dsp_create_task_tree (struct snd_cs46xx *chip, u32 * task_data, static void _dsp_create_task_tree (struct snd_cs46xx *chip, u32 * task_data,

View File

@ -64,6 +64,7 @@ static void remove_symbol (struct snd_cs46xx * chip, struct dsp_symbol_entry * s
} }
#ifdef CONFIG_PROC_FS
static void cs46xx_dsp_proc_scb_info_read (struct snd_info_entry *entry, static void cs46xx_dsp_proc_scb_info_read (struct snd_info_entry *entry,
struct snd_info_buffer *buffer) struct snd_info_buffer *buffer)
{ {
@ -106,6 +107,7 @@ static void cs46xx_dsp_proc_scb_info_read (struct snd_info_entry *entry,
snd_iprintf(buffer,"index [%d] ref_count [%d]\n",scb->index,scb->ref_count); snd_iprintf(buffer,"index [%d] ref_count [%d]\n",scb->index,scb->ref_count);
up(&chip->spos_mutex); up(&chip->spos_mutex);
} }
#endif
static void _dsp_unlink_scb (struct snd_cs46xx *chip, struct dsp_scb_descriptor * scb) static void _dsp_unlink_scb (struct snd_cs46xx *chip, struct dsp_scb_descriptor * scb)
{ {
@ -220,6 +222,7 @@ void cs46xx_dsp_remove_scb (struct snd_cs46xx *chip, struct dsp_scb_descriptor *
} }
#ifdef CONFIG_PROC_FS
void cs46xx_dsp_proc_free_scb_desc (struct dsp_scb_descriptor * scb) void cs46xx_dsp_proc_free_scb_desc (struct dsp_scb_descriptor * scb)
{ {
if (scb->proc_info) { if (scb->proc_info) {
@ -275,6 +278,7 @@ out:
scb->proc_info = entry; scb->proc_info = entry;
} }
} }
#endif /* CONFIG_PROC_FS */
static struct dsp_scb_descriptor * static struct dsp_scb_descriptor *
_dsp_create_generic_scb (struct snd_cs46xx *chip, char * name, u32 * scb_data, u32 dest, _dsp_create_generic_scb (struct snd_cs46xx *chip, char * name, u32 * scb_data, u32 dest,

View File

@ -1076,7 +1076,9 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, emu, &ops)) < 0) if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, emu, &ops)) < 0)
goto error; goto error;
#ifdef CONFIG_PROC_FS
snd_emu10k1_proc_init(emu); snd_emu10k1_proc_init(emu);
#endif
snd_card_set_dev(card, &pci->dev); snd_card_set_dev(card, &pci->dev);
*remu = emu; *remu = emu;

View File

@ -32,6 +32,7 @@
#include <sound/emu10k1.h> #include <sound/emu10k1.h>
#include "p16v.h" #include "p16v.h"
#ifdef CONFIG_PROC_FS
static void snd_emu10k1_proc_spdif_status(struct snd_emu10k1 * emu, static void snd_emu10k1_proc_spdif_status(struct snd_emu10k1 * emu,
struct snd_info_buffer *buffer, struct snd_info_buffer *buffer,
char *title, char *title,
@ -620,3 +621,4 @@ int __devinit snd_emu10k1_proc_init(struct snd_emu10k1 * emu)
} }
return 0; return 0;
} }
#endif /* CONFIG_PROC_FS */

View File

@ -2579,6 +2579,7 @@ static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip)
printk(KERN_INFO "intel8x0: clocking to %d\n", chip->ac97_bus->clock); printk(KERN_INFO "intel8x0: clocking to %d\n", chip->ac97_bus->clock);
} }
#ifdef CONFIG_PROC_FS
static void snd_intel8x0_proc_read(struct snd_info_entry * entry, static void snd_intel8x0_proc_read(struct snd_info_entry * entry,
struct snd_info_buffer *buffer) struct snd_info_buffer *buffer)
{ {
@ -2612,6 +2613,9 @@ static void __devinit snd_intel8x0_proc_init(struct intel8x0 * chip)
if (! snd_card_proc_new(chip->card, "intel8x0", &entry)) if (! snd_card_proc_new(chip->card, "intel8x0", &entry))
snd_info_set_text_ops(entry, chip, 1024, snd_intel8x0_proc_read); snd_info_set_text_ops(entry, chip, 1024, snd_intel8x0_proc_read);
} }
#else
#define snd_intel8x0_proc_init(x)
#endif
static int snd_intel8x0_dev_free(struct snd_device *device) static int snd_intel8x0_dev_free(struct snd_device *device)
{ {

View File

@ -1066,6 +1066,7 @@ static int intel8x0m_resume(struct pci_dev *pci)
} }
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
#ifdef CONFIG_PROC_FS
static void snd_intel8x0m_proc_read(struct snd_info_entry * entry, static void snd_intel8x0m_proc_read(struct snd_info_entry * entry,
struct snd_info_buffer *buffer) struct snd_info_buffer *buffer)
{ {
@ -1093,6 +1094,10 @@ static void __devinit snd_intel8x0m_proc_init(struct intel8x0m * chip)
if (! snd_card_proc_new(chip->card, "intel8x0m", &entry)) if (! snd_card_proc_new(chip->card, "intel8x0m", &entry))
snd_info_set_text_ops(entry, chip, 1024, snd_intel8x0m_proc_read); snd_info_set_text_ops(entry, chip, 1024, snd_intel8x0m_proc_read);
} }
#else /* !CONFIG_PROC_FS */
#define snd_intel8x0m_proc_init(chip)
#endif /* CONFIG_PROC_FS */
static int snd_intel8x0_dev_free(struct snd_device *device) static int snd_intel8x0_dev_free(struct snd_device *device)
{ {