From 443bdab5db1cd5494e94aa7031c4a25e33a9c6bb Mon Sep 17 00:00:00 2001 From: Mark Farrugia Date: Fri, 1 Mar 2019 17:15:22 +1100 Subject: Refactor avirt_private_free Explicitly define callback type, refactor name Signed-off-by: Mark Farrugia --- core.c | 9 +++++---- sound/avirt.h | 23 ++++++++++++++--------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/core.c b/core.c index 7541ade..c1f6393 100644 --- a/core.c +++ b/core.c @@ -203,13 +203,14 @@ static void destroy_snd_avirt_audiopath_obj(struct snd_avirt_audiopath_obj *p) } /** - * pcm_private_data_free - callback function to free private data allocated to pcm - * @pcm: the PCM with private data + * pcm_private_free - callback function to free private data allocated to pcm + * @pcm: the PCM object */ -static void pcm_private_data_free(struct snd_pcm *pcm) +static void pcm_private_free(struct snd_pcm *pcm) { struct snd_avirt_private_data *avirt_private_data; + /* Free Audio Path private data */ avirt_private_data = (struct snd_avirt_private_data *)pcm->private_data; if (avirt_private_data) { if (avirt_private_data->ap_private_data && @@ -260,7 +261,7 @@ static struct snd_pcm *snd_avirt_pcm_create(struct snd_avirt_stream *stream) avirt_private_data = kzalloc(sizeof(*avirt_private_data), GFP_KERNEL); pcm->private_data = avirt_private_data; // Set the private free function for the private user data - pcm->private_free = pcm_private_data_free; + pcm->private_free = pcm_private_free; snd_device_register(core.card, pcm); diff --git a/sound/avirt.h b/sound/avirt.h index 6f15143..cb9a61e 100644 --- a/sound/avirt.h +++ b/sound/avirt.h @@ -65,6 +65,19 @@ struct snd_avirt_stream { struct config_item item; /* configfs item reference */ }; +/** + * Audio stream group + */ +struct snd_avirt_stream_array { + struct snd_avirt_stream *streams[MAX_STREAMS]; + int count; +}; + +/** + * snd_avirt_private_free - free Audio Path private data from function prototype + * @pcm: The PCM object + */ +typedef void (*snd_avirt_ap_private_free)(struct snd_pcm *pcm); /** * Private Data Expansion */ @@ -72,15 +85,7 @@ struct snd_avirt_private_data { struct snd_avirt_audiopath *audiopath; void *ap_private_data; - void (*ap_private_free)(struct snd_pcm *pcm); -}; - -/** - * Audio stream group - */ -struct snd_avirt_stream_array { - struct snd_avirt_stream *streams[MAX_STREAMS]; - int count; + snd_avirt_ap_private_free ap_private_free; }; /** -- cgit 1.2.3-korg