ASoC: Constify return of snd_soc_dai_get_pcm_stream()

Returned 'struct snd_soc_pcm_stream' by snd_soc_dai_get_pcm_stream() is
not modified by the users, so it can be changed as pointer to const.
This is a necessary step towards making the 'dai->driver' a pointer to
const.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://msgid.link/r/20240617-n-asoc-const-auto-selectable-formats-v1-5-8004f346ee38@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Krzysztof Kozlowski 2024-06-17 15:03:23 +02:00 committed by Mark Brown
parent 785d64c494
commit de267e7a6e
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
4 changed files with 17 additions and 17 deletions

View File

@ -473,7 +473,7 @@ struct snd_soc_dai {
unsigned int probed:1;
};
static inline struct snd_soc_pcm_stream *
static inline const struct snd_soc_pcm_stream *
snd_soc_dai_get_pcm_stream(const struct snd_soc_dai *dai, int stream)
{
return (stream == SNDRV_PCM_STREAM_PLAYBACK) ?

View File

@ -341,7 +341,7 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct sn
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_stream *stream_info;
const struct snd_soc_pcm_stream *stream_info;
struct hdac_ext_stream *link_stream;
struct hdac_ext_link *link;
struct avs_dma_data *data;
@ -637,7 +637,7 @@ static int avs_dai_fe_hw_free(struct snd_pcm_substream *substream, struct snd_so
static int avs_dai_fe_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_stream *stream_info;
const struct snd_soc_pcm_stream *stream_info;
struct avs_dma_data *data;
struct hdac_ext_stream *host_stream;
unsigned int format_val;

View File

@ -473,7 +473,7 @@ int snd_soc_dai_compress_new(struct snd_soc_dai *dai,
*/
bool snd_soc_dai_stream_valid(const struct snd_soc_dai *dai, int dir)
{
struct snd_soc_pcm_stream *stream = snd_soc_dai_get_pcm_stream(dai, dir);
const struct snd_soc_pcm_stream *stream = snd_soc_dai_get_pcm_stream(dai, dir);
/* If the codec specifies any channels at all, it supports the stream */
return stream->channels_min;

View File

@ -504,7 +504,7 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream)
unsigned int bits = 0, cpu_bits = 0;
for_each_rtd_codec_dais(rtd, i, codec_dai) {
struct snd_soc_pcm_stream *pcm_codec = snd_soc_dai_get_pcm_stream(codec_dai, stream);
const struct snd_soc_pcm_stream *pcm_codec = snd_soc_dai_get_pcm_stream(codec_dai, stream);
if (pcm_codec->sig_bits == 0) {
bits = 0;
@ -514,7 +514,7 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream)
}
for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
struct snd_soc_pcm_stream *pcm_cpu = snd_soc_dai_get_pcm_stream(cpu_dai, stream);
const struct snd_soc_pcm_stream *pcm_cpu = snd_soc_dai_get_pcm_stream(cpu_dai, stream);
if (pcm_cpu->sig_bits == 0) {
cpu_bits = 0;
@ -538,7 +538,7 @@ static void soc_pcm_hw_init(struct snd_pcm_hardware *hw)
}
static void soc_pcm_hw_update_rate(struct snd_pcm_hardware *hw,
struct snd_soc_pcm_stream *p)
const struct snd_soc_pcm_stream *p)
{
hw->rates = snd_pcm_rate_mask_intersect(hw->rates, p->rates);
@ -551,20 +551,20 @@ static void soc_pcm_hw_update_rate(struct snd_pcm_hardware *hw,
}
static void soc_pcm_hw_update_chan(struct snd_pcm_hardware *hw,
struct snd_soc_pcm_stream *p)
const struct snd_soc_pcm_stream *p)
{
hw->channels_min = max(hw->channels_min, p->channels_min);
hw->channels_max = min(hw->channels_max, p->channels_max);
}
static void soc_pcm_hw_update_format(struct snd_pcm_hardware *hw,
struct snd_soc_pcm_stream *p)
const struct snd_soc_pcm_stream *p)
{
hw->formats &= p->formats;
}
static void soc_pcm_hw_update_subformat(struct snd_pcm_hardware *hw,
struct snd_soc_pcm_stream *p)
const struct snd_soc_pcm_stream *p)
{
hw->subformats &= p->subformats;
}
@ -583,8 +583,8 @@ int snd_soc_runtime_calc_hw(struct snd_soc_pcm_runtime *rtd,
{
struct snd_soc_dai *codec_dai;
struct snd_soc_dai *cpu_dai;
struct snd_soc_pcm_stream *codec_stream;
struct snd_soc_pcm_stream *cpu_stream;
const struct snd_soc_pcm_stream *codec_stream;
const struct snd_soc_pcm_stream *cpu_stream;
unsigned int cpu_chan_min = 0, cpu_chan_max = UINT_MAX;
int i;
@ -1712,7 +1712,7 @@ static void dpcm_runtime_setup_fe(struct snd_pcm_substream *substream)
hw->formats &= formats;
for_each_rtd_cpu_dais(fe, i, dai) {
struct snd_soc_pcm_stream *cpu_stream;
const struct snd_soc_pcm_stream *cpu_stream;
/*
* Skip CPUs which don't support the current stream
@ -1750,7 +1750,7 @@ static void dpcm_runtime_setup_be_format(struct snd_pcm_substream *substream)
for_each_dpcm_be(fe, stream, dpcm) {
struct snd_soc_pcm_runtime *be = dpcm->be;
struct snd_soc_pcm_stream *codec_stream;
const struct snd_soc_pcm_stream *codec_stream;
int i;
for_each_rtd_codec_dais(be, i, dai) {
@ -1787,7 +1787,7 @@ static void dpcm_runtime_setup_be_chan(struct snd_pcm_substream *substream)
for_each_dpcm_be(fe, stream, dpcm) {
struct snd_soc_pcm_runtime *be = dpcm->be;
struct snd_soc_pcm_stream *cpu_stream;
const struct snd_soc_pcm_stream *cpu_stream;
struct snd_soc_dai *dai;
int i;
@ -1809,7 +1809,7 @@ static void dpcm_runtime_setup_be_chan(struct snd_pcm_substream *substream)
* DAIs connected to a single CPU DAI, use CPU DAI's directly
*/
if (be->dai_link->num_codecs == 1) {
struct snd_soc_pcm_stream *codec_stream = snd_soc_dai_get_pcm_stream(
const struct snd_soc_pcm_stream *codec_stream = snd_soc_dai_get_pcm_stream(
snd_soc_rtd_to_codec(be, 0), stream);
soc_pcm_hw_update_chan(hw, codec_stream);
@ -1835,7 +1835,7 @@ static void dpcm_runtime_setup_be_rate(struct snd_pcm_substream *substream)
for_each_dpcm_be(fe, stream, dpcm) {
struct snd_soc_pcm_runtime *be = dpcm->be;
struct snd_soc_pcm_stream *pcm;
const struct snd_soc_pcm_stream *pcm;
struct snd_soc_dai *dai;
int i;