Commit f15ee210 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: core: Constify snd_device_ops definitions

Now we may declare const for snd_device_ops definitions, so let's do
it for optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-5-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 8b575824
...@@ -1099,7 +1099,7 @@ static int snd_compress_dev_free(struct snd_device *device) ...@@ -1099,7 +1099,7 @@ static int snd_compress_dev_free(struct snd_device *device)
int snd_compress_new(struct snd_card *card, int device, int snd_compress_new(struct snd_card *card, int device,
int dirn, const char *id, struct snd_compr *compr) int dirn, const char *id, struct snd_compr *compr)
{ {
static struct snd_device_ops ops = { static const struct snd_device_ops ops = {
.dev_free = snd_compress_dev_free, .dev_free = snd_compress_dev_free,
.dev_register = snd_compress_dev_register, .dev_register = snd_compress_dev_register,
.dev_disconnect = snd_compress_dev_disconnect, .dev_disconnect = snd_compress_dev_disconnect,
......
...@@ -1823,7 +1823,7 @@ static int snd_ctl_dev_free(struct snd_device *device) ...@@ -1823,7 +1823,7 @@ static int snd_ctl_dev_free(struct snd_device *device)
*/ */
int snd_ctl_create(struct snd_card *card) int snd_ctl_create(struct snd_card *card)
{ {
static struct snd_device_ops ops = { static const struct snd_device_ops ops = {
.dev_free = snd_ctl_dev_free, .dev_free = snd_ctl_dev_free,
.dev_register = snd_ctl_dev_register, .dev_register = snd_ctl_dev_register,
.dev_disconnect = snd_ctl_dev_disconnect, .dev_disconnect = snd_ctl_dev_disconnect,
......
...@@ -353,7 +353,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device, ...@@ -353,7 +353,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,
{ {
struct snd_hwdep *hwdep; struct snd_hwdep *hwdep;
int err; int err;
static struct snd_device_ops ops = { static const struct snd_device_ops ops = {
.dev_free = snd_hwdep_dev_free, .dev_free = snd_hwdep_dev_free,
.dev_register = snd_hwdep_dev_register, .dev_register = snd_hwdep_dev_register,
.dev_disconnect = snd_hwdep_dev_disconnect, .dev_disconnect = snd_hwdep_dev_disconnect,
......
...@@ -201,7 +201,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type, ...@@ -201,7 +201,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
struct snd_jack *jack; struct snd_jack *jack;
struct snd_jack_kctl *jack_kctl = NULL; struct snd_jack_kctl *jack_kctl = NULL;
int err; int err;
static struct snd_device_ops ops = { static const struct snd_device_ops ops = {
.dev_free = snd_jack_dev_free, .dev_free = snd_jack_dev_free,
#ifdef CONFIG_SND_JACK_INPUT_DEV #ifdef CONFIG_SND_JACK_INPUT_DEV
.dev_register = snd_jack_dev_register, .dev_register = snd_jack_dev_register,
......
...@@ -706,12 +706,12 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device, ...@@ -706,12 +706,12 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,
{ {
struct snd_pcm *pcm; struct snd_pcm *pcm;
int err; int err;
static struct snd_device_ops ops = { static const struct snd_device_ops ops = {
.dev_free = snd_pcm_dev_free, .dev_free = snd_pcm_dev_free,
.dev_register = snd_pcm_dev_register, .dev_register = snd_pcm_dev_register,
.dev_disconnect = snd_pcm_dev_disconnect, .dev_disconnect = snd_pcm_dev_disconnect,
}; };
static struct snd_device_ops internal_ops = { static const struct snd_device_ops internal_ops = {
.dev_free = snd_pcm_dev_free, .dev_free = snd_pcm_dev_free,
}; };
......
...@@ -1621,7 +1621,7 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device, ...@@ -1621,7 +1621,7 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device,
{ {
struct snd_rawmidi *rmidi; struct snd_rawmidi *rmidi;
int err; int err;
static struct snd_device_ops ops = { static const struct snd_device_ops ops = {
.dev_free = snd_rawmidi_dev_free, .dev_free = snd_rawmidi_dev_free,
.dev_register = snd_rawmidi_dev_register, .dev_register = snd_rawmidi_dev_register,
.dev_disconnect = snd_rawmidi_dev_disconnect, .dev_disconnect = snd_rawmidi_dev_disconnect,
......
...@@ -193,7 +193,7 @@ int snd_seq_device_new(struct snd_card *card, int device, const char *id, ...@@ -193,7 +193,7 @@ int snd_seq_device_new(struct snd_card *card, int device, const char *id,
{ {
struct snd_seq_device *dev; struct snd_seq_device *dev;
int err; int err;
static struct snd_device_ops dops = { static const struct snd_device_ops dops = {
.dev_free = snd_seq_device_dev_free, .dev_free = snd_seq_device_dev_free,
.dev_register = snd_seq_device_dev_register, .dev_register = snd_seq_device_dev_register,
.dev_disconnect = snd_seq_device_dev_disconnect, .dev_disconnect = snd_seq_device_dev_disconnect,
......
...@@ -936,7 +936,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid, ...@@ -936,7 +936,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid,
{ {
struct snd_timer *timer; struct snd_timer *timer;
int err; int err;
static struct snd_device_ops ops = { static const struct snd_device_ops ops = {
.dev_free = snd_timer_dev_free, .dev_free = snd_timer_dev_free,
.dev_register = snd_timer_dev_register, .dev_register = snd_timer_dev_register,
.dev_disconnect = snd_timer_dev_disconnect, .dev_disconnect = snd_timer_dev_disconnect,
......
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