* [PATCH] sound: pci: cs46xx: constify snd_pcm_ops structures
@ 2017-01-26 14:53 Bhumika Goyal
2017-01-26 15:09 ` Takashi Iwai
2017-01-26 16:48 ` kbuild test robot
0 siblings, 2 replies; 3+ messages in thread
From: Bhumika Goyal @ 2017-01-26 14:53 UTC (permalink / raw)
To: julia.lawall, perex, tiwai, alsa-devel, linux-kernel; +Cc: Bhumika Goyal
Declare snd_pcm_ops structures as const as they are either stored in the
ops field of a snd_pcm_substream structure or passed as an argument to the
function snd_pcm_set_ops. The function argument and the ops field
are of type const, so snd_pcm_ops structures having this property
can be made const too.
File size before: sound/pci/cs46xx/cs46xx_lib.o
text data bss dec hex filename
13669 1712 0 15381 3c15 sound/pci/cs46xx/cs46xx_lib.o
File size after: sound/pci/cs46xx/cs46xx_lib.o
text data bss dec hex filename
14181 1216 0 15397 3c25 sound/pci/cs46xx/cs46xx_lib.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
sound/pci/cs46xx/cs46xx_lib.c | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index fde3cd4..5d012f5 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -72,18 +72,18 @@
static void amp_voyetra(struct snd_cs46xx *chip, int change);
#ifdef CONFIG_SND_CS46XX_NEW_DSP
-static struct snd_pcm_ops snd_cs46xx_playback_rear_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_clfe_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_iec958_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_rear_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_clfe_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_iec958_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops;
#endif
-static struct snd_pcm_ops snd_cs46xx_playback_ops;
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_ops;
-static struct snd_pcm_ops snd_cs46xx_capture_ops;
-static struct snd_pcm_ops snd_cs46xx_capture_indirect_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_ops;
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_ops;
+static const struct snd_pcm_ops snd_cs46xx_capture_ops;
+static const struct snd_pcm_ops snd_cs46xx_capture_indirect_ops;
static unsigned short snd_cs46xx_codec_read(struct snd_cs46xx *chip,
unsigned short reg,
@@ -1665,7 +1665,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_rear_ops = {
.pointer = snd_cs46xx_playback_direct_pointer,
};
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops = {
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops = {
.open = snd_cs46xx_playback_open_rear,
.close = snd_cs46xx_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1677,7 +1677,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops = {
.ack = snd_cs46xx_playback_transfer,
};
-static struct snd_pcm_ops snd_cs46xx_playback_clfe_ops = {
+static const struct snd_pcm_ops snd_cs46xx_playback_clfe_ops = {
.open = snd_cs46xx_playback_open_clfe,
.close = snd_cs46xx_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1688,7 +1688,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_clfe_ops = {
.pointer = snd_cs46xx_playback_direct_pointer,
};
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops = {
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops = {
.open = snd_cs46xx_playback_open_clfe,
.close = snd_cs46xx_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1700,7 +1700,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops = {
.ack = snd_cs46xx_playback_transfer,
};
-static struct snd_pcm_ops snd_cs46xx_playback_iec958_ops = {
+static const struct snd_pcm_ops snd_cs46xx_playback_iec958_ops = {
.open = snd_cs46xx_playback_open_iec958,
.close = snd_cs46xx_playback_close_iec958,
.ioctl = snd_pcm_lib_ioctl,
@@ -1711,7 +1711,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_iec958_ops = {
.pointer = snd_cs46xx_playback_direct_pointer,
};
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops = {
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops = {
.open = snd_cs46xx_playback_open_iec958,
.close = snd_cs46xx_playback_close_iec958,
.ioctl = snd_pcm_lib_ioctl,
@@ -1725,7 +1725,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops = {
#endif
-static struct snd_pcm_ops snd_cs46xx_playback_ops = {
+static const struct snd_pcm_ops snd_cs46xx_playback_ops = {
.open = snd_cs46xx_playback_open,
.close = snd_cs46xx_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1736,7 +1736,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_ops = {
.pointer = snd_cs46xx_playback_direct_pointer,
};
-static struct snd_pcm_ops snd_cs46xx_playback_indirect_ops = {
+static const struct snd_pcm_ops snd_cs46xx_playback_indirect_ops = {
.open = snd_cs46xx_playback_open,
.close = snd_cs46xx_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1748,7 +1748,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_indirect_ops = {
.ack = snd_cs46xx_playback_transfer,
};
-static struct snd_pcm_ops snd_cs46xx_capture_ops = {
+static const struct snd_pcm_ops snd_cs46xx_capture_ops = {
.open = snd_cs46xx_capture_open,
.close = snd_cs46xx_capture_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1759,7 +1759,7 @@ static struct snd_pcm_ops snd_cs46xx_capture_ops = {
.pointer = snd_cs46xx_capture_direct_pointer,
};
-static struct snd_pcm_ops snd_cs46xx_capture_indirect_ops = {
+static const struct snd_pcm_ops snd_cs46xx_capture_indirect_ops = {
.open = snd_cs46xx_capture_open,
.close = snd_cs46xx_capture_close,
.ioctl = snd_pcm_lib_ioctl,
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sound: pci: cs46xx: constify snd_pcm_ops structures
2017-01-26 14:53 [PATCH] sound: pci: cs46xx: constify snd_pcm_ops structures Bhumika Goyal
@ 2017-01-26 15:09 ` Takashi Iwai
2017-01-26 16:48 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2017-01-26 15:09 UTC (permalink / raw)
To: Bhumika Goyal; +Cc: alsa-devel, julia.lawall, perex, linux-kernel
On Thu, 26 Jan 2017 15:53:29 +0100,
Bhumika Goyal wrote:
>
> Declare snd_pcm_ops structures as const as they are either stored in the
> ops field of a snd_pcm_substream structure or passed as an argument to the
> function snd_pcm_set_ops. The function argument and the ops field
> are of type const, so snd_pcm_ops structures having this property
> can be made const too.
>
> File size before: sound/pci/cs46xx/cs46xx_lib.o
> text data bss dec hex filename
> 13669 1712 0 15381 3c15 sound/pci/cs46xx/cs46xx_lib.o
>
> File size after: sound/pci/cs46xx/cs46xx_lib.o
> text data bss dec hex filename
> 14181 1216 0 15397 3c25 sound/pci/cs46xx/cs46xx_lib.o
>
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
I got a build error:
sound/pci/cs46xx/cs46xx_lib.c:1657:27: error: conflicting type qualifiers for ‘snd_cs46xx_playback_rear_ops’
static struct snd_pcm_ops snd_cs46xx_playback_rear_ops = {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/cs46xx/cs46xx_lib.c:75:33: note: previous declaration of ‘snd_cs46xx_playback_rear_ops’ was here
static const struct snd_pcm_ops snd_cs46xx_playback_rear_ops;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please do a build-test at least. You seem to have forgotten to test
with CONFIG_SND_CS46XX_NEW_DSP=y.
thanks,
Takashi
> ---
> sound/pci/cs46xx/cs46xx_lib.c | 38 +++++++++++++++++++-------------------
> 1 file changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
> index fde3cd4..5d012f5 100644
> --- a/sound/pci/cs46xx/cs46xx_lib.c
> +++ b/sound/pci/cs46xx/cs46xx_lib.c
> @@ -72,18 +72,18 @@
> static void amp_voyetra(struct snd_cs46xx *chip, int change);
>
> #ifdef CONFIG_SND_CS46XX_NEW_DSP
> -static struct snd_pcm_ops snd_cs46xx_playback_rear_ops;
> -static struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops;
> -static struct snd_pcm_ops snd_cs46xx_playback_clfe_ops;
> -static struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops;
> -static struct snd_pcm_ops snd_cs46xx_playback_iec958_ops;
> -static struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops;
> +static const struct snd_pcm_ops snd_cs46xx_playback_rear_ops;
> +static const struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops;
> +static const struct snd_pcm_ops snd_cs46xx_playback_clfe_ops;
> +static const struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops;
> +static const struct snd_pcm_ops snd_cs46xx_playback_iec958_ops;
> +static const struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops;
> #endif
>
> -static struct snd_pcm_ops snd_cs46xx_playback_ops;
> -static struct snd_pcm_ops snd_cs46xx_playback_indirect_ops;
> -static struct snd_pcm_ops snd_cs46xx_capture_ops;
> -static struct snd_pcm_ops snd_cs46xx_capture_indirect_ops;
> +static const struct snd_pcm_ops snd_cs46xx_playback_ops;
> +static const struct snd_pcm_ops snd_cs46xx_playback_indirect_ops;
> +static const struct snd_pcm_ops snd_cs46xx_capture_ops;
> +static const struct snd_pcm_ops snd_cs46xx_capture_indirect_ops;
>
> static unsigned short snd_cs46xx_codec_read(struct snd_cs46xx *chip,
> unsigned short reg,
> @@ -1665,7 +1665,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_rear_ops = {
> .pointer = snd_cs46xx_playback_direct_pointer,
> };
>
> -static struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops = {
> +static const struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops = {
> .open = snd_cs46xx_playback_open_rear,
> .close = snd_cs46xx_playback_close,
> .ioctl = snd_pcm_lib_ioctl,
> @@ -1677,7 +1677,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_indirect_rear_ops = {
> .ack = snd_cs46xx_playback_transfer,
> };
>
> -static struct snd_pcm_ops snd_cs46xx_playback_clfe_ops = {
> +static const struct snd_pcm_ops snd_cs46xx_playback_clfe_ops = {
> .open = snd_cs46xx_playback_open_clfe,
> .close = snd_cs46xx_playback_close,
> .ioctl = snd_pcm_lib_ioctl,
> @@ -1688,7 +1688,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_clfe_ops = {
> .pointer = snd_cs46xx_playback_direct_pointer,
> };
>
> -static struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops = {
> +static const struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops = {
> .open = snd_cs46xx_playback_open_clfe,
> .close = snd_cs46xx_playback_close,
> .ioctl = snd_pcm_lib_ioctl,
> @@ -1700,7 +1700,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_indirect_clfe_ops = {
> .ack = snd_cs46xx_playback_transfer,
> };
>
> -static struct snd_pcm_ops snd_cs46xx_playback_iec958_ops = {
> +static const struct snd_pcm_ops snd_cs46xx_playback_iec958_ops = {
> .open = snd_cs46xx_playback_open_iec958,
> .close = snd_cs46xx_playback_close_iec958,
> .ioctl = snd_pcm_lib_ioctl,
> @@ -1711,7 +1711,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_iec958_ops = {
> .pointer = snd_cs46xx_playback_direct_pointer,
> };
>
> -static struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops = {
> +static const struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops = {
> .open = snd_cs46xx_playback_open_iec958,
> .close = snd_cs46xx_playback_close_iec958,
> .ioctl = snd_pcm_lib_ioctl,
> @@ -1725,7 +1725,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_indirect_iec958_ops = {
>
> #endif
>
> -static struct snd_pcm_ops snd_cs46xx_playback_ops = {
> +static const struct snd_pcm_ops snd_cs46xx_playback_ops = {
> .open = snd_cs46xx_playback_open,
> .close = snd_cs46xx_playback_close,
> .ioctl = snd_pcm_lib_ioctl,
> @@ -1736,7 +1736,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_ops = {
> .pointer = snd_cs46xx_playback_direct_pointer,
> };
>
> -static struct snd_pcm_ops snd_cs46xx_playback_indirect_ops = {
> +static const struct snd_pcm_ops snd_cs46xx_playback_indirect_ops = {
> .open = snd_cs46xx_playback_open,
> .close = snd_cs46xx_playback_close,
> .ioctl = snd_pcm_lib_ioctl,
> @@ -1748,7 +1748,7 @@ static struct snd_pcm_ops snd_cs46xx_playback_indirect_ops = {
> .ack = snd_cs46xx_playback_transfer,
> };
>
> -static struct snd_pcm_ops snd_cs46xx_capture_ops = {
> +static const struct snd_pcm_ops snd_cs46xx_capture_ops = {
> .open = snd_cs46xx_capture_open,
> .close = snd_cs46xx_capture_close,
> .ioctl = snd_pcm_lib_ioctl,
> @@ -1759,7 +1759,7 @@ static struct snd_pcm_ops snd_cs46xx_capture_ops = {
> .pointer = snd_cs46xx_capture_direct_pointer,
> };
>
> -static struct snd_pcm_ops snd_cs46xx_capture_indirect_ops = {
> +static const struct snd_pcm_ops snd_cs46xx_capture_indirect_ops = {
> .open = snd_cs46xx_capture_open,
> .close = snd_cs46xx_capture_close,
> .ioctl = snd_pcm_lib_ioctl,
> --
> 2.7.4
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sound: pci: cs46xx: constify snd_pcm_ops structures
2017-01-26 14:53 [PATCH] sound: pci: cs46xx: constify snd_pcm_ops structures Bhumika Goyal
2017-01-26 15:09 ` Takashi Iwai
@ 2017-01-26 16:48 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2017-01-26 16:48 UTC (permalink / raw)
To: Bhumika Goyal
Cc: kbuild-all, julia.lawall, perex, tiwai, alsa-devel, linux-kernel,
Bhumika Goyal
[-- Attachment #1: Type: text/plain, Size: 2445 bytes --]
Hi Bhumika,
[auto build test ERROR on sound/for-next]
[also build test ERROR on v4.10-rc5 next-20170125]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Bhumika-Goyal/sound-pci-cs46xx-constify-snd_pcm_ops-structures/20170126-230341
base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
config: x86_64-rhel (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
Note: the linux-review/Bhumika-Goyal/sound-pci-cs46xx-constify-snd_pcm_ops-structures/20170126-230341 HEAD 59da8ce3cc92652020c8c6a3ad0a4b11d8ee5a48 builds fine.
It only hurts bisectibility.
All errors (new ones prefixed by >>):
>> sound/pci/cs46xx/cs46xx_lib.c:1657:27: error: conflicting type qualifiers for 'snd_cs46xx_playback_rear_ops'
static struct snd_pcm_ops snd_cs46xx_playback_rear_ops = {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/cs46xx/cs46xx_lib.c:75:33: note: previous declaration of 'snd_cs46xx_playback_rear_ops' was here
static const struct snd_pcm_ops snd_cs46xx_playback_rear_ops;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/snd_cs46xx_playback_rear_ops +1657 sound/pci/cs46xx/cs46xx_lib.c
^1da177e Linus Torvalds 2005-04-16 1651 chip->active_ctrl(chip, -1);
^1da177e Linus Torvalds 2005-04-16 1652
^1da177e Linus Torvalds 2005-04-16 1653 return 0;
^1da177e Linus Torvalds 2005-04-16 1654 }
^1da177e Linus Torvalds 2005-04-16 1655
^1da177e Linus Torvalds 2005-04-16 1656 #ifdef CONFIG_SND_CS46XX_NEW_DSP
3d19f804 Takashi Iwai 2005-11-17 @1657 static struct snd_pcm_ops snd_cs46xx_playback_rear_ops = {
^1da177e Linus Torvalds 2005-04-16 1658 .open = snd_cs46xx_playback_open_rear,
^1da177e Linus Torvalds 2005-04-16 1659 .close = snd_cs46xx_playback_close,
^1da177e Linus Torvalds 2005-04-16 1660 .ioctl = snd_pcm_lib_ioctl,
:::::: The code at line 1657 was first introduced by commit
:::::: 3d19f804ef5f1d15fe001fc8d1ed58fac9d591fb [ALSA] Remove xxx_t typedefs: PCI CS46xx
:::::: TO: Takashi Iwai <tiwai@suse.de>
:::::: CC: Jaroslav Kysela <perex@suse.cz>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38270 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-01-26 17:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-26 14:53 [PATCH] sound: pci: cs46xx: constify snd_pcm_ops structures Bhumika Goyal
2017-01-26 15:09 ` Takashi Iwai
2017-01-26 16:48 ` kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®