Commit d64e7f7c authored by Takashi Iwai's avatar Takashi Iwai

ALSA: dummy: More constifications

Apply const prefix to every possible place: mostly for declaring the
dummy hardware models.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-5-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 6b0f95c4
...@@ -117,7 +117,7 @@ struct dummy_model { ...@@ -117,7 +117,7 @@ struct dummy_model {
struct snd_dummy { struct snd_dummy {
struct snd_card *card; struct snd_card *card;
struct dummy_model *model; const struct dummy_model *model;
struct snd_pcm *pcm; struct snd_pcm *pcm;
struct snd_pcm_hardware pcm_hw; struct snd_pcm_hardware pcm_hw;
spinlock_t mixer_lock; spinlock_t mixer_lock;
...@@ -144,13 +144,13 @@ static int emu10k1_playback_constraints(struct snd_pcm_runtime *runtime) ...@@ -144,13 +144,13 @@ static int emu10k1_playback_constraints(struct snd_pcm_runtime *runtime)
return 0; return 0;
} }
static struct dummy_model model_emu10k1 = { static const struct dummy_model model_emu10k1 = {
.name = "emu10k1", .name = "emu10k1",
.playback_constraints = emu10k1_playback_constraints, .playback_constraints = emu10k1_playback_constraints,
.buffer_bytes_max = 128 * 1024, .buffer_bytes_max = 128 * 1024,
}; };
static struct dummy_model model_rme9652 = { static const struct dummy_model model_rme9652 = {
.name = "rme9652", .name = "rme9652",
.buffer_bytes_max = 26 * 64 * 1024, .buffer_bytes_max = 26 * 64 * 1024,
.formats = SNDRV_PCM_FMTBIT_S32_LE, .formats = SNDRV_PCM_FMTBIT_S32_LE,
...@@ -160,7 +160,7 @@ static struct dummy_model model_rme9652 = { ...@@ -160,7 +160,7 @@ static struct dummy_model model_rme9652 = {
.periods_max = 2, .periods_max = 2,
}; };
static struct dummy_model model_ice1712 = { static const struct dummy_model model_ice1712 = {
.name = "ice1712", .name = "ice1712",
.buffer_bytes_max = 256 * 1024, .buffer_bytes_max = 256 * 1024,
.formats = SNDRV_PCM_FMTBIT_S32_LE, .formats = SNDRV_PCM_FMTBIT_S32_LE,
...@@ -170,7 +170,7 @@ static struct dummy_model model_ice1712 = { ...@@ -170,7 +170,7 @@ static struct dummy_model model_ice1712 = {
.periods_max = 1024, .periods_max = 1024,
}; };
static struct dummy_model model_uda1341 = { static const struct dummy_model model_uda1341 = {
.name = "uda1341", .name = "uda1341",
.buffer_bytes_max = 16380, .buffer_bytes_max = 16380,
.formats = SNDRV_PCM_FMTBIT_S16_LE, .formats = SNDRV_PCM_FMTBIT_S16_LE,
...@@ -180,7 +180,7 @@ static struct dummy_model model_uda1341 = { ...@@ -180,7 +180,7 @@ static struct dummy_model model_uda1341 = {
.periods_max = 255, .periods_max = 255,
}; };
static struct dummy_model model_ac97 = { static const struct dummy_model model_ac97 = {
.name = "ac97", .name = "ac97",
.formats = SNDRV_PCM_FMTBIT_S16_LE, .formats = SNDRV_PCM_FMTBIT_S16_LE,
.channels_min = 2, .channels_min = 2,
...@@ -190,7 +190,7 @@ static struct dummy_model model_ac97 = { ...@@ -190,7 +190,7 @@ static struct dummy_model model_ac97 = {
.rate_max = 48000, .rate_max = 48000,
}; };
static struct dummy_model model_ca0106 = { static const struct dummy_model model_ca0106 = {
.name = "ca0106", .name = "ca0106",
.formats = SNDRV_PCM_FMTBIT_S16_LE, .formats = SNDRV_PCM_FMTBIT_S16_LE,
.buffer_bytes_max = ((65536-64)*8), .buffer_bytes_max = ((65536-64)*8),
...@@ -204,7 +204,7 @@ static struct dummy_model model_ca0106 = { ...@@ -204,7 +204,7 @@ static struct dummy_model model_ca0106 = {
.rate_max = 192000, .rate_max = 192000,
}; };
static struct dummy_model *dummy_models[] = { static const struct dummy_model *dummy_models[] = {
&model_emu10k1, &model_emu10k1,
&model_rme9652, &model_rme9652,
&model_ice1712, &model_ice1712,
...@@ -535,7 +535,7 @@ static int dummy_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -535,7 +535,7 @@ static int dummy_pcm_hw_params(struct snd_pcm_substream *substream,
static int dummy_pcm_open(struct snd_pcm_substream *substream) static int dummy_pcm_open(struct snd_pcm_substream *substream)
{ {
struct snd_dummy *dummy = snd_pcm_substream_chip(substream); struct snd_dummy *dummy = snd_pcm_substream_chip(substream);
struct dummy_model *model = dummy->model; const struct dummy_model *model = dummy->model;
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
const struct dummy_timer_ops *ops; const struct dummy_timer_ops *ops;
int err; int err;
...@@ -912,7 +912,7 @@ static void print_formats(struct snd_dummy *dummy, ...@@ -912,7 +912,7 @@ static void print_formats(struct snd_dummy *dummy,
static void print_rates(struct snd_dummy *dummy, static void print_rates(struct snd_dummy *dummy,
struct snd_info_buffer *buffer) struct snd_info_buffer *buffer)
{ {
static int rates[] = { static const int rates[] = {
5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000,
64000, 88200, 96000, 176400, 192000, 64000, 88200, 96000, 176400, 192000,
}; };
...@@ -944,7 +944,7 @@ struct dummy_hw_field { ...@@ -944,7 +944,7 @@ struct dummy_hw_field {
.offset = offsetof(struct snd_pcm_hardware, item), \ .offset = offsetof(struct snd_pcm_hardware, item), \
.size = sizeof(dummy_pcm_hardware.item) } .size = sizeof(dummy_pcm_hardware.item) }
static struct dummy_hw_field fields[] = { static const struct dummy_hw_field fields[] = {
FIELD_ENTRY(formats, "%#llx"), FIELD_ENTRY(formats, "%#llx"),
FIELD_ENTRY(rates, "%#x"), FIELD_ENTRY(rates, "%#x"),
FIELD_ENTRY(rate_min, "%d"), FIELD_ENTRY(rate_min, "%d"),
...@@ -1022,7 +1022,7 @@ static int snd_dummy_probe(struct platform_device *devptr) ...@@ -1022,7 +1022,7 @@ static int snd_dummy_probe(struct platform_device *devptr)
{ {
struct snd_card *card; struct snd_card *card;
struct snd_dummy *dummy; struct snd_dummy *dummy;
struct dummy_model *m = NULL, **mdl; const struct dummy_model *m = NULL, **mdl;
int idx, err; int idx, err;
int dev = devptr->id; int dev = devptr->id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment