ALSA: pcm: More constifications
Apply const prefix to more possible places: the string tables for PCM format and co, the table for the PCM type helpers, etc. Just for minor optimization and no functional changes. Link: https://lore.kernel.org/r/20200105144823.29547-6-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
@@ -163,7 +163,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card,
|
|||||||
|
|
||||||
#define FORMAT(v) [SNDRV_PCM_FORMAT_##v] = #v
|
#define FORMAT(v) [SNDRV_PCM_FORMAT_##v] = #v
|
||||||
|
|
||||||
static char *snd_pcm_format_names[] = {
|
static const char * const snd_pcm_format_names[] = {
|
||||||
FORMAT(S8),
|
FORMAT(S8),
|
||||||
FORMAT(U8),
|
FORMAT(U8),
|
||||||
FORMAT(S16_LE),
|
FORMAT(S16_LE),
|
||||||
@@ -237,12 +237,12 @@ EXPORT_SYMBOL_GPL(snd_pcm_format_name);
|
|||||||
#define START(v) [SNDRV_PCM_START_##v] = #v
|
#define START(v) [SNDRV_PCM_START_##v] = #v
|
||||||
#define SUBFORMAT(v) [SNDRV_PCM_SUBFORMAT_##v] = #v
|
#define SUBFORMAT(v) [SNDRV_PCM_SUBFORMAT_##v] = #v
|
||||||
|
|
||||||
static char *snd_pcm_stream_names[] = {
|
static const char * const snd_pcm_stream_names[] = {
|
||||||
STREAM(PLAYBACK),
|
STREAM(PLAYBACK),
|
||||||
STREAM(CAPTURE),
|
STREAM(CAPTURE),
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *snd_pcm_state_names[] = {
|
static const char * const snd_pcm_state_names[] = {
|
||||||
STATE(OPEN),
|
STATE(OPEN),
|
||||||
STATE(SETUP),
|
STATE(SETUP),
|
||||||
STATE(PREPARED),
|
STATE(PREPARED),
|
||||||
@@ -253,7 +253,7 @@ static char *snd_pcm_state_names[] = {
|
|||||||
STATE(SUSPENDED),
|
STATE(SUSPENDED),
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *snd_pcm_access_names[] = {
|
static const char * const snd_pcm_access_names[] = {
|
||||||
ACCESS(MMAP_INTERLEAVED),
|
ACCESS(MMAP_INTERLEAVED),
|
||||||
ACCESS(MMAP_NONINTERLEAVED),
|
ACCESS(MMAP_NONINTERLEAVED),
|
||||||
ACCESS(MMAP_COMPLEX),
|
ACCESS(MMAP_COMPLEX),
|
||||||
@@ -261,11 +261,11 @@ static char *snd_pcm_access_names[] = {
|
|||||||
ACCESS(RW_NONINTERLEAVED),
|
ACCESS(RW_NONINTERLEAVED),
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *snd_pcm_subformat_names[] = {
|
static const char * const snd_pcm_subformat_names[] = {
|
||||||
SUBFORMAT(STD),
|
SUBFORMAT(STD),
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *snd_pcm_tstamp_mode_names[] = {
|
static const char * const snd_pcm_tstamp_mode_names[] = {
|
||||||
TSTAMP(NONE),
|
TSTAMP(NONE),
|
||||||
TSTAMP(ENABLE),
|
TSTAMP(ENABLE),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1452,7 +1452,7 @@ EXPORT_SYMBOL(snd_pcm_hw_constraint_step);
|
|||||||
|
|
||||||
static int snd_pcm_hw_rule_pow2(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule)
|
static int snd_pcm_hw_rule_pow2(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule)
|
||||||
{
|
{
|
||||||
static unsigned int pow2_sizes[] = {
|
static const unsigned int pow2_sizes[] = {
|
||||||
1<<0, 1<<1, 1<<2, 1<<3, 1<<4, 1<<5, 1<<6, 1<<7,
|
1<<0, 1<<1, 1<<2, 1<<3, 1<<4, 1<<5, 1<<6, 1<<7,
|
||||||
1<<8, 1<<9, 1<<10, 1<<11, 1<<12, 1<<13, 1<<14, 1<<15,
|
1<<8, 1<<9, 1<<10, 1<<11, 1<<12, 1<<13, 1<<14, 1<<15,
|
||||||
1<<16, 1<<17, 1<<18, 1<<19, 1<<20, 1<<21, 1<<22, 1<<23,
|
1<<16, 1<<17, 1<<18, 1<<19, 1<<20, 1<<21, 1<<22, 1<<23,
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ struct pcm_format_data {
|
|||||||
/* we do lots of calculations on snd_pcm_format_t; shut up sparse */
|
/* we do lots of calculations on snd_pcm_format_t; shut up sparse */
|
||||||
#define INT __force int
|
#define INT __force int
|
||||||
|
|
||||||
static struct pcm_format_data pcm_formats[(INT)SNDRV_PCM_FORMAT_LAST+1] = {
|
static const struct pcm_format_data pcm_formats[(INT)SNDRV_PCM_FORMAT_LAST+1] = {
|
||||||
[SNDRV_PCM_FORMAT_S8] = {
|
[SNDRV_PCM_FORMAT_S8] = {
|
||||||
.width = 8, .phys = 8, .le = -1, .signd = 1,
|
.width = 8, .phys = 8, .le = -1, .signd = 1,
|
||||||
.silence = {},
|
.silence = {},
|
||||||
@@ -415,7 +415,8 @@ EXPORT_SYMBOL(snd_pcm_format_silence_64);
|
|||||||
int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int samples)
|
int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int samples)
|
||||||
{
|
{
|
||||||
int width;
|
int width;
|
||||||
unsigned char *dst, *pat;
|
unsigned char *dst;
|
||||||
|
const unsigned char *pat;
|
||||||
|
|
||||||
if ((INT)format < 0 || (INT)format > (INT)SNDRV_PCM_FORMAT_LAST)
|
if ((INT)format < 0 || (INT)format > (INT)SNDRV_PCM_FORMAT_LAST)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|||||||
Reference in New Issue
Block a user