Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: soc-pcm: makes snd_soc_dpcm_can_be_xxx() local

Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

No driver is calling snd_soc_dpcm_can_be_xxx() functions. We don't need
to have EXPORT_SYMBOL_GPL() for them. This patch-set makes it static function.

+99 -120
-18
include/sound/soc-dpcm.h
··· 113 113 #define for_each_dpcm_be_rollback(fe, stream, _dpcm) \ 114 114 list_for_each_entry_continue_reverse(_dpcm, &(fe)->dpcm[stream].be_clients, list_be) 115 115 116 - /* can this BE stop and free */ 117 - int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe, 118 - struct snd_soc_pcm_runtime *be, int stream); 119 - 120 - /* can this BE perform a hw_params() */ 121 - int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe, 122 - struct snd_soc_pcm_runtime *be, int stream); 123 - 124 - /* can this BE perform prepare */ 125 - int snd_soc_dpcm_can_be_prepared(struct snd_soc_pcm_runtime *fe, 126 - struct snd_soc_pcm_runtime *be, int stream); 127 - 128 - /* is the current PCM operation for this FE ? */ 129 - int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream); 130 - 131 - /* is the current PCM operation for this BE ? */ 132 - int snd_soc_dpcm_be_can_update(struct snd_soc_pcm_runtime *fe, 133 - struct snd_soc_pcm_runtime *be, int stream); 134 116 135 117 /* get the substream for this BE */ 136 118 struct snd_pcm_substream *
+99 -102
sound/soc/soc-pcm.c
··· 49 49 return ret; 50 50 } 51 51 52 + /* is the current PCM operation for this FE ? */ 53 + #if 0 54 + static int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream) 55 + { 56 + if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) 57 + return 1; 58 + return 0; 59 + } 60 + #endif 61 + 62 + /* is the current PCM operation for this BE ? */ 63 + static int snd_soc_dpcm_be_can_update(struct snd_soc_pcm_runtime *fe, 64 + struct snd_soc_pcm_runtime *be, int stream) 65 + { 66 + if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || 67 + ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && 68 + be->dpcm[stream].runtime_update)) 69 + return 1; 70 + return 0; 71 + } 72 + 73 + static int snd_soc_dpcm_check_state(struct snd_soc_pcm_runtime *fe, 74 + struct snd_soc_pcm_runtime *be, 75 + int stream, 76 + const enum snd_soc_dpcm_state *states, 77 + int num_states) 78 + { 79 + struct snd_soc_dpcm *dpcm; 80 + int state; 81 + int ret = 1; 82 + int i; 83 + 84 + for_each_dpcm_fe(be, stream, dpcm) { 85 + 86 + if (dpcm->fe == fe) 87 + continue; 88 + 89 + state = dpcm->fe->dpcm[stream].state; 90 + for (i = 0; i < num_states; i++) { 91 + if (state == states[i]) { 92 + ret = 0; 93 + break; 94 + } 95 + } 96 + } 97 + 98 + /* it's safe to do this BE DAI */ 99 + return ret; 100 + } 101 + 102 + /* 103 + * We can only hw_free, stop, pause or suspend a BE DAI if any of it's FE 104 + * are not running, paused or suspended for the specified stream direction. 105 + */ 106 + static int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe, 107 + struct snd_soc_pcm_runtime *be, int stream) 108 + { 109 + const enum snd_soc_dpcm_state state[] = { 110 + SND_SOC_DPCM_STATE_START, 111 + SND_SOC_DPCM_STATE_PAUSED, 112 + SND_SOC_DPCM_STATE_SUSPEND, 113 + }; 114 + 115 + return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); 116 + } 117 + 118 + /* 119 + * We can only change hw params a BE DAI if any of it's FE are not prepared, 120 + * running, paused or suspended for the specified stream direction. 121 + */ 122 + static int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe, 123 + struct snd_soc_pcm_runtime *be, int stream) 124 + { 125 + const enum snd_soc_dpcm_state state[] = { 126 + SND_SOC_DPCM_STATE_START, 127 + SND_SOC_DPCM_STATE_PAUSED, 128 + SND_SOC_DPCM_STATE_SUSPEND, 129 + SND_SOC_DPCM_STATE_PREPARE, 130 + }; 131 + 132 + return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); 133 + } 134 + 135 + /* 136 + * We can only prepare a BE DAI if any of it's FE are not prepared, 137 + * running or paused for the specified stream direction. 138 + */ 139 + static int snd_soc_dpcm_can_be_prepared(struct snd_soc_pcm_runtime *fe, 140 + struct snd_soc_pcm_runtime *be, int stream) 141 + { 142 + const enum snd_soc_dpcm_state state[] = { 143 + SND_SOC_DPCM_STATE_START, 144 + SND_SOC_DPCM_STATE_PAUSED, 145 + SND_SOC_DPCM_STATE_PREPARE, 146 + }; 147 + 148 + return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); 149 + } 150 + 52 151 #define DPCM_MAX_BE_USERS 8 53 152 54 153 static inline const char *soc_cpu_dai_name(struct snd_soc_pcm_runtime *rtd) ··· 3068 2969 return ret; 3069 2970 } 3070 2971 3071 - /* is the current PCM operation for this FE ? */ 3072 - int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream) 3073 - { 3074 - if (fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) 3075 - return 1; 3076 - return 0; 3077 - } 3078 - EXPORT_SYMBOL_GPL(snd_soc_dpcm_fe_can_update); 3079 - 3080 - /* is the current PCM operation for this BE ? */ 3081 - int snd_soc_dpcm_be_can_update(struct snd_soc_pcm_runtime *fe, 3082 - struct snd_soc_pcm_runtime *be, int stream) 3083 - { 3084 - if ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_FE) || 3085 - ((fe->dpcm[stream].runtime_update == SND_SOC_DPCM_UPDATE_BE) && 3086 - be->dpcm[stream].runtime_update)) 3087 - return 1; 3088 - return 0; 3089 - } 3090 - EXPORT_SYMBOL_GPL(snd_soc_dpcm_be_can_update); 3091 - 3092 2972 /* get the substream for this BE */ 3093 2973 struct snd_pcm_substream * 3094 2974 snd_soc_dpcm_get_substream(struct snd_soc_pcm_runtime *be, int stream) ··· 3075 2997 return be->pcm->streams[stream].substream; 3076 2998 } 3077 2999 EXPORT_SYMBOL_GPL(snd_soc_dpcm_get_substream); 3078 - 3079 - static int snd_soc_dpcm_check_state(struct snd_soc_pcm_runtime *fe, 3080 - struct snd_soc_pcm_runtime *be, 3081 - int stream, 3082 - const enum snd_soc_dpcm_state *states, 3083 - int num_states) 3084 - { 3085 - struct snd_soc_dpcm *dpcm; 3086 - int state; 3087 - int ret = 1; 3088 - int i; 3089 - 3090 - for_each_dpcm_fe(be, stream, dpcm) { 3091 - 3092 - if (dpcm->fe == fe) 3093 - continue; 3094 - 3095 - state = dpcm->fe->dpcm[stream].state; 3096 - for (i = 0; i < num_states; i++) { 3097 - if (state == states[i]) { 3098 - ret = 0; 3099 - break; 3100 - } 3101 - } 3102 - } 3103 - 3104 - /* it's safe to do this BE DAI */ 3105 - return ret; 3106 - } 3107 - 3108 - /* 3109 - * We can only hw_free, stop, pause or suspend a BE DAI if any of it's FE 3110 - * are not running, paused or suspended for the specified stream direction. 3111 - */ 3112 - int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe, 3113 - struct snd_soc_pcm_runtime *be, int stream) 3114 - { 3115 - const enum snd_soc_dpcm_state state[] = { 3116 - SND_SOC_DPCM_STATE_START, 3117 - SND_SOC_DPCM_STATE_PAUSED, 3118 - SND_SOC_DPCM_STATE_SUSPEND, 3119 - }; 3120 - 3121 - return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); 3122 - } 3123 - EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_free_stop); 3124 - 3125 - /* 3126 - * We can only change hw params a BE DAI if any of it's FE are not prepared, 3127 - * running, paused or suspended for the specified stream direction. 3128 - */ 3129 - int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe, 3130 - struct snd_soc_pcm_runtime *be, int stream) 3131 - { 3132 - const enum snd_soc_dpcm_state state[] = { 3133 - SND_SOC_DPCM_STATE_START, 3134 - SND_SOC_DPCM_STATE_PAUSED, 3135 - SND_SOC_DPCM_STATE_SUSPEND, 3136 - SND_SOC_DPCM_STATE_PREPARE, 3137 - }; 3138 - 3139 - return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); 3140 - } 3141 - EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_params); 3142 - 3143 - /* 3144 - * We can only prepare a BE DAI if any of it's FE are not prepared, 3145 - * running or paused for the specified stream direction. 3146 - */ 3147 - int snd_soc_dpcm_can_be_prepared(struct snd_soc_pcm_runtime *fe, 3148 - struct snd_soc_pcm_runtime *be, int stream) 3149 - { 3150 - const enum snd_soc_dpcm_state state[] = { 3151 - SND_SOC_DPCM_STATE_START, 3152 - SND_SOC_DPCM_STATE_PAUSED, 3153 - SND_SOC_DPCM_STATE_PREPARE, 3154 - }; 3155 - 3156 - return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); 3157 - } 3158 - EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_prepared);