2017-08-18 07:45:48

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 00/13] constify alsa snd_pcm_ops structures

snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Arvind Yadav (13):
[PATCH 01/13] ALSA: aoa: constify snd_pcm_ops structures
[PATCH 02/13] ALSA: arm: constify snd_pcm_ops structures
[PATCH 03/13] ALSA: atmel: constify snd_pcm_ops structures
[PATCH 04/13] ALSA: drivers: constify snd_pcm_ops structures
[PATCH 05/13] ALSA: firewire: constify snd_pcm_ops structures
[PATCH 06/13] ALSA: mips: constify snd_pcm_ops structures
[PATCH 07/13] ALSA: parisc: constify snd_pcm_ops structures
[PATCH 08/13] ALSA: pcmcia: constify snd_pcm_ops structures
[PATCH 09/13] ALSA: ppc: constify snd_pcm_ops structures
[PATCH 10/13] ALSA: sh: constify snd_pcm_ops structures
[PATCH 11/13] ALSA: sparc: constify snd_pcm_ops structures
[PATCH 12/13] ALSA: spi: constify snd_pcm_ops structures
[PATCH 13/13] ALSA: usb: constify snd_pcm_ops structures

sound/aoa/soundbus/i2sbus/pcm.c | 4 +-
sound/arm/aaci.c | 4 +-
sound/arm/pxa2xx-pcm.c | 2 +-
sound/atmel/ac97c.c | 4 +-
sound/drivers/aloop.c | 4 +-
sound/drivers/ml403-ac97cr.c | 4 +-
sound/firewire/isight.c | 2 +-
sound/firewire/motu/motu-pcm.c | 4 +-
sound/mips/hal2.c | 4 +-
sound/mips/sgio2audio.c | 6 +-
sound/parisc/harmony.c | 4 +-
sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c | 2 +-
sound/ppc/pmac.c | 4 +-
sound/ppc/snd_ps3.c | 2 +-
sound/sh/aica.c | 2 +-
sound/sh/sh_dac_audio.c | 2 +-
sound/sparc/amd7930.c | 4 +-
sound/sparc/cs4231.c | 4 +-
sound/sparc/dbri.c | 2 +-
sound/spi/at73c213.c | 2 +-
sound/usb/6fire/pcm.c | 2 +-
sound/usb/caiaq/audio.c | 2 +-
sound/usb/hiface/pcm.c | 2 +-
sound/usb/misc/ua101.c | 4 +-
sound/usb/pcm.c | 4 +-
sound/usb/usx2y/usbusx2yaudio.c | 2 +-
sound/usb/usx2y/usx2yhwdeppcm.c | 2 +-
27 files changed, 42 insertions(+), 42 deletions(-)

--
1.9.1


2017-08-18 07:45:55

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 02/13] ALSA: arm: constify snd_pcm_ops structures

snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
sound/arm/aaci.c | 4 ++--
sound/arm/pxa2xx-pcm.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index 4140b1b..e93b327 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -635,7 +635,7 @@ static int aaci_pcm_playback_trigger(struct snd_pcm_substream *substream, int cm
return ret;
}

-static struct snd_pcm_ops aaci_playback_ops = {
+static const struct snd_pcm_ops aaci_playback_ops = {
.open = aaci_pcm_open,
.close = aaci_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -738,7 +738,7 @@ static int aaci_pcm_capture_prepare(struct snd_pcm_substream *substream)
return 0;
}

-static struct snd_pcm_ops aaci_capture_ops = {
+static const struct snd_pcm_ops aaci_capture_ops = {
.open = aaci_pcm_open,
.close = aaci_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/arm/pxa2xx-pcm.c b/sound/arm/pxa2xx-pcm.c
index 83fcfac..1c6f4b4 100644
--- a/sound/arm/pxa2xx-pcm.c
+++ b/sound/arm/pxa2xx-pcm.c
@@ -68,7 +68,7 @@ static int pxa2xx_pcm_close(struct snd_pcm_substream *substream)
return __pxa2xx_pcm_close(substream);
}

-static struct snd_pcm_ops pxa2xx_pcm_ops = {
+static const struct snd_pcm_ops pxa2xx_pcm_ops = {
.open = pxa2xx_pcm_open,
.close = pxa2xx_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
--
1.9.1

2017-08-18 07:45:58

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 03/13] ALSA: atmel: constify snd_pcm_ops structures

snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
sound/atmel/ac97c.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
index 52b0522..70616da 100644
--- a/sound/atmel/ac97c.c
+++ b/sound/atmel/ac97c.c
@@ -461,7 +461,7 @@ static int atmel_ac97c_capture_prepare(struct snd_pcm_substream *substream)
return frames;
}

-static struct snd_pcm_ops atmel_ac97_playback_ops = {
+static const struct snd_pcm_ops atmel_ac97_playback_ops = {
.open = atmel_ac97c_playback_open,
.close = atmel_ac97c_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -472,7 +472,7 @@ static int atmel_ac97c_capture_prepare(struct snd_pcm_substream *substream)
.pointer = atmel_ac97c_playback_pointer,
};

-static struct snd_pcm_ops atmel_ac97_capture_ops = {
+static const struct snd_pcm_ops atmel_ac97_capture_ops = {
.open = atmel_ac97c_capture_open,
.close = atmel_ac97c_capture_close,
.ioctl = snd_pcm_lib_ioctl,
--
1.9.1

2017-08-18 07:46:05

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 05/13] ALSA: firewire: constify snd_pcm_ops structures

snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
sound/firewire/isight.c | 2 +-
sound/firewire/motu/motu-pcm.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/firewire/isight.c b/sound/firewire/isight.c
index 48d6dca..5826aa8 100644
--- a/sound/firewire/isight.c
+++ b/sound/firewire/isight.c
@@ -444,7 +444,7 @@ static snd_pcm_uframes_t isight_pointer(struct snd_pcm_substream *substream)

static int isight_create_pcm(struct isight *isight)
{
- static struct snd_pcm_ops ops = {
+ static const struct snd_pcm_ops ops = {
.open = isight_open,
.close = isight_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/firewire/motu/motu-pcm.c b/sound/firewire/motu/motu-pcm.c
index a2b50df..1466e46 100644
--- a/sound/firewire/motu/motu-pcm.c
+++ b/sound/firewire/motu/motu-pcm.c
@@ -352,7 +352,7 @@ static int playback_ack(struct snd_pcm_substream *substream)

int snd_motu_create_pcm_devices(struct snd_motu *motu)
{
- static struct snd_pcm_ops capture_ops = {
+ static const struct snd_pcm_ops capture_ops = {
.open = pcm_open,
.close = pcm_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -365,7 +365,7 @@ int snd_motu_create_pcm_devices(struct snd_motu *motu)
.page = snd_pcm_lib_get_vmalloc_page,
.mmap = snd_pcm_lib_mmap_vmalloc,
};
- static struct snd_pcm_ops playback_ops = {
+ static const struct snd_pcm_ops playback_ops = {
.open = pcm_open,
.close = pcm_close,
.ioctl = snd_pcm_lib_ioctl,
--
1.9.1

2017-08-18 07:46:10

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 07/13] ALSA: parisc: constify snd_pcm_ops structures

snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
sound/parisc/harmony.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c
index 5911eb3..7bf43e9 100644
--- a/sound/parisc/harmony.c
+++ b/sound/parisc/harmony.c
@@ -596,7 +596,7 @@
return snd_pcm_lib_free_pages(ss);
}

-static struct snd_pcm_ops snd_harmony_playback_ops = {
+static const struct snd_pcm_ops snd_harmony_playback_ops = {
.open = snd_harmony_playback_open,
.close = snd_harmony_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -607,7 +607,7 @@
.pointer = snd_harmony_playback_pointer,
};

-static struct snd_pcm_ops snd_harmony_capture_ops = {
+static const struct snd_pcm_ops snd_harmony_capture_ops = {
.open = snd_harmony_capture_open,
.close = snd_harmony_capture_close,
.ioctl = snd_pcm_lib_ioctl,
--
1.9.1

2017-08-18 07:46:14

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 08/13] ALSA: pcmcia: constify snd_pcm_ops structures

snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
index b48aa0a..a81ec25 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
@@ -266,7 +266,7 @@ static snd_pcm_uframes_t pdacf_pcm_capture_pointer(struct snd_pcm_substream *sub
/*
* operators for PCM capture
*/
-static struct snd_pcm_ops pdacf_pcm_capture_ops = {
+static const struct snd_pcm_ops pdacf_pcm_capture_ops = {
.open = pdacf_pcm_capture_open,
.close = pdacf_pcm_capture_close,
.ioctl = snd_pcm_lib_ioctl,
--
1.9.1

2017-08-18 07:46:20

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 10/13] ALSA: sh: constify snd_pcm_ops structures

snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
sound/sh/aica.c | 2 +-
sound/sh/sh_dac_audio.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index ab4802d..c1635f7 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -436,7 +436,7 @@ static unsigned long snd_aicapcm_pcm_pointer(struct snd_pcm_substream
return readl(AICA_CONTROL_CHANNEL_SAMPLE_NUMBER);
}

-static struct snd_pcm_ops snd_aicapcm_playback_ops = {
+static const struct snd_pcm_ops snd_aicapcm_playback_ops = {
.open = snd_aicapcm_pcm_open,
.close = snd_aicapcm_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/sh/sh_dac_audio.c b/sound/sh/sh_dac_audio.c
index c1e00ed..b348be9 100644
--- a/sound/sh/sh_dac_audio.c
+++ b/sound/sh/sh_dac_audio.c
@@ -252,7 +252,7 @@ snd_pcm_uframes_t snd_sh_dac_pcm_pointer(struct snd_pcm_substream *substream)
}

/* pcm ops */
-static struct snd_pcm_ops snd_sh_dac_pcm_ops = {
+static const struct snd_pcm_ops snd_sh_dac_pcm_ops = {
.open = snd_sh_dac_pcm_open,
.close = snd_sh_dac_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
--
1.9.1

2017-08-18 07:46:26

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 12/13] ALSA: spi: constify snd_pcm_ops structures

snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
sound/spi/at73c213.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c
index fac7e6e..1ef52ed 100644
--- a/sound/spi/at73c213.c
+++ b/sound/spi/at73c213.c
@@ -322,7 +322,7 @@ static int snd_at73c213_pcm_trigger(struct snd_pcm_substream *substream,
return pos;
}

-static struct snd_pcm_ops at73c213_playback_ops = {
+static const struct snd_pcm_ops at73c213_playback_ops = {
.open = snd_at73c213_pcm_open,
.close = snd_at73c213_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
--
1.9.1

2017-08-18 07:46:31

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 13/13] ALSA: usb: constify snd_pcm_ops structures

snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
sound/usb/6fire/pcm.c | 2 +-
sound/usb/caiaq/audio.c | 2 +-
sound/usb/hiface/pcm.c | 2 +-
sound/usb/misc/ua101.c | 4 ++--
sound/usb/pcm.c | 4 ++--
sound/usb/usx2y/usbusx2yaudio.c | 2 +-
sound/usb/usx2y/usx2yhwdeppcm.c | 2 +-
7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
index 36f4115..224a6a5 100644
--- a/sound/usb/6fire/pcm.c
+++ b/sound/usb/6fire/pcm.c
@@ -555,7 +555,7 @@ static snd_pcm_uframes_t usb6fire_pcm_pointer(
return ret;
}

-static struct snd_pcm_ops pcm_ops = {
+static const struct snd_pcm_ops pcm_ops = {
.open = usb6fire_pcm_open,
.close = usb6fire_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c
index 8f66ba7..af5ad84 100644
--- a/sound/usb/caiaq/audio.c
+++ b/sound/usb/caiaq/audio.c
@@ -338,7 +338,7 @@ static int snd_usb_caiaq_pcm_trigger(struct snd_pcm_substream *sub, int cmd)
}

/* operators for both playback and capture */
-static struct snd_pcm_ops snd_usb_caiaq_ops = {
+static const struct snd_pcm_ops snd_usb_caiaq_ops = {
.open = snd_usb_caiaq_substream_open,
.close = snd_usb_caiaq_substream_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/usb/hiface/pcm.c b/sound/usb/hiface/pcm.c
index 33db205..175d8d6 100644
--- a/sound/usb/hiface/pcm.c
+++ b/sound/usb/hiface/pcm.c
@@ -513,7 +513,7 @@ static snd_pcm_uframes_t hiface_pcm_pointer(struct snd_pcm_substream *alsa_sub)
return bytes_to_frames(alsa_sub->runtime, dma_offset);
}

-static struct snd_pcm_ops pcm_ops = {
+static const struct snd_pcm_ops pcm_ops = {
.open = hiface_pcm_open,
.close = hiface_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c
index c19a5dd..71a0e9e 100644
--- a/sound/usb/misc/ua101.c
+++ b/sound/usb/misc/ua101.c
@@ -890,7 +890,7 @@ static snd_pcm_uframes_t playback_pcm_pointer(struct snd_pcm_substream *subs)
return ua101_pcm_pointer(ua, &ua->playback);
}

-static struct snd_pcm_ops capture_pcm_ops = {
+static const struct snd_pcm_ops capture_pcm_ops = {
.open = capture_pcm_open,
.close = capture_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -903,7 +903,7 @@ static snd_pcm_uframes_t playback_pcm_pointer(struct snd_pcm_substream *subs)
.mmap = snd_pcm_lib_mmap_vmalloc,
};

-static struct snd_pcm_ops playback_pcm_ops = {
+static const struct snd_pcm_ops playback_pcm_ops = {
.open = playback_pcm_open,
.close = playback_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 9aa5b18..f9634c9 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -1690,7 +1690,7 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream
return -EINVAL;
}

-static struct snd_pcm_ops snd_usb_playback_ops = {
+static const struct snd_pcm_ops snd_usb_playback_ops = {
.open = snd_usb_playback_open,
.close = snd_usb_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1703,7 +1703,7 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream
.mmap = snd_pcm_lib_mmap_vmalloc,
};

-static struct snd_pcm_ops snd_usb_capture_ops = {
+static const struct snd_pcm_ops snd_usb_capture_ops = {
.open = snd_usb_capture_open,
.close = snd_usb_capture_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
index dd40ca9..f412d8b 100644
--- a/sound/usb/usx2y/usbusx2yaudio.c
+++ b/sound/usb/usx2y/usbusx2yaudio.c
@@ -907,7 +907,7 @@ static int snd_usX2Y_pcm_close(struct snd_pcm_substream *substream)
}


-static struct snd_pcm_ops snd_usX2Y_pcm_ops =
+static const struct snd_pcm_ops snd_usX2Y_pcm_ops =
{
.open = snd_usX2Y_pcm_open,
.close = snd_usX2Y_pcm_close,
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c
index d51c7fd..0d05052 100644
--- a/sound/usb/usx2y/usx2yhwdeppcm.c
+++ b/sound/usb/usx2y/usx2yhwdeppcm.c
@@ -587,7 +587,7 @@ static int snd_usX2Y_usbpcm_close(struct snd_pcm_substream *substream)
}


-static struct snd_pcm_ops snd_usX2Y_usbpcm_ops =
+static const struct snd_pcm_ops snd_usX2Y_usbpcm_ops =
{
.open = snd_usX2Y_usbpcm_open,
.close = snd_usX2Y_usbpcm_close,
--
1.9.1

2017-08-18 07:46:23

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 11/13] ALSA: sparc: constify snd_pcm_ops structures

snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
sound/sparc/amd7930.c | 4 ++--
sound/sparc/cs4231.c | 4 ++--
sound/sparc/dbri.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c
index 35c1f6a..2331dbf 100644
--- a/sound/sparc/amd7930.c
+++ b/sound/sparc/amd7930.c
@@ -733,7 +733,7 @@ static int snd_amd7930_hw_free(struct snd_pcm_substream *substream)
return snd_pcm_lib_free_pages(substream);
}

-static struct snd_pcm_ops snd_amd7930_playback_ops = {
+static const struct snd_pcm_ops snd_amd7930_playback_ops = {
.open = snd_amd7930_playback_open,
.close = snd_amd7930_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -744,7 +744,7 @@ static int snd_amd7930_hw_free(struct snd_pcm_substream *substream)
.pointer = snd_amd7930_playback_pointer,
};

-static struct snd_pcm_ops snd_amd7930_capture_ops = {
+static const struct snd_pcm_ops snd_amd7930_capture_ops = {
.open = snd_amd7930_capture_open,
.close = snd_amd7930_capture_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index 3d7d425..3a947e0 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -1203,7 +1203,7 @@ static int snd_cs4231_capture_close(struct snd_pcm_substream *substream)
* XXX the audio AUXIO register...
*/

-static struct snd_pcm_ops snd_cs4231_playback_ops = {
+static const struct snd_pcm_ops snd_cs4231_playback_ops = {
.open = snd_cs4231_playback_open,
.close = snd_cs4231_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1214,7 +1214,7 @@ static int snd_cs4231_capture_close(struct snd_pcm_substream *substream)
.pointer = snd_cs4231_playback_pointer,
};

-static struct snd_pcm_ops snd_cs4231_capture_ops = {
+static const struct snd_pcm_ops snd_cs4231_capture_ops = {
.open = snd_cs4231_capture_open,
.close = snd_cs4231_capture_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
index 52063b2..87b887a 100644
--- a/sound/sparc/dbri.c
+++ b/sound/sparc/dbri.c
@@ -2213,7 +2213,7 @@ static snd_pcm_uframes_t snd_dbri_pointer(struct snd_pcm_substream *substream)
return ret;
}

-static struct snd_pcm_ops snd_dbri_ops = {
+static const struct snd_pcm_ops snd_dbri_ops = {
.open = snd_dbri_open,
.close = snd_dbri_close,
.ioctl = snd_pcm_lib_ioctl,
--
1.9.1

2017-08-18 07:47:16

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 09/13] ALSA: ppc: constify snd_pcm_ops structures

snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
sound/ppc/pmac.c | 4 ++--
sound/ppc/snd_ps3.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index a5843fc..ef2ab19 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -681,7 +681,7 @@ static int snd_pmac_capture_close(struct snd_pcm_substream *subs)
/*
*/

-static struct snd_pcm_ops snd_pmac_playback_ops = {
+static const struct snd_pcm_ops snd_pmac_playback_ops = {
.open = snd_pmac_playback_open,
.close = snd_pmac_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -692,7 +692,7 @@ static int snd_pmac_capture_close(struct snd_pcm_substream *subs)
.pointer = snd_pmac_playback_pointer,
};

-static struct snd_pcm_ops snd_pmac_capture_ops = {
+static const struct snd_pcm_ops snd_pmac_capture_ops = {
.open = snd_pmac_capture_open,
.close = snd_pmac_capture_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c
index cdd44ab..36f34f4 100644
--- a/sound/ppc/snd_ps3.c
+++ b/sound/ppc/snd_ps3.c
@@ -772,7 +772,7 @@ static int snd_ps3_spdif_default_put(struct snd_kcontrol *kcontrol,
},
};

-static struct snd_pcm_ops snd_ps3_pcm_spdif_ops = {
+static const struct snd_pcm_ops snd_ps3_pcm_spdif_ops = {
.open = snd_ps3_pcm_open,
.close = snd_ps3_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
--
1.9.1

2017-08-18 07:47:50

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 06/13] ALSA: mips: constify snd_pcm_ops structures

snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
sound/mips/hal2.c | 4 ++--
sound/mips/sgio2audio.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/mips/hal2.c b/sound/mips/hal2.c
index 3318c15..b123e16 100644
--- a/sound/mips/hal2.c
+++ b/sound/mips/hal2.c
@@ -711,7 +711,7 @@ static int hal2_capture_ack(struct snd_pcm_substream *substream)
hal2_capture_transfer);
}

-static struct snd_pcm_ops hal2_playback_ops = {
+static const struct snd_pcm_ops hal2_playback_ops = {
.open = hal2_playback_open,
.close = hal2_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -723,7 +723,7 @@ static int hal2_capture_ack(struct snd_pcm_substream *substream)
.ack = hal2_playback_ack,
};

-static struct snd_pcm_ops hal2_capture_ops = {
+static const struct snd_pcm_ops hal2_capture_ops = {
.open = hal2_capture_open,
.close = hal2_capture_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c
index 0ebc1c3..e1800c3 100644
--- a/sound/mips/sgio2audio.c
+++ b/sound/mips/sgio2audio.c
@@ -675,7 +675,7 @@ static int snd_sgio2audio_pcm_trigger(struct snd_pcm_substream *substream,
}

/* operators */
-static struct snd_pcm_ops snd_sgio2audio_playback1_ops = {
+static const struct snd_pcm_ops snd_sgio2audio_playback1_ops = {
.open = snd_sgio2audio_playback1_open,
.close = snd_sgio2audio_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -688,7 +688,7 @@ static int snd_sgio2audio_pcm_trigger(struct snd_pcm_substream *substream,
.mmap = snd_pcm_lib_mmap_vmalloc,
};

-static struct snd_pcm_ops snd_sgio2audio_playback2_ops = {
+static const struct snd_pcm_ops snd_sgio2audio_playback2_ops = {
.open = snd_sgio2audio_playback2_open,
.close = snd_sgio2audio_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -701,7 +701,7 @@ static int snd_sgio2audio_pcm_trigger(struct snd_pcm_substream *substream,
.mmap = snd_pcm_lib_mmap_vmalloc,
};

-static struct snd_pcm_ops snd_sgio2audio_capture_ops = {
+static const struct snd_pcm_ops snd_sgio2audio_capture_ops = {
.open = snd_sgio2audio_capture_open,
.close = snd_sgio2audio_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
--
1.9.1

2017-08-18 07:48:14

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 04/13] ALSA: drivers: constify snd_pcm_ops structures

snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
sound/drivers/aloop.c | 4 ++--
sound/drivers/ml403-ac97cr.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
index 54f348a..f9f0edf 100644
--- a/sound/drivers/aloop.c
+++ b/sound/drivers/aloop.c
@@ -750,7 +750,7 @@ static int loopback_close(struct snd_pcm_substream *substream)
return 0;
}

-static struct snd_pcm_ops loopback_playback_ops = {
+static const struct snd_pcm_ops loopback_playback_ops = {
.open = loopback_open,
.close = loopback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -763,7 +763,7 @@ static int loopback_close(struct snd_pcm_substream *substream)
.mmap = snd_pcm_lib_mmap_vmalloc,
};

-static struct snd_pcm_ops loopback_capture_ops = {
+static const struct snd_pcm_ops loopback_capture_ops = {
.open = loopback_open,
.close = loopback_close,
.ioctl = snd_pcm_lib_ioctl,
diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c
index bdcb572..8195ae8 100644
--- a/sound/drivers/ml403-ac97cr.c
+++ b/sound/drivers/ml403-ac97cr.c
@@ -759,7 +759,7 @@ static int snd_ml403_ac97cr_capture_close(struct snd_pcm_substream *substream)
return 0;
}

-static struct snd_pcm_ops snd_ml403_ac97cr_playback_ops = {
+static const struct snd_pcm_ops snd_ml403_ac97cr_playback_ops = {
.open = snd_ml403_ac97cr_playback_open,
.close = snd_ml403_ac97cr_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -770,7 +770,7 @@ static int snd_ml403_ac97cr_capture_close(struct snd_pcm_substream *substream)
.pointer = snd_ml403_ac97cr_pcm_pointer,
};

-static struct snd_pcm_ops snd_ml403_ac97cr_capture_ops = {
+static const struct snd_pcm_ops snd_ml403_ac97cr_capture_ops = {
.open = snd_ml403_ac97cr_capture_open,
.close = snd_ml403_ac97cr_capture_close,
.ioctl = snd_pcm_lib_ioctl,
--
1.9.1

2017-08-18 07:45:51

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 01/13] ALSA: aoa: constify snd_pcm_ops structures

snd_pcm_ops are not supposed to change at runtime. All functions
working with snd_pcm_ops provided by <sound/pcm.h> work with
const snd_pcm_ops. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <[email protected]>
---
sound/aoa/soundbus/i2sbus/pcm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/aoa/soundbus/i2sbus/pcm.c b/sound/aoa/soundbus/i2sbus/pcm.c
index 053b09c..e618531 100644
--- a/sound/aoa/soundbus/i2sbus/pcm.c
+++ b/sound/aoa/soundbus/i2sbus/pcm.c
@@ -778,7 +778,7 @@ static snd_pcm_uframes_t i2sbus_playback_pointer(struct snd_pcm_substream
return i2sbus_pcm_pointer(i2sdev, 0);
}

-static struct snd_pcm_ops i2sbus_playback_ops = {
+static const struct snd_pcm_ops i2sbus_playback_ops = {
.open = i2sbus_playback_open,
.close = i2sbus_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -848,7 +848,7 @@ static snd_pcm_uframes_t i2sbus_record_pointer(struct snd_pcm_substream
return i2sbus_pcm_pointer(i2sdev, 1);
}

-static struct snd_pcm_ops i2sbus_record_ops = {
+static const struct snd_pcm_ops i2sbus_record_ops = {
.open = i2sbus_record_open,
.close = i2sbus_record_close,
.ioctl = snd_pcm_lib_ioctl,
--
1.9.1

2017-08-19 09:04:33

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH 00/13] constify alsa snd_pcm_ops structures

On Fri, 18 Aug 2017 09:45:08 +0200,
Arvind Yadav wrote:
>
> snd_pcm_ops are not supposed to change at runtime. All functions
> working with snd_pcm_ops provided by <sound/pcm.h> work with
> const snd_pcm_ops. So mark the non-const structs as const.
>
> Arvind Yadav (13):
> [PATCH 01/13] ALSA: aoa: constify snd_pcm_ops structures
> [PATCH 02/13] ALSA: arm: constify snd_pcm_ops structures
> [PATCH 03/13] ALSA: atmel: constify snd_pcm_ops structures
> [PATCH 04/13] ALSA: drivers: constify snd_pcm_ops structures
> [PATCH 05/13] ALSA: firewire: constify snd_pcm_ops structures
> [PATCH 06/13] ALSA: mips: constify snd_pcm_ops structures
> [PATCH 07/13] ALSA: parisc: constify snd_pcm_ops structures
> [PATCH 08/13] ALSA: pcmcia: constify snd_pcm_ops structures
> [PATCH 09/13] ALSA: ppc: constify snd_pcm_ops structures
> [PATCH 10/13] ALSA: sh: constify snd_pcm_ops structures
> [PATCH 11/13] ALSA: sparc: constify snd_pcm_ops structures
> [PATCH 12/13] ALSA: spi: constify snd_pcm_ops structures
> [PATCH 13/13] ALSA: usb: constify snd_pcm_ops structures

Applied all patches. Thanks.


Takashi