Skip to content

Commit

Permalink
[ALSA] Optimize for config without PROC_FS (pci drivers)
Browse files Browse the repository at this point in the history
Optimize the code when compiled without CONFIG_PROC_FS for some pci drivers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai authored and Jaroslav Kysela committed Jan 3, 2006
1 parent 8cb7b63 commit adf1b3d
Show file tree
Hide file tree
Showing 16 changed files with 92 additions and 40 deletions.
38 changes: 2 additions & 36 deletions sound/pci/ac97/ac97_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,42 +184,6 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = {
{ 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
Expand Down Expand Up @@ -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->page_mutex);

#ifdef CONFIG_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_ID, &ac97->subsystem_device);
}
#endif
if (bus->ops->reset) {
bus->ops->reset(ac97);
goto __access_ok;
Expand Down
1 change: 0 additions & 1 deletion sound/pci/ac97/ac97_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ struct ac97_enum {
.private_value = (unsigned long)&xenum }

/* 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_spdif[];
struct snd_kcontrol *snd_ac97_cnew(const struct snd_kcontrol_new *_template, struct snd_ac97 * ac97);
Expand Down
36 changes: 36 additions & 0 deletions sound/pci/ac97/ac97_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
char name[64];
Expand Down
8 changes: 7 additions & 1 deletion sound/pci/ac97/ak4531_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
MODULE_DESCRIPTION("Universal routines for AK4531 codec");
MODULE_LICENSE("GPL");

#ifdef CONFIG_PROC_FS
static void snd_ak4531_proc_init(struct snd_card *card, struct snd_ak4531 *ak4531);
#else
#define snd_ak4531_proc_init(card,ak)
#endif

/*
*
Expand Down Expand Up @@ -425,8 +429,9 @@ void snd_ak4531_resume(struct snd_ak4531 *ak4531)
}
#endif

#ifdef CONFIG_PROC_FS
/*
* /proc interface
*/

static void snd_ak4531_proc_read(struct snd_info_entry *entry,
Expand All @@ -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))
snd_info_set_text_ops(entry, ak4531, 1024, snd_ak4531_proc_read);
}
#endif

EXPORT_SYMBOL(snd_ak4531_mixer);
#ifdef CONFIG_PM
Expand Down
5 changes: 4 additions & 1 deletion sound/pci/atiixp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1477,6 +1477,7 @@ static int snd_atiixp_resume(struct pci_dev *pci)
#endif /* CONFIG_PM */


#ifdef CONFIG_PROC_FS
/*
* proc interface for register dump
*/
Expand All @@ -1498,7 +1499,9 @@ static void __devinit snd_atiixp_proc_init(struct atiixp *chip)
if (! snd_card_proc_new(chip->card, "atiixp", &entry))
snd_info_set_text_ops(entry, chip, 1024, snd_atiixp_proc_read);
}

#else /* !CONFIG_PROC_FS */
#define snd_atiixp_proc_init(chip)
#endif


/*
Expand Down
5 changes: 4 additions & 1 deletion sound/pci/atiixp_modem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,7 @@ static int snd_atiixp_resume(struct pci_dev *pci)
#endif /* CONFIG_PM */


#ifdef CONFIG_PROC_FS
/*
* proc interface for register dump
*/
Expand All @@ -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))
snd_info_set_text_ops(entry, chip, 1024, snd_atiixp_proc_read);
}

#else
#define snd_atiixp_proc_init(chip)
#endif


/*
Expand Down
2 changes: 2 additions & 0 deletions sound/pci/ca0106/ca0106_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,9 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci,
}
snd_printdd(" done.\n");

#ifdef CONFIG_PROC_FS
snd_ca0106_proc_init(chip);
#endif

if ((err = snd_card_register(card)) < 0) {
snd_card_free(card);
Expand Down
3 changes: 3 additions & 0 deletions sound/pci/ca0106/ca0106_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
#include "ca0106.h"


#ifdef CONFIG_PROC_FS

struct snd_ca0106_category_str {
int val;
const char *name;
Expand Down Expand Up @@ -459,3 +461,4 @@ int __devinit snd_ca0106_proc_init(struct snd_ca0106 * emu)
return 0;
}

#endif /* CONFIG_PROC_FS */
5 changes: 5 additions & 0 deletions sound/pci/cs46xx/cs46xx_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) { }
#endif /* CONFIG_GAMEPORT */

#ifdef CONFIG_PROC_FS
/*
* proc interface
*/
Expand Down Expand Up @@ -2800,6 +2801,10 @@ static int snd_cs46xx_proc_done(struct snd_cs46xx *chip)
#endif
return 0;
}
#else /* !CONFIG_PROC_FS */
#define snd_cs46xx_proc_init(card, chip)
#define snd_cs46xx_proc_done(chip)
#endif

/*
* stop the h/w
Expand Down
10 changes: 10 additions & 0 deletions sound/pci/cs46xx/cs46xx_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
struct dsp_symbol_entry *cs46xx_dsp_lookup_symbol (struct snd_cs46xx * chip, char * symbol_name,
int symbol_type);
#ifdef CONFIG_PROC_FS
int cs46xx_dsp_proc_init (struct snd_card *card, 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 snd_cs46xx_download (struct snd_cs46xx *chip, u32 *src, unsigned long offset,
unsigned long len);
Expand All @@ -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);
struct dsp_scb_descriptor * cs46xx_dsp_create_scb (struct snd_cs46xx *chip, char * name,
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_register_scb_desc (struct snd_cs46xx *chip,
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_codec_out_scb(struct snd_cs46xx * chip,
Expand Down
2 changes: 2 additions & 0 deletions sound/pci/cs46xx/dsp_spos.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
cs46xx_dsp_lookup_symbol_addr (struct snd_cs46xx * chip, u32 address, int symbol_type)
{
Expand Down Expand Up @@ -912,6 +913,7 @@ int cs46xx_dsp_proc_done (struct snd_cs46xx *chip)

return 0;
}
#endif /* CONFIG_PROC_FS */

static int debug_tree;
static void _dsp_create_task_tree (struct snd_cs46xx *chip, u32 * task_data,
Expand Down
4 changes: 4 additions & 0 deletions sound/pci/cs46xx/dsp_spos_scb_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
struct snd_info_buffer *buffer)
{
Expand Down Expand Up @@ -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);
up(&chip->spos_mutex);
}
#endif

static void _dsp_unlink_scb (struct snd_cs46xx *chip, struct dsp_scb_descriptor * scb)
{
Expand Down Expand Up @@ -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)
{
if (scb->proc_info) {
Expand Down Expand Up @@ -275,6 +278,7 @@ void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip,
scb->proc_info = entry;
}
}
#endif /* CONFIG_PROC_FS */

static struct dsp_scb_descriptor *
_dsp_create_generic_scb (struct snd_cs46xx *chip, char * name, u32 * scb_data, u32 dest,
Expand Down
2 changes: 2 additions & 0 deletions sound/pci/emu10k1/emu10k1_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
goto error;

#ifdef CONFIG_PROC_FS
snd_emu10k1_proc_init(emu);
#endif

snd_card_set_dev(card, &pci->dev);
*remu = emu;
Expand Down
2 changes: 2 additions & 0 deletions sound/pci/emu10k1/emuproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <sound/emu10k1.h>
#include "p16v.h"

#ifdef CONFIG_PROC_FS
static void snd_emu10k1_proc_spdif_status(struct snd_emu10k1 * emu,
struct snd_info_buffer *buffer,
char *title,
Expand Down Expand Up @@ -620,3 +621,4 @@ int __devinit snd_emu10k1_proc_init(struct snd_emu10k1 * emu)
}
return 0;
}
#endif /* CONFIG_PROC_FS */
4 changes: 4 additions & 0 deletions sound/pci/intel8x0.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

#ifdef CONFIG_PROC_FS
static void snd_intel8x0_proc_read(struct snd_info_entry * entry,
struct snd_info_buffer *buffer)
{
Expand Down Expand Up @@ -2612,6 +2613,9 @@ static void __devinit snd_intel8x0_proc_init(struct intel8x0 * chip)
if (! snd_card_proc_new(chip->card, "intel8x0", &entry))
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)
{
Expand Down
5 changes: 5 additions & 0 deletions sound/pci/intel8x0m.c
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,7 @@ static int intel8x0m_resume(struct pci_dev *pci)
}
#endif /* CONFIG_PM */

#ifdef CONFIG_PROC_FS
static void snd_intel8x0m_proc_read(struct snd_info_entry * entry,
struct snd_info_buffer *buffer)
{
Expand Down Expand Up @@ -1093,6 +1094,10 @@ static void __devinit snd_intel8x0m_proc_init(struct intel8x0m * chip)
if (! snd_card_proc_new(chip->card, "intel8x0m", &entry))
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)
{
Expand Down

0 comments on commit adf1b3d

Please sign in to comment.