From e382d7fcfc3ff21c8ba97a29bd451a289f57b757 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 3 Jan 2020 09:16:35 +0100 Subject: ALSA: docs: Constify snd_device_ops definitions Update the documentation for adding the const prefix to snd_device_ops definitions as well. Link: https://lore.kernel.org/r/20200103081714.9560-20-tiwai@suse.de Signed-off-by: Takashi Iwai --- Documentation/sound/kernel-api/writing-an-alsa-driver.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Documentation/sound/kernel-api') diff --git a/Documentation/sound/kernel-api/writing-an-alsa-driver.rst b/Documentation/sound/kernel-api/writing-an-alsa-driver.rst index f169d58ca019..7b1ba1e447b9 100644 --- a/Documentation/sound/kernel-api/writing-an-alsa-driver.rst +++ b/Documentation/sound/kernel-api/writing-an-alsa-driver.rst @@ -259,7 +259,7 @@ to details explained in the following section. { struct mychip *chip; int err; - static struct snd_device_ops ops = { + static const struct snd_device_ops ops = { .dev_free = snd_mychip_dev_free, }; @@ -675,7 +675,7 @@ low-level device with a specified ``ops``, :: - static struct snd_device_ops ops = { + static const struct snd_device_ops ops = { .dev_free = snd_mychip_dev_free, }; .... @@ -761,7 +761,7 @@ destructor and PCI entries. Example code is shown first, below. { struct mychip *chip; int err; - static struct snd_device_ops ops = { + static const struct snd_device_ops ops = { .dev_free = snd_mychip_dev_free, }; -- cgit v1.2.3 From d25ff26840bd0af3283d8e478669abc104bb873a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 3 Jan 2020 09:16:44 +0100 Subject: ALSA: info: Make snd_info_entry_ops as const The reference to snd_info_entry_ops is rather read-only, so declare it as a const pointer. This allows a bit more optimization. There should be no functional changes by this patch. Link: https://lore.kernel.org/r/20200103081714.9560-29-tiwai@suse.de Signed-off-by: Takashi Iwai --- Documentation/sound/kernel-api/writing-an-alsa-driver.rst | 2 +- include/sound/info.h | 2 +- sound/drivers/opl4/opl4_proc.c | 2 +- sound/isa/gus/gus_mem_proc.c | 2 +- sound/pci/cs4281.c | 4 ++-- sound/pci/cs46xx/cs46xx_lib.c | 2 +- sound/pci/emu10k1/emuproc.c | 2 +- sound/pci/mixart/mixart.c | 4 ++-- 8 files changed, 10 insertions(+), 10 deletions(-) (limited to 'Documentation/sound/kernel-api') diff --git a/Documentation/sound/kernel-api/writing-an-alsa-driver.rst b/Documentation/sound/kernel-api/writing-an-alsa-driver.rst index 7b1ba1e447b9..8204e3b6fea6 100644 --- a/Documentation/sound/kernel-api/writing-an-alsa-driver.rst +++ b/Documentation/sound/kernel-api/writing-an-alsa-driver.rst @@ -3912,7 +3912,7 @@ For a raw-data proc-file, set the attributes as follows: :: - static struct snd_info_entry_ops my_file_io_ops = { + static const struct snd_info_entry_ops my_file_io_ops = { .read = my_file_io_read, }; diff --git a/include/sound/info.h b/include/sound/info.h index b01a22913400..7c13bf52cc81 100644 --- a/include/sound/info.h +++ b/include/sound/info.h @@ -64,7 +64,7 @@ struct snd_info_entry { unsigned short content; union { struct snd_info_entry_text text; - struct snd_info_entry_ops *ops; + const struct snd_info_entry_ops *ops; } c; struct snd_info_entry *parent; struct module *module; diff --git a/sound/drivers/opl4/opl4_proc.c b/sound/drivers/opl4/opl4_proc.c index e0516e532969..f2149091e10a 100644 --- a/sound/drivers/opl4/opl4_proc.c +++ b/sound/drivers/opl4/opl4_proc.c @@ -76,7 +76,7 @@ static ssize_t snd_opl4_mem_proc_write(struct snd_info_entry *entry, return count; } -static struct snd_info_entry_ops snd_opl4_mem_proc_ops = { +static const struct snd_info_entry_ops snd_opl4_mem_proc_ops = { .open = snd_opl4_mem_proc_open, .release = snd_opl4_mem_proc_release, .read = snd_opl4_mem_proc_read, diff --git a/sound/isa/gus/gus_mem_proc.c b/sound/isa/gus/gus_mem_proc.c index 54510e2d78c2..b5e1d1649500 100644 --- a/sound/isa/gus/gus_mem_proc.c +++ b/sound/isa/gus/gus_mem_proc.c @@ -37,7 +37,7 @@ static void snd_gf1_mem_proc_free(struct snd_info_entry *entry) kfree(priv); } -static struct snd_info_entry_ops snd_gf1_mem_proc_ops = { +static const struct snd_info_entry_ops snd_gf1_mem_proc_ops = { .read = snd_gf1_mem_proc_dump, }; diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index 8fd64dab372d..dc89ef906c9b 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c @@ -1129,11 +1129,11 @@ static ssize_t snd_cs4281_BA1_read(struct snd_info_entry *entry, return count; } -static struct snd_info_entry_ops snd_cs4281_proc_ops_BA0 = { +static const struct snd_info_entry_ops snd_cs4281_proc_ops_BA0 = { .read = snd_cs4281_BA0_read, }; -static struct snd_info_entry_ops snd_cs4281_proc_ops_BA1 = { +static const struct snd_info_entry_ops snd_cs4281_proc_ops_BA1 = { .read = snd_cs4281_BA1_read, }; diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 3f2fe26efee3..5bb84303f577 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c @@ -2815,7 +2815,7 @@ static ssize_t snd_cs46xx_io_read(struct snd_info_entry *entry, return count; } -static struct snd_info_entry_ops snd_cs46xx_proc_io_ops = { +static const struct snd_info_entry_ops snd_cs46xx_proc_io_ops = { .read = snd_cs46xx_io_read, }; diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c index d32f256af809..637446f19598 100644 --- a/sound/pci/emu10k1/emuproc.c +++ b/sound/pci/emu10k1/emuproc.c @@ -545,7 +545,7 @@ static void snd_emu_proc_ptr_reg_read20c(struct snd_info_entry *entry, } #endif -static struct snd_info_entry_ops snd_emu10k1_proc_ops_fx8010 = { +static const struct snd_info_entry_ops snd_emu10k1_proc_ops_fx8010 = { .read = snd_emu10k1_fx8010_read, }; diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 44009c555322..7ba487443c7f 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c @@ -1153,11 +1153,11 @@ static ssize_t snd_mixart_BA1_read(struct snd_info_entry *entry, return count; } -static struct snd_info_entry_ops snd_mixart_proc_ops_BA0 = { +static const struct snd_info_entry_ops snd_mixart_proc_ops_BA0 = { .read = snd_mixart_BA0_read, }; -static struct snd_info_entry_ops snd_mixart_proc_ops_BA1 = { +static const struct snd_info_entry_ops snd_mixart_proc_ops_BA1 = { .read = snd_mixart_BA1_read, }; -- cgit v1.2.3