2017-08-10 11:48:10

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 0/7] constify pci 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 (7):
[PATCH 1/7] ALSA: ali5451: constify snd_pcm_ops structures
[PATCH 2/7] ALSA: au88x0: constify snd_pcm_ops structures
[PATCH 3/7] ALSA: echoaudio: constify snd_pcm_ops structures
[PATCH 4/7] ALSA: intel8x0: constify snd_pcm_ops structures
[PATCH 5/7] ALSA: intel8x0m: constify snd_pcm_ops structures
[PATCH 6/7] ALSA: sis7019: constify snd_pcm_ops structures
[PATCH 7/7] ALSA: trident: constify snd_pcm_ops structures

sound/pci/ali5451/ali5451.c | 12 ++++++------
sound/pci/au88x0/au88x0_pcm.c | 2 +-
sound/pci/echoaudio/echoaudio.c | 8 ++++----
sound/pci/intel8x0.c | 24 ++++++++++++------------
sound/pci/intel8x0m.c | 8 ++++----
sound/pci/sis7019.c | 4 ++--
sound/pci/trident/trident_main.c | 4 ++--
7 files changed, 31 insertions(+), 31 deletions(-)

--
1.9.1


2017-08-10 11:48:14

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 1/7] ALSA: ali5451: 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/pci/ali5451/ali5451.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index 8567f1e..39547e3 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -1540,7 +1540,7 @@ static int snd_ali_close(struct snd_pcm_substream *substream)
return 0;
}

-static struct snd_pcm_ops snd_ali_playback_ops = {
+static const struct snd_pcm_ops snd_ali_playback_ops = {
.open = snd_ali_playback_open,
.close = snd_ali_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1551,7 +1551,7 @@ static int snd_ali_close(struct snd_pcm_substream *substream)
.pointer = snd_ali_playback_pointer,
};

-static struct snd_pcm_ops snd_ali_capture_ops = {
+static const struct snd_pcm_ops snd_ali_capture_ops = {
.open = snd_ali_capture_open,
.close = snd_ali_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1626,7 +1626,7 @@ static int snd_ali_modem_capture_open(struct snd_pcm_substream *substream)
return snd_ali_modem_open(substream, 1, ALI_MODEM_IN_CHANNEL);
}

-static struct snd_pcm_ops snd_ali_modem_playback_ops = {
+static const struct snd_pcm_ops snd_ali_modem_playback_ops = {
.open = snd_ali_modem_playback_open,
.close = snd_ali_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1637,7 +1637,7 @@ static int snd_ali_modem_capture_open(struct snd_pcm_substream *substream)
.pointer = snd_ali_pointer,
};

-static struct snd_pcm_ops snd_ali_modem_capture_ops = {
+static const struct snd_pcm_ops snd_ali_modem_capture_ops = {
.open = snd_ali_modem_capture_open,
.close = snd_ali_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1653,8 +1653,8 @@ struct ali_pcm_description {
char *name;
unsigned int playback_num;
unsigned int capture_num;
- struct snd_pcm_ops *playback_ops;
- struct snd_pcm_ops *capture_ops;
+ const struct snd_pcm_ops *playback_ops;
+ const struct snd_pcm_ops *capture_ops;
unsigned short class;
};

--
1.9.1

2017-08-10 11:48:17

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 2/7] ALSA: au88x0: 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/pci/au88x0/au88x0_pcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c
index 1aa9701..848eb3c 100644
--- a/sound/pci/au88x0/au88x0_pcm.c
+++ b/sound/pci/au88x0/au88x0_pcm.c
@@ -439,7 +439,7 @@ static snd_pcm_uframes_t snd_vortex_pcm_pointer(struct snd_pcm_substream *substr
}

/* operators */
-static struct snd_pcm_ops snd_vortex_playback_ops = {
+static const struct snd_pcm_ops snd_vortex_playback_ops = {
.open = snd_vortex_pcm_open,
.close = snd_vortex_pcm_close,
.ioctl = snd_pcm_lib_ioctl,
--
1.9.1

2017-08-10 11:48:24

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 4/7] ALSA: intel8x0: 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/pci/intel8x0.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index a8d7092..fcd032e 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -1367,7 +1367,7 @@ static int snd_intel8x0_ali_spdifout_close(struct snd_pcm_substream *substream)
}
#endif

-static struct snd_pcm_ops snd_intel8x0_playback_ops = {
+static const struct snd_pcm_ops snd_intel8x0_playback_ops = {
.open = snd_intel8x0_playback_open,
.close = snd_intel8x0_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1378,7 +1378,7 @@ static int snd_intel8x0_ali_spdifout_close(struct snd_pcm_substream *substream)
.pointer = snd_intel8x0_pcm_pointer,
};

-static struct snd_pcm_ops snd_intel8x0_capture_ops = {
+static const struct snd_pcm_ops snd_intel8x0_capture_ops = {
.open = snd_intel8x0_capture_open,
.close = snd_intel8x0_capture_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1389,7 +1389,7 @@ static int snd_intel8x0_ali_spdifout_close(struct snd_pcm_substream *substream)
.pointer = snd_intel8x0_pcm_pointer,
};

-static struct snd_pcm_ops snd_intel8x0_capture_mic_ops = {
+static const struct snd_pcm_ops snd_intel8x0_capture_mic_ops = {
.open = snd_intel8x0_mic_open,
.close = snd_intel8x0_mic_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1400,7 +1400,7 @@ static int snd_intel8x0_ali_spdifout_close(struct snd_pcm_substream *substream)
.pointer = snd_intel8x0_pcm_pointer,
};

-static struct snd_pcm_ops snd_intel8x0_capture_mic2_ops = {
+static const struct snd_pcm_ops snd_intel8x0_capture_mic2_ops = {
.open = snd_intel8x0_mic2_open,
.close = snd_intel8x0_mic2_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1411,7 +1411,7 @@ static int snd_intel8x0_ali_spdifout_close(struct snd_pcm_substream *substream)
.pointer = snd_intel8x0_pcm_pointer,
};

-static struct snd_pcm_ops snd_intel8x0_capture2_ops = {
+static const struct snd_pcm_ops snd_intel8x0_capture2_ops = {
.open = snd_intel8x0_capture2_open,
.close = snd_intel8x0_capture2_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1422,7 +1422,7 @@ static int snd_intel8x0_ali_spdifout_close(struct snd_pcm_substream *substream)
.pointer = snd_intel8x0_pcm_pointer,
};

-static struct snd_pcm_ops snd_intel8x0_spdif_ops = {
+static const struct snd_pcm_ops snd_intel8x0_spdif_ops = {
.open = snd_intel8x0_spdif_open,
.close = snd_intel8x0_spdif_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1433,7 +1433,7 @@ static int snd_intel8x0_ali_spdifout_close(struct snd_pcm_substream *substream)
.pointer = snd_intel8x0_pcm_pointer,
};

-static struct snd_pcm_ops snd_intel8x0_ali_playback_ops = {
+static const struct snd_pcm_ops snd_intel8x0_ali_playback_ops = {
.open = snd_intel8x0_playback_open,
.close = snd_intel8x0_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1444,7 +1444,7 @@ static int snd_intel8x0_ali_spdifout_close(struct snd_pcm_substream *substream)
.pointer = snd_intel8x0_pcm_pointer,
};

-static struct snd_pcm_ops snd_intel8x0_ali_capture_ops = {
+static const struct snd_pcm_ops snd_intel8x0_ali_capture_ops = {
.open = snd_intel8x0_capture_open,
.close = snd_intel8x0_capture_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1455,7 +1455,7 @@ static int snd_intel8x0_ali_spdifout_close(struct snd_pcm_substream *substream)
.pointer = snd_intel8x0_pcm_pointer,
};

-static struct snd_pcm_ops snd_intel8x0_ali_capture_mic_ops = {
+static const struct snd_pcm_ops snd_intel8x0_ali_capture_mic_ops = {
.open = snd_intel8x0_mic_open,
.close = snd_intel8x0_mic_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1466,7 +1466,7 @@ static int snd_intel8x0_ali_spdifout_close(struct snd_pcm_substream *substream)
.pointer = snd_intel8x0_pcm_pointer,
};

-static struct snd_pcm_ops snd_intel8x0_ali_ac97spdifout_ops = {
+static const struct snd_pcm_ops snd_intel8x0_ali_ac97spdifout_ops = {
.open = snd_intel8x0_ali_ac97spdifout_open,
.close = snd_intel8x0_ali_ac97spdifout_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -1503,8 +1503,8 @@ static int snd_intel8x0_ali_spdifout_close(struct snd_pcm_substream *substream)

struct ich_pcm_table {
char *suffix;
- struct snd_pcm_ops *playback_ops;
- struct snd_pcm_ops *capture_ops;
+ const struct snd_pcm_ops *playback_ops;
+ const struct snd_pcm_ops *capture_ops;
size_t prealloc_size;
size_t prealloc_max_size;
int ac97_idx;
--
1.9.1

2017-08-10 11:48:29

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 6/7] ALSA: sis7019: 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/pci/sis7019.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c
index f3860b8..3518887 100644
--- a/sound/pci/sis7019.c
+++ b/sound/pci/sis7019.c
@@ -872,7 +872,7 @@ static int sis_pcm_capture_prepare(struct snd_pcm_substream *substream)
return 0;
}

-static struct snd_pcm_ops sis_playback_ops = {
+static const struct snd_pcm_ops sis_playback_ops = {
.open = sis_playback_open,
.close = sis_substream_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -883,7 +883,7 @@ static int sis_pcm_capture_prepare(struct snd_pcm_substream *substream)
.pointer = sis_pcm_pointer,
};

-static struct snd_pcm_ops sis_capture_ops = {
+static const struct snd_pcm_ops sis_capture_ops = {
.open = sis_capture_open,
.close = sis_substream_close,
.ioctl = snd_pcm_lib_ioctl,
--
1.9.1

2017-08-10 11:48:38

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 7/7] ALSA: trident: 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/pci/trident/trident_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 64d3b8e..4561040 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -2093,7 +2093,7 @@ static int snd_trident_foldback_close(struct snd_pcm_substream *substream)
.page = snd_pcm_sgbuf_ops_page,
};

-static struct snd_pcm_ops snd_trident_capture_ops = {
+static const struct snd_pcm_ops snd_trident_capture_ops = {
.open = snd_trident_capture_open,
.close = snd_trident_capture_close,
.ioctl = snd_trident_ioctl,
@@ -2104,7 +2104,7 @@ static int snd_trident_foldback_close(struct snd_pcm_substream *substream)
.pointer = snd_trident_capture_pointer,
};

-static struct snd_pcm_ops snd_trident_si7018_capture_ops = {
+static const struct snd_pcm_ops snd_trident_si7018_capture_ops = {
.open = snd_trident_capture_open,
.close = snd_trident_capture_close,
.ioctl = snd_trident_ioctl,
--
1.9.1

2017-08-10 11:49:03

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 5/7] ALSA: intel8x0m: 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/pci/intel8x0m.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index 18ff668..2f1b878 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -685,7 +685,7 @@ static int snd_intel8x0m_capture_close(struct snd_pcm_substream *substream)
}


-static struct snd_pcm_ops snd_intel8x0m_playback_ops = {
+static const struct snd_pcm_ops snd_intel8x0m_playback_ops = {
.open = snd_intel8x0m_playback_open,
.close = snd_intel8x0m_playback_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -696,7 +696,7 @@ static int snd_intel8x0m_capture_close(struct snd_pcm_substream *substream)
.pointer = snd_intel8x0m_pcm_pointer,
};

-static struct snd_pcm_ops snd_intel8x0m_capture_ops = {
+static const struct snd_pcm_ops snd_intel8x0m_capture_ops = {
.open = snd_intel8x0m_capture_open,
.close = snd_intel8x0m_capture_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -710,8 +710,8 @@ static int snd_intel8x0m_capture_close(struct snd_pcm_substream *substream)

struct ich_pcm_table {
char *suffix;
- struct snd_pcm_ops *playback_ops;
- struct snd_pcm_ops *capture_ops;
+ const struct snd_pcm_ops *playback_ops;
+ const struct snd_pcm_ops *capture_ops;
size_t prealloc_size;
size_t prealloc_max_size;
int ac97_idx;
--
1.9.1

2017-08-10 11:48:22

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 3/7] ALSA: echoaudio: 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/pci/echoaudio/echoaudio.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index d15ecf9..7326695 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -826,7 +826,7 @@ static snd_pcm_uframes_t pcm_pointer(struct snd_pcm_substream *substream)


/* pcm *_ops structures */
-static struct snd_pcm_ops analog_playback_ops = {
+static const struct snd_pcm_ops analog_playback_ops = {
.open = pcm_analog_out_open,
.close = pcm_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -837,7 +837,7 @@ static snd_pcm_uframes_t pcm_pointer(struct snd_pcm_substream *substream)
.pointer = pcm_pointer,
.page = snd_pcm_sgbuf_ops_page,
};
-static struct snd_pcm_ops analog_capture_ops = {
+static const struct snd_pcm_ops analog_capture_ops = {
.open = pcm_analog_in_open,
.close = pcm_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -850,7 +850,7 @@ static snd_pcm_uframes_t pcm_pointer(struct snd_pcm_substream *substream)
};
#ifdef ECHOCARD_HAS_DIGITAL_IO
#ifndef ECHOCARD_HAS_VMIXER
-static struct snd_pcm_ops digital_playback_ops = {
+static const struct snd_pcm_ops digital_playback_ops = {
.open = pcm_digital_out_open,
.close = pcm_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -862,7 +862,7 @@ static snd_pcm_uframes_t pcm_pointer(struct snd_pcm_substream *substream)
.page = snd_pcm_sgbuf_ops_page,
};
#endif /* !ECHOCARD_HAS_VMIXER */
-static struct snd_pcm_ops digital_capture_ops = {
+static const struct snd_pcm_ops digital_capture_ops = {
.open = pcm_digital_in_open,
.close = pcm_close,
.ioctl = snd_pcm_lib_ioctl,
--
1.9.1

2017-08-10 15:57:25

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH 0/7] constify pci snd_pcm_ops structures

On Thu, 10 Aug 2017 13:47:31 +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 (7):
> [PATCH 1/7] ALSA: ali5451: constify snd_pcm_ops structures
> [PATCH 2/7] ALSA: au88x0: constify snd_pcm_ops structures
> [PATCH 3/7] ALSA: echoaudio: constify snd_pcm_ops structures
> [PATCH 4/7] ALSA: intel8x0: constify snd_pcm_ops structures
> [PATCH 5/7] ALSA: intel8x0m: constify snd_pcm_ops structures
> [PATCH 6/7] ALSA: sis7019: constify snd_pcm_ops structures
> [PATCH 7/7] ALSA: trident: constify snd_pcm_ops structures

Applied all 7 patches now. Thanks.


Takashi