ALSA: core: Treat snd_device_ops as const

This is a preliminary patch to allow const for snd_device_ops
definitions in each driver's code.  The ops reference is read-only,
hence it can be declared as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2020-01-03 09:16:19 +01:00
parent 2ead9d087f
commit 8b57582430
2 changed files with 3 additions and 3 deletions

View File

@ -69,7 +69,7 @@ struct snd_device {
enum snd_device_state state; /* state of the device */ enum snd_device_state state; /* state of the device */
enum snd_device_type type; /* device type */ enum snd_device_type type; /* device type */
void *device_data; /* device structure */ void *device_data; /* device structure */
struct snd_device_ops *ops; /* operations */ const struct snd_device_ops *ops; /* operations */
}; };
#define snd_device(n) list_entry(n, struct snd_device, list) #define snd_device(n) list_entry(n, struct snd_device, list)
@ -256,7 +256,7 @@ static inline void snd_card_unref(struct snd_card *card)
/* device.c */ /* device.c */
int snd_device_new(struct snd_card *card, enum snd_device_type type, int snd_device_new(struct snd_card *card, enum snd_device_type type,
void *device_data, struct snd_device_ops *ops); void *device_data, const struct snd_device_ops *ops);
int snd_device_register(struct snd_card *card, void *device_data); int snd_device_register(struct snd_card *card, void *device_data);
int snd_device_register_all(struct snd_card *card); int snd_device_register_all(struct snd_card *card);
void snd_device_disconnect(struct snd_card *card, void *device_data); void snd_device_disconnect(struct snd_card *card, void *device_data);

View File

@ -27,7 +27,7 @@
* Return: Zero if successful, or a negative error code on failure. * Return: Zero if successful, or a negative error code on failure.
*/ */
int snd_device_new(struct snd_card *card, enum snd_device_type type, int snd_device_new(struct snd_card *card, enum snd_device_type type,
void *device_data, struct snd_device_ops *ops) void *device_data, const struct snd_device_ops *ops)
{ {
struct snd_device *dev; struct snd_device *dev;
struct list_head *p; struct list_head *p;