Skip to contentSkip to conversation

ALSA: misc cleanups

PATCH In review Adrian Bunk 3 participants 4 messages Dec 6, 2004 – Dec 7, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: misc cleanups

The patch below contains the following changes in ALSA code not touched by my previous patches:
- make some needlessly global code static
- remove the following unused global functions:
- sound/i2c/cs84: snd_cs8427_detect
- sound/synth/emux/emux_synth.c: snd_emux_release_voice
- sound/synth/emux/soundfont.: snd_soundfont_mem_used
- remove the following unused EXPORT_SYMBOL's:
- sound/i2c/cs8427.c: snd_cs8427_detect
- sound/i2c/cs8427.c: snd_cs8427_reg_read

Please review which of these changes are correct and which conflict with pending patches.

diffstat output:

 include/sound/cs8427.h          |    3 ---
 include/sound/soundfont.h       |    1 -
 include/sound/vx_core.h         |    1 -
 sound/drivers/opl3/opl3_drums.c |    8 ++++----
 sound/drivers/opl3/opl3_lib.c   |    4 ++--
 sound/drivers/opl3/opl3_midi.c  |    2 +-
 sound/drivers/opl3/opl3_seq.c   |    4 ++--
 sound/drivers/vx/vx_cmd.c       |    2 +-
 sound/drivers/vx/vx_cmd.h       |    2 --
 sound/drivers/vx/vx_uer.c       |    2 +-
 sound/i2c/cs8427.c              |   18 ++++--------------
 sound/synth/emux/emux_synth.c   |   10 ----------
 sound/synth/emux/soundfont.c    |    8 --------
 13 files changed, 15 insertions(+), 50 deletions(-)
sound/drivers/opl3/opl3_drums.c renamed from sound/drivers/opl3/opl3_drums.c.old +4 -4
@@ -80,7 +80,7 @@
 /*
  * set drum voice characteristics
  */
-void snd_opl3_drum_voice_set(opl3_t *opl3, snd_opl3_drum_voice_t *data)
+static void snd_opl3_drum_voice_set(opl3_t *opl3, snd_opl3_drum_voice_t *data)
 {
 	unsigned char op_offset = snd_opl3_regmap[data->voice][data->op];
 	unsigned char voice_offset = data->voice;
@@ -114,7 +114,7 @@
 /*
  * Set drum voice pitch
  */
-void snd_opl3_drum_note_set(opl3_t *opl3, snd_opl3_drum_note_t *data)
+static void snd_opl3_drum_note_set(opl3_t *opl3, snd_opl3_drum_note_t *data)
 {
 	unsigned char voice_offset = data->voice;
 	unsigned short opl3_reg;
@@ -131,8 +131,8 @@
 /*
  * Set drum voice volume and position
  */
-void snd_opl3_drum_vol_set(opl3_t *opl3, snd_opl3_drum_voice_t *data, int vel,
-			   snd_midi_channel_t *chan)
+static void snd_opl3_drum_vol_set(opl3_t *opl3, snd_opl3_drum_voice_t *data,
+				  int vel, snd_midi_channel_t *chan)
 {
 	unsigned char op_offset = snd_opl3_regmap[data->voice][data->op];
 	unsigned char voice_offset = data->voice;
sound/drivers/opl3/opl3_lib.c renamed from sound/drivers/opl3/opl3_lib.c.old +2 -2
@@ -37,7 +37,7 @@
 
 extern char snd_opl3_regmap[MAX_OPL2_VOICES][4];
 
-void snd_opl2_command(opl3_t * opl3, unsigned short cmd, unsigned char val)
+static void snd_opl2_command(opl3_t * opl3, unsigned short cmd, unsigned char val)
 {
 	unsigned long flags;
 	unsigned long port;
@@ -60,7 +60,7 @@
 	spin_unlock_irqrestore(&opl3->reg_lock, flags);
 }
 
-void snd_opl3_command(opl3_t * opl3, unsigned short cmd, unsigned char val)
+static void snd_opl3_command(opl3_t * opl3, unsigned short cmd, unsigned char val)
 {
 	unsigned long flags;
 	unsigned long port;
sound/drivers/opl3/opl3_midi.c renamed from sound/drivers/opl3/opl3_midi.c.old +1 -1
@@ -263,7 +263,7 @@
 /*
  * Start system timer
  */
-void snd_opl3_start_timer(opl3_t *opl3)
+static void snd_opl3_start_timer(opl3_t *opl3)
 {
 	unsigned long flags;
 	spin_lock_irqsave(&opl3->sys_timer_lock, flags);
sound/drivers/opl3/opl3_seq.c renamed from sound/drivers/opl3/opl3_seq.c.old +2 -2
@@ -96,7 +96,7 @@
 	up(&opl3->access_mutex);
 }
 
-int snd_opl3_synth_use(void *private_data, snd_seq_port_subscribe_t * info)
+static int snd_opl3_synth_use(void *private_data, snd_seq_port_subscribe_t * info)
 {
 	opl3_t *opl3 = private_data;
 	int err;
@@ -123,7 +123,7 @@
 	return 0;
 }
 
-int snd_opl3_synth_unuse(void *private_data, snd_seq_port_subscribe_t * info)
+static int snd_opl3_synth_unuse(void *private_data, snd_seq_port_subscribe_t * info)
 {
 	opl3_t *opl3 = private_data;
 
sound/drivers/vx/vx_cmd.h renamed from sound/drivers/vx/vx_cmd.h.old +0 -2
@@ -209,8 +209,6 @@
 /*
  *
  */
-extern struct vx_cmd_info vx_dsp_cmds[];
-
 void vx_init_rmh(struct vx_rmh *rmh, unsigned int cmd);
 
 /**
sound/drivers/vx/vx_cmd.c renamed from sound/drivers/vx/vx_cmd.c.old +1 -1
@@ -29,7 +29,7 @@
 /*
  * Array of DSP commands
  */
-struct vx_cmd_info vx_dsp_cmds[] = {
+static struct vx_cmd_info vx_dsp_cmds[] = {
 [CMD_VERSION] =			{ 0x010000, 2, RMH_SSIZE_FIXED, 1 },
 [CMD_SUPPORTED] =		{ 0x020000, 1, RMH_SSIZE_FIXED, 2 },
 [CMD_TEST_IT] =			{ 0x040000, 1, RMH_SSIZE_FIXED, 1 },
include/sound/vx_core.h renamed from include/sound/vx_core.h.old +0 -1
@@ -340,7 +340,6 @@
  */
 void vx_set_iec958_status(vx_core_t *chip, unsigned int bits);
 int vx_set_clock(vx_core_t *chip, unsigned int freq);
-void vx_change_clock_source(vx_core_t *chip, int source);
 void vx_set_internal_clock(vx_core_t *chip, unsigned int freq);
 int vx_change_frequency(vx_core_t *chip);
 
sound/drivers/vx/vx_uer.c renamed from sound/drivers/vx/vx_uer.c.old +1 -1
@@ -197,7 +197,7 @@
  * vx_change_clock_source - change the clock source
  * @source: the new source
  */
-void vx_change_clock_source(vx_core_t *chip, int source)
+static void vx_change_clock_source(vx_core_t *chip, int source)
 {
 	unsigned long flags;
 
include/sound/cs8427.h renamed from include/sound/cs8427.h.old +0 -3
@@ -186,12 +186,9 @@
 #define CS8427_VERSHIFT		0
 #define CS8427_VER8427A		0x71
 
-int snd_cs8427_detect(snd_i2c_bus_t *bus, unsigned char addr);
 int snd_cs8427_create(snd_i2c_bus_t *bus, unsigned char addr,
 		      unsigned int reset_timeout, snd_i2c_device_t **r_cs8427);
-void snd_cs8427_reset(snd_i2c_device_t *cs8427);
 int snd_cs8427_reg_write(snd_i2c_device_t *device, unsigned char reg, unsigned char val);
-int snd_cs8427_reg_read(snd_i2c_device_t *device, unsigned char reg);
 int snd_cs8427_iec958_build(snd_i2c_device_t *cs8427, snd_pcm_substream_t *playback_substream, snd_pcm_substream_t *capture_substream);
 int snd_cs8427_iec958_active(snd_i2c_device_t *cs8427, int active);
 int snd_cs8427_iec958_pcm(snd_i2c_device_t *cs8427, unsigned int rate);
sound/i2c/cs8427.c renamed from sound/i2c/cs8427.c.old +4 -14
@@ -30,6 +30,8 @@
 #include <sound/cs8427.h>
 #include <sound/asoundef.h>
 
+static void snd_cs8427_reset(snd_i2c_device_t *cs8427);
+
 MODULE_AUTHOR("Jaroslav Kysela <[email protected]>");
 MODULE_DESCRIPTION("IEC958 (S/PDIF) receiver & transmitter by Cirrus Logic");
 MODULE_LICENSE("GPL");
@@ -65,16 +67,6 @@
 	return res;
 }
 
-int snd_cs8427_detect(snd_i2c_bus_t *bus, unsigned char addr)
-{
-	int res;
-
-	snd_i2c_lock(bus);
-	res = snd_i2c_probeaddr(bus, CS8427_ADDR | (addr & 7));
-	snd_i2c_unlock(bus);
-	return res;
-}
-
 int snd_cs8427_reg_write(snd_i2c_device_t *device, unsigned char reg, unsigned char val)
 {
 	int err;
@@ -89,7 +81,7 @@
 	return 0;
 }
 
-int snd_cs8427_reg_read(snd_i2c_device_t *device, unsigned char reg)
+static int snd_cs8427_reg_read(snd_i2c_device_t *device, unsigned char reg)
 {
 	int err;
 	unsigned char buf;
@@ -288,7 +280,7 @@
  * put back AES3INPUT. This workaround is described in latest
  * CS8427 datasheet, otherwise TXDSERIAL will not work.
  */
-void snd_cs8427_reset(snd_i2c_device_t *cs8427)
+static void snd_cs8427_reset(snd_i2c_device_t *cs8427)
 {
 	cs8427_t *chip;
 	unsigned long end_time;
@@ -573,11 +565,9 @@
 module_init(alsa_cs8427_module_init)
 module_exit(alsa_cs8427_module_exit)
 
-EXPORT_SYMBOL(snd_cs8427_detect);
 EXPORT_SYMBOL(snd_cs8427_create);
 EXPORT_SYMBOL(snd_cs8427_reset);
 EXPORT_SYMBOL(snd_cs8427_reg_write);
-EXPORT_SYMBOL(snd_cs8427_reg_read);
 EXPORT_SYMBOL(snd_cs8427_iec958_build);
 EXPORT_SYMBOL(snd_cs8427_iec958_active);
 EXPORT_SYMBOL(snd_cs8427_iec958_pcm);
sound/synth/emux/emux_synth.c renamed from sound/synth/emux/emux_synth.c.old +0 -10
@@ -363,16 +363,6 @@
 
 
 /*
- * for Emu10k1 - release at least 1 voice currently using
- */
-int
-snd_emux_release_voice(snd_emux_t *emu)
-{
-	return 0;
-}
-
-
-/*
  * terminate note - if free flag is true, free the terminated voice
  */
 static void
include/sound/soundfont.h renamed from include/sound/soundfont.h.old +0 -1
@@ -112,7 +112,6 @@
 
 int snd_soundfont_remove_samples(snd_sf_list_t *sflist);
 int snd_soundfont_remove_unlocked(snd_sf_list_t *sflist);
-int snd_soundfont_mem_used(snd_sf_list_t *sflist);
 
 int snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel,
 			      int preset, int bank,
sound/synth/emux/soundfont.c renamed from sound/synth/emux/soundfont.c.old +0 -8
@@ -1460,11 +1460,3 @@
 	return 0;
 }
 
-/*
- * Return the used memory size (in words)
- */
-int
-snd_soundfont_mem_used(snd_sf_list_t *sflist)
-{
-	return sflist->mem_used;
-}
#1 lore raw
Quoted 1 line · Adrian Bunk

- sound/synth/emux/emux_synth.c: snd_emux_release_voice

Hmm, this should be used. I will check it out.

Quoted 1 line

- sound/synth/emux/soundfont.: snd_soundfont_mem_used

This one should be used also.

Lee

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/

#2 lore raw

At Mon, 06 Dec 2004 13:44:10 -0500,

Quoted 5 lines · Lee Revell
Quoted 1 line · Adrian Bunk

- sound/synth/emux/emux_synth.c: snd_emux_release_voice

Hmm, this should be used. I will check it out.

It's ok. It's neither used nor exported.
Looks like an obsolete function.

Quoted 3 lines
Quoted 1 line

- sound/synth/emux/soundfont.: snd_soundfont_mem_used

This one should be used also.

It should be ok, too. It's a one-line accessor, so the driver can read the value directly from the struct instead.

Takashi

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/

#3 lore raw
In reply to Adrian Bunk

At Mon, 6 Dec 2004 01:12:21 +0100,

Quoted 12 lines · Adrian Bunk

The patch below contains the following changes in ALSA code not touched by my previous patches:
- make some needlessly global code static
- remove the following unused global functions:
- sound/i2c/cs84: snd_cs8427_detect
- sound/synth/emux/emux_synth.c: snd_emux_release_voice
- sound/synth/emux/soundfont.: snd_soundfont_mem_used
- remove the following unused EXPORT_SYMBOL's:
- sound/i2c/cs8427.c: snd_cs8427_detect
- sound/i2c/cs8427.c: snd_cs8427_reg_read

Quoted 2 lines

Please review which of these changes are correct and which conflict with pending patches.

All applied to the ALSA tree. Thanks!

Takashi

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/