ALSA: core: removing unused functions
Subsystems (2)
cover ALSA: core: removing unused functions
From: "Dr. David Alan Gilbert" <[email protected]>
Hi,
This is a small set of deadcode removal from sound/core;
they're all full function removal rather than changing the code inside functions.
Dave
Dr. David Alan Gilbert (5):
ALSA: pcm: Remove unused snd_pcm_rate_range_to_bits
ALSA: pcm: Remove unused snd_dmaengine_pcm_open_request_chan
ALSA: seq: Remove unused snd_seq_queue_client_leave_cells
ALSA: core: Remove unused snd_device_get_state
ALSA: core: Remove unused snd_jack_set_parent
include/sound/core.h | 1 - include/sound/dmaengine_pcm.h | 2 -- include/sound/jack.h | 6 ------ include/sound/pcm.h | 2 -- sound/core/device.c | 23 ----------------------- sound/core/jack.c | 19 ------------------- sound/core/pcm_dmaengine.c | 21 --------------------- sound/core/pcm_misc.c | 30 ------------------------------ sound/core/seq/seq_queue.c | 16 ---------------- sound/core/seq/seq_queue.h | 1 - 10 files changed, 121 deletions(-)
Signature · 1 line
2.49.0
PATCH 1/5 ALSA: pcm: Remove unused snd_pcm_rate_range_to_bits
From: "Dr. David Alan Gilbert" <[email protected]>
The last use of snd_pcm_rate_range_to_bits() was removed in 2016 by commit b6b6e4d670c9 ("ASoC: topology: Fix setting of stream rates, rate_min and rate_max")
Remove it.
--- include/sound/pcm.h | 2 -- sound/core/pcm_misc.c | 30 ------------------------------ 2 files changed, 32 deletions(-)
include/sound/pcm.h +0 -2
@@ -1251,8 +1251,6 @@ unsigned int snd_pcm_rate_to_rate_bit(unsigned int rate);unsigned int snd_pcm_rate_bit_to_rate (unsigned int rate_bit);unsigned int snd_pcm_rate_mask_intersect (unsigned int rates_a,unsigned int rates_b); -unsigned int snd_pcm_rate_range_to_bits (unsigned int rate_min, -unsigned int rate_max);/** * snd_pcm_set_runtime_buffer - Set the PCM runtime buffer
sound/core/pcm_misc.c +0 -30
@@ -586,33 +586,3 @@ unsigned int snd_pcm_rate_mask_intersect(unsigned int rates_a,return rates_a & rates_b; }EXPORT_SYMBOL_GPL (snd_pcm_rate_mask_intersect); - -/** -* snd_pcm_rate_range_to_bits - converts rate range to SNDRV_PCM_RATE_xxx bit -* @rate_min: the minimum sample rate -* @rate_max: the maximum sample rate -* -* This function has an implicit assumption: the rates in the given range have -* only the pre-defined rates like 44100 or 16000. -* -* Return: The SNDRV_PCM_RATE_xxx flag that corresponds to the given rate range, -* or SNDRV_PCM_RATE_KNOT for an unknown range. -*/ -unsigned int snd_pcm_rate_range_to_bits (unsigned int rate_min, -unsigned int rate_max) -{ -unsigned int rates =0 ; -int i; - -for (i =0 ; i < snd_pcm_known_rates.count; i++) { -if (snd_pcm_known_rates.list[i] >= rate_min - && snd_pcm_known_rates.list[i] <= rate_max) - rates |=1 << i; - } - -if (!rates) - rates =SNDRV_PCM_RATE_KNOT ; - -return rates; -} -EXPORT_SYMBOL_GPL (snd_pcm_rate_range_to_bits);
Signature · 1 line
2.49.0
PATCH 2/5 ALSA: pcm: Remove unused snd_dmaengine_pcm_open_request_chan
In reply to [email protected]From: "Dr. David Alan Gilbert" <[email protected]>
snd_dmaengine_pcm_open_request_chan() last use was removed in 2022's commit b401d1fd8053 ("ASoC: pxa: remove unused board support")
Remove it.
--- include/sound/dmaengine_pcm.h | 2 -- sound/core/pcm_dmaengine.c | 21 --------------------- 2 files changed, 23 deletions(-)
include/sound/dmaengine_pcm.h +0 -2
@@ -38,8 +38,6 @@ int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream,int snd_dmaengine_pcm_close (struct snd_pcm_substream *substream);int snd_dmaengine_pcm_sync_stop (struct snd_pcm_substream *substream); -int snd_dmaengine_pcm_open_request_chan (struct snd_pcm_substream *substream, -dma_filter_fn filter_fn,void *filter_data);int snd_dmaengine_pcm_close_release_chan (struct snd_pcm_substream *substream); struct dma_chan *snd_dmaengine_pcm_request_channel(dma_filter_fn filter_fn,
sound/core/pcm_dmaengine.c +0 -21
@@ -328,27 +328,6 @@ int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream, }EXPORT_SYMBOL_GPL (snd_dmaengine_pcm_open); -/** -* snd_dmaengine_pcm_open_request_chan - Open a dmaengine based PCM substream and request channel -* @substream: PCM substream -* @filter_fn: Filter function used to request the DMA channel -* @filter_data: Data passed to the DMA filter function -* -* This function will request a DMA channel using the passed filter function and -* data. The function should usually be called from the pcm open callback. Note -* that this function will use private_data field of the substream's runtime. So -* it is not available to your pcm driver implementation. -* -* Return: 0 on success, a negative error code otherwise -*/ -int snd_dmaengine_pcm_open_request_chan (struct snd_pcm_substream *substream, -dma_filter_fn filter_fn,void *filter_data) -{ -return snd_dmaengine_pcm_open (substream, -snd_dmaengine_pcm_request_channel (filter_fn, filter_data)); -} -EXPORT_SYMBOL_GPL (snd_dmaengine_pcm_open_request_chan); -int snd_dmaengine_pcm_sync_stop (struct snd_pcm_substream *substream) {struct dmaengine_pcm_runtime_data *prtd =substream_to_prtd (substream);
Signature · 1 line
2.49.0
PATCH 3/5 ALSA: seq: Remove unused snd_seq_queue_client_leave_cells
In reply to [email protected]From: "Dr. David Alan Gilbert" <[email protected]>
The last use of snd_seq_queue_client_leave_cells() was removed in 2018 by
commit 85d59b57be59 ("ALSA: seq: Remove superfluous snd_seq_queue_client_leave_cells() call")
Remove it.
--- sound/core/seq/seq_queue.c | 16 ---------------- sound/core/seq/seq_queue.h | 1 - 2 files changed, 17 deletions(-)
sound/core/seq/seq_queue.c +0 -16
@@ -564,22 +564,6 @@ void snd_seq_queue_client_leave(int client)/*----------------------------------------------------------------*/ -/* remove cells from all queues */ -void snd_seq_queue_client_leave_cells (int client) -{ -int i; -struct snd_seq_queue *q; - -for (i =0 ; i <SNDRV_SEQ_MAX_QUEUES ; i++) { - q =queueptr (i); -if (!q) -continue ; -snd_seq_prioq_leave (q->tickq, client,0 ); -snd_seq_prioq_leave (q->timeq, client,0 ); -queuefree (q); - } -} -/* remove cells based on flush criteria */ void snd_seq_queue_remove_cells (int client,struct snd_seq_remove_events *info) {
sound/core/seq/seq_queue.h +0 -1
@@ -66,7 +66,6 @@ void snd_seq_queue_client_leave(int client);int snd_seq_enqueue_event (struct snd_seq_event_cell *cell,int atomic,int hop);/* Remove events */ -void snd_seq_queue_client_leave_cells (int client);void snd_seq_queue_remove_cells (int client,struct snd_seq_remove_events *info);/* return pointer to queue structure for specified id */
Signature · 1 line
2.49.0
PATCH 4/5 ALSA: core: Remove unused snd_device_get_state
In reply to [email protected]From: "Dr. David Alan Gilbert" <[email protected]>
snd_device_get_state() last use was removed in 2022 by
commit 7e1afce5866e ("ALSA: usb-audio: Inform the delayed registration more properly")
Remove it.
--- include/sound/core.h | 1 - sound/core/device.c | 23 ----------------------- 2 files changed, 24 deletions(-)
include/sound/core.h +0 -1
@@ -326,7 +326,6 @@ void snd_device_disconnect(struct snd_card *card, void *device_data);void snd_device_disconnect_all (struct snd_card *card);void snd_device_free (struct snd_card *card,void *device_data);void snd_device_free_all (struct snd_card *card); -int snd_device_get_state (struct snd_card *card,void *device_data);/* isadma.c */
sound/core/device.c +0 -23
@@ -237,26 +237,3 @@ void snd_device_free_all(struct snd_card *card)list_for_each_entry_safe_reverse (dev, next, &card->devices, list)__snd_device_free (dev); } - -/** -* snd_device_get_state - Get the current state of the given device -* @card: the card instance -* @device_data: the data pointer to release -* -* Returns the current state of the given device object. For the valid -* device, either @SNDRV_DEV_BUILD, @SNDRV_DEV_REGISTERED or -* @SNDRV_DEV_DISCONNECTED is returned. -* Or for a non-existing device, -1 is returned as an error. -* -* Return: the current state, or -1 if not found -*/ -int snd_device_get_state (struct snd_card *card,void *device_data) -{ -struct snd_device *dev; - - dev =look_for_dev (card, device_data); -if (dev) -return dev->state; -return -1 ; -} -EXPORT_SYMBOL_GPL (snd_device_get_state);
Signature · 1 line
2.49.0
PATCH 5/5 ALSA: core: Remove unused snd_jack_set_parent
In reply to [email protected]From: "Dr. David Alan Gilbert" <[email protected]>
snd_jack_set_parent() was added as part of 2008's commit e76d8ceaaff9 ("ALSA: Add jack reporting API")
but hasn't been used.
Remove it.
--- include/sound/jack.h | 6 ------ sound/core/jack.c | 19 ------------------- 2 files changed, 25 deletions(-)
include/sound/jack.h +0 -6
@@ -79,7 +79,6 @@ int snd_jack_new(struct snd_card *card, const char *id, int type, struct snd_jack **jack, bool initial_kctl, bool phantom_jack);int snd_jack_add_new_kctl (struct snd_jack *jack,const char * name,int mask);#ifdef CONFIG_SND_JACK_INPUT_DEV -void snd_jack_set_parent (struct snd_jack *jack,struct device *parent);int snd_jack_set_key (struct snd_jack *jack,enum snd_jack_types type,int keytype);#endif
@@ -104,11 +103,6 @@ static inline void snd_jack_report(struct snd_jack *jack, int status)#endif #if !defined(CONFIG_SND_JACK ) || !defined(CONFIG_SND_JACK_INPUT_DEV ) -static inline void snd_jack_set_parent (struct snd_jack *jack, -struct device *parent) -{ -} -static inline int snd_jack_set_key (struct snd_jack *jack,enum snd_jack_types type,int keytype)
sound/core/jack.c +0 -19
@@ -574,25 +574,6 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,EXPORT_SYMBOL (snd_jack_new);#ifdef CONFIG_SND_JACK_INPUT_DEV -/** -* snd_jack_set_parent - Set the parent device for a jack -* -* @jack: The jack to configure -* @parent: The device to set as parent for the jack. -* -* Set the parent for the jack devices in the device tree. This -* function is only valid prior to registration of the jack. If no -* parent is configured then the parent device will be the sound card. -*/ -void snd_jack_set_parent (struct snd_jack *jack,struct device *parent) -{ -WARN_ON (jack->registered); -guard (mutex)(&jack->input_dev_lock); -if (jack->input_dev) - jack->input_dev->dev.parent = parent; -} -EXPORT_SYMBOL (snd_jack_set_parent); -/** * snd_jack_set_key - Set a key mapping on a jack *
Signature · 1 line
2.49.0
Takashi Iwai
AppliedQuoted 13 lines · On Sat, 03 May 2025 01:52:14 +0200, [email protected] wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
Hi,
This is a small set of deadcode removal fromsound/core;
they're all full function removal rather than changing the code inside functions.Dave
Signed-off-by Dr. David Alan Gilbert <[email protected]>
Quoted 6 lines
Dr. David Alan Gilbert (5):
ALSA: pcm: Remove unusedsnd_pcm_rate_range_to_bits
ALSA: pcm: Remove unusedsnd_dmaengine_pcm_open_request_chan
ALSA: seq: Remove unusedsnd_seq_queue_client_leave_cells
ALSA: core: Remove unusedsnd_device_get_state
ALSA: core: Remove unusedsnd_jack_set_parent
Applied all patches now to for-next branch. Thanks.
Takashi