[alsa-devel] [PATCH 0/7] Constify snd_rawmidi_ops
Hi,
this is a small patchset to constify snd_rawmidi_ops references, as already done for many other ops.
Takashi
==
Takashi Iwai (7): ALSA: rawmidi: Add const to snd_rawmidi_ops ALSA: seq: Constify snd_rawmidi_ops ALSA: drivers: Constify snd_rawmidi_ops ALSA: isa: Constify snd_rawmidi_ops ALSA: pci: Constify snd_rawmidi_ops ALSA: firewire: Constify snd_rawmidi_ops ALSA: usb: Constify snd_rawmidi_ops
include/sound/rawmidi.h | 4 ++-- include/sound/snd_wavefront.h | 4 ++-- sound/core/rawmidi.c | 2 +- sound/core/seq/seq_virmidi.c | 4 ++-- sound/drivers/mpu401/mpu401_uart.c | 4 ++-- sound/drivers/mtpav.c | 4 ++-- sound/drivers/mts64.c | 4 ++-- sound/drivers/portman2x4.c | 4 ++-- sound/drivers/serial-u16550.c | 4 ++-- sound/firewire/bebob/bebob_midi.c | 4 ++-- sound/firewire/dice/dice-midi.c | 4 ++-- sound/firewire/digi00x/digi00x-midi.c | 8 ++++---- sound/firewire/fireworks/fireworks_midi.c | 4 ++-- sound/firewire/oxfw/oxfw-midi.c | 4 ++-- sound/firewire/oxfw/oxfw-scs1x.c | 4 ++-- sound/firewire/tascam/tascam-midi.c | 4 ++-- sound/isa/gus/gus_uart.c | 4 ++-- sound/isa/msnd/msnd_midi.c | 2 +- sound/isa/sb/sb8_midi.c | 4 ++-- sound/isa/wavefront/wavefront_midi.c | 4 ++-- sound/pci/ca0106/ca_midi.c | 4 ++-- sound/pci/cs4281.c | 4 ++-- sound/pci/cs46xx/cs46xx_lib.c | 4 ++-- sound/pci/echoaudio/midi.c | 4 ++-- sound/pci/emu10k1/emu10k1x.c | 4 ++-- sound/pci/emu10k1/emumpu401.c | 4 ++-- sound/pci/ens1370.c | 4 ++-- sound/pci/ice1712/ice1724.c | 4 ++-- sound/pci/rme9652/hdsp.c | 4 ++-- sound/pci/rme9652/hdspm.c | 4 ++-- sound/usb/6fire/midi.c | 4 ++-- sound/usb/bcd2000/bcd2000.c | 4 ++-- sound/usb/caiaq/midi.c | 4 ++-- sound/usb/line6/midi.c | 4 ++-- sound/usb/midi.c | 4 ++-- 35 files changed, 70 insertions(+), 70 deletions(-)
Make snd_rawmidi_substream.ops to be a const pointer to be safer and allow more optimization. The patches to constify each rawmidi ops will follow.
Signed-off-by: Takashi Iwai tiwai@suse.de --- include/sound/rawmidi.h | 4 ++-- sound/core/rawmidi.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h index f730b91e472f..492a3ca7f17b 100644 --- a/include/sound/rawmidi.h +++ b/include/sound/rawmidi.h @@ -103,7 +103,7 @@ struct snd_rawmidi_substream { struct snd_rawmidi_runtime *runtime; struct pid *pid; /* hardware layer */ - struct snd_rawmidi_ops *ops; + const struct snd_rawmidi_ops *ops; };
struct snd_rawmidi_file { @@ -155,7 +155,7 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device, int output_count, int input_count, struct snd_rawmidi **rmidi); void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream, - struct snd_rawmidi_ops *ops); + const struct snd_rawmidi_ops *ops);
/* callbacks */
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 2096bb0835c8..8da9cb245d01 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -1749,7 +1749,7 @@ static int snd_rawmidi_dev_disconnect(struct snd_device *device) * Sets the rawmidi operators for the given stream direction. */ void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream, - struct snd_rawmidi_ops *ops) + const struct snd_rawmidi_ops *ops) { struct snd_rawmidi_substream *substream;
Now snd_rawmidi_ops is maintained as a const pointer in snd_rawmidi, we can constify the definitions.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/core/seq/seq_virmidi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c index c82ed3e70506..52f31f1498f9 100644 --- a/sound/core/seq/seq_virmidi.c +++ b/sound/core/seq/seq_virmidi.c @@ -349,13 +349,13 @@ static int snd_virmidi_unuse(void *private_data, * Register functions */
-static struct snd_rawmidi_ops snd_virmidi_input_ops = { +static const struct snd_rawmidi_ops snd_virmidi_input_ops = { .open = snd_virmidi_input_open, .close = snd_virmidi_input_close, .trigger = snd_virmidi_input_trigger, };
-static struct snd_rawmidi_ops snd_virmidi_output_ops = { +static const struct snd_rawmidi_ops snd_virmidi_output_ops = { .open = snd_virmidi_output_open, .close = snd_virmidi_output_close, .trigger = snd_virmidi_output_trigger,
Now snd_rawmidi_ops is maintained as a const pointer in snd_rawmidi, we can constify the definitions.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/drivers/mpu401/mpu401_uart.c | 4 ++-- sound/drivers/mtpav.c | 4 ++-- sound/drivers/mts64.c | 4 ++-- sound/drivers/portman2x4.c | 4 ++-- sound/drivers/serial-u16550.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c index 776596b5ee05..3a7c317ae012 100644 --- a/sound/drivers/mpu401/mpu401_uart.c +++ b/sound/drivers/mpu401/mpu401_uart.c @@ -481,14 +481,14 @@ snd_mpu401_uart_output_trigger(struct snd_rawmidi_substream *substream, int up)
*/
-static struct snd_rawmidi_ops snd_mpu401_uart_output = +static const struct snd_rawmidi_ops snd_mpu401_uart_output = { .open = snd_mpu401_uart_output_open, .close = snd_mpu401_uart_output_close, .trigger = snd_mpu401_uart_output_trigger, };
-static struct snd_rawmidi_ops snd_mpu401_uart_input = +static const struct snd_rawmidi_ops snd_mpu401_uart_input = { .open = snd_mpu401_uart_input_open, .close = snd_mpu401_uart_input_close, diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index 30e8a1d5bc87..00b31f92c504 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c @@ -600,13 +600,13 @@ static int snd_mtpav_get_ISA(struct mtpav *mcard) /* */
-static struct snd_rawmidi_ops snd_mtpav_output = { +static const struct snd_rawmidi_ops snd_mtpav_output = { .open = snd_mtpav_output_open, .close = snd_mtpav_output_close, .trigger = snd_mtpav_output_trigger, };
-static struct snd_rawmidi_ops snd_mtpav_input = { +static const struct snd_rawmidi_ops snd_mtpav_input = { .open = snd_mtpav_input_open, .close = snd_mtpav_input_close, .trigger = snd_mtpav_input_trigger, diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c index fd4d18df84d3..f32e81342247 100644 --- a/sound/drivers/mts64.c +++ b/sound/drivers/mts64.c @@ -749,13 +749,13 @@ static void snd_mts64_rawmidi_input_trigger(struct snd_rawmidi_substream *substr spin_unlock_irqrestore(&mts->lock, flags); }
-static struct snd_rawmidi_ops snd_mts64_rawmidi_output_ops = { +static const struct snd_rawmidi_ops snd_mts64_rawmidi_output_ops = { .open = snd_mts64_rawmidi_open, .close = snd_mts64_rawmidi_close, .trigger = snd_mts64_rawmidi_output_trigger };
-static struct snd_rawmidi_ops snd_mts64_rawmidi_input_ops = { +static const struct snd_rawmidi_ops snd_mts64_rawmidi_input_ops = { .open = snd_mts64_rawmidi_open, .close = snd_mts64_rawmidi_close, .trigger = snd_mts64_rawmidi_input_trigger diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c index 189e3e7028af..ec8a94325ef6 100644 --- a/sound/drivers/portman2x4.c +++ b/sound/drivers/portman2x4.c @@ -546,13 +546,13 @@ static void snd_portman_midi_output_trigger(struct snd_rawmidi_substream *substr spin_unlock_irqrestore(&pm->reg_lock, flags); }
-static struct snd_rawmidi_ops snd_portman_midi_output = { +static const struct snd_rawmidi_ops snd_portman_midi_output = { .open = snd_portman_midi_open, .close = snd_portman_midi_close, .trigger = snd_portman_midi_output_trigger, };
-static struct snd_rawmidi_ops snd_portman_midi_input = { +static const struct snd_rawmidi_ops snd_portman_midi_input = { .open = snd_portman_midi_open, .close = snd_portman_midi_close, .trigger = snd_portman_midi_input_trigger, diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c index 1927b89e1d1f..60d51ac4ccfe 100644 --- a/sound/drivers/serial-u16550.c +++ b/sound/drivers/serial-u16550.c @@ -752,14 +752,14 @@ static void snd_uart16550_output_trigger(struct snd_rawmidi_substream *substream snd_uart16550_output_write(substream); }
-static struct snd_rawmidi_ops snd_uart16550_output = +static const struct snd_rawmidi_ops snd_uart16550_output = { .open = snd_uart16550_output_open, .close = snd_uart16550_output_close, .trigger = snd_uart16550_output_trigger, };
-static struct snd_rawmidi_ops snd_uart16550_input = +static const struct snd_rawmidi_ops snd_uart16550_input = { .open = snd_uart16550_input_open, .close = snd_uart16550_input_close,
Now snd_rawmidi_ops is maintained as a const pointer in snd_rawmidi, we can constify the definitions.
Signed-off-by: Takashi Iwai tiwai@suse.de --- include/sound/snd_wavefront.h | 4 ++-- sound/isa/gus/gus_uart.c | 4 ++-- sound/isa/msnd/msnd_midi.c | 2 +- sound/isa/sb/sb8_midi.c | 4 ++-- sound/isa/wavefront/wavefront_midi.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/sound/snd_wavefront.h b/include/sound/snd_wavefront.h index 35e94b3d1ec7..cd0bab1ef6f1 100644 --- a/include/sound/snd_wavefront.h +++ b/include/sound/snd_wavefront.h @@ -37,8 +37,8 @@ struct _snd_wavefront_midi { #define MPU_ACK 0xFE #define UART_MODE_ON 0x3F
-extern struct snd_rawmidi_ops snd_wavefront_midi_output; -extern struct snd_rawmidi_ops snd_wavefront_midi_input; +extern const struct snd_rawmidi_ops snd_wavefront_midi_output; +extern const struct snd_rawmidi_ops snd_wavefront_midi_input;
extern void snd_wavefront_midi_enable_virtual (snd_wavefront_card_t *); extern void snd_wavefront_midi_disable_virtual (snd_wavefront_card_t *); diff --git a/sound/isa/gus/gus_uart.c b/sound/isa/gus/gus_uart.c index 3992912743f5..ac5f5687d1a3 100644 --- a/sound/isa/gus/gus_uart.c +++ b/sound/isa/gus/gus_uart.c @@ -227,14 +227,14 @@ static void snd_gf1_uart_output_trigger(struct snd_rawmidi_substream *substream, spin_unlock_irqrestore(&gus->uart_cmd_lock, flags); }
-static struct snd_rawmidi_ops snd_gf1_uart_output = +static const struct snd_rawmidi_ops snd_gf1_uart_output = { .open = snd_gf1_uart_output_open, .close = snd_gf1_uart_output_close, .trigger = snd_gf1_uart_output_trigger, };
-static struct snd_rawmidi_ops snd_gf1_uart_input = +static const struct snd_rawmidi_ops snd_gf1_uart_input = { .open = snd_gf1_uart_input_open, .close = snd_gf1_uart_input_close, diff --git a/sound/isa/msnd/msnd_midi.c b/sound/isa/msnd/msnd_midi.c index ffc67fd80c23..912b5a9ccbab 100644 --- a/sound/isa/msnd/msnd_midi.c +++ b/sound/isa/msnd/msnd_midi.c @@ -142,7 +142,7 @@ void snd_msndmidi_input_read(void *mpuv) } EXPORT_SYMBOL(snd_msndmidi_input_read);
-static struct snd_rawmidi_ops snd_msndmidi_input = { +static const struct snd_rawmidi_ops snd_msndmidi_input = { .open = snd_msndmidi_input_open, .close = snd_msndmidi_input_close, .trigger = snd_msndmidi_input_trigger, diff --git a/sound/isa/sb/sb8_midi.c b/sound/isa/sb/sb8_midi.c index d551c50e549f..bd672abb4854 100644 --- a/sound/isa/sb/sb8_midi.c +++ b/sound/isa/sb/sb8_midi.c @@ -247,14 +247,14 @@ static void snd_sb8dsp_midi_output_trigger(struct snd_rawmidi_substream *substre snd_sb8dsp_midi_output_write(substream); }
-static struct snd_rawmidi_ops snd_sb8dsp_midi_output = +static const struct snd_rawmidi_ops snd_sb8dsp_midi_output = { .open = snd_sb8dsp_midi_output_open, .close = snd_sb8dsp_midi_output_close, .trigger = snd_sb8dsp_midi_output_trigger, };
-static struct snd_rawmidi_ops snd_sb8dsp_midi_input = +static const struct snd_rawmidi_ops snd_sb8dsp_midi_input = { .open = snd_sb8dsp_midi_input_open, .close = snd_sb8dsp_midi_input_close, diff --git a/sound/isa/wavefront/wavefront_midi.c b/sound/isa/wavefront/wavefront_midi.c index 8a80fc6a616b..2aa05f3aaa38 100644 --- a/sound/isa/wavefront/wavefront_midi.c +++ b/sound/isa/wavefront/wavefront_midi.c @@ -559,14 +559,14 @@ snd_wavefront_midi_start (snd_wavefront_card_t *card) return 0; }
-struct snd_rawmidi_ops snd_wavefront_midi_output = +const struct snd_rawmidi_ops snd_wavefront_midi_output = { .open = snd_wavefront_midi_output_open, .close = snd_wavefront_midi_output_close, .trigger = snd_wavefront_midi_output_trigger, };
-struct snd_rawmidi_ops snd_wavefront_midi_input = +const struct snd_rawmidi_ops snd_wavefront_midi_input = { .open = snd_wavefront_midi_input_open, .close = snd_wavefront_midi_input_close,
Now snd_rawmidi_ops is maintained as a const pointer in snd_rawmidi, we can constify the definitions.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/ca0106/ca_midi.c | 4 ++-- sound/pci/cs4281.c | 4 ++-- sound/pci/cs46xx/cs46xx_lib.c | 4 ++-- sound/pci/echoaudio/midi.c | 4 ++-- sound/pci/emu10k1/emu10k1x.c | 4 ++-- sound/pci/emu10k1/emumpu401.c | 4 ++-- sound/pci/ens1370.c | 4 ++-- sound/pci/ice1712/ice1724.c | 4 ++-- sound/pci/rme9652/hdsp.c | 4 ++-- sound/pci/rme9652/hdspm.c | 4 ++-- 10 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/sound/pci/ca0106/ca_midi.c b/sound/pci/ca0106/ca_midi.c index b91c7f6d19f9..4d4d385205eb 100644 --- a/sound/pci/ca0106/ca_midi.c +++ b/sound/pci/ca0106/ca_midi.c @@ -255,14 +255,14 @@ static void ca_midi_output_trigger(struct snd_rawmidi_substream *substream, int } }
-static struct snd_rawmidi_ops ca_midi_output = +static const struct snd_rawmidi_ops ca_midi_output = { .open = ca_midi_output_open, .close = ca_midi_output_close, .trigger = ca_midi_output_trigger, };
-static struct snd_rawmidi_ops ca_midi_input = +static const struct snd_rawmidi_ops ca_midi_input = { .open = ca_midi_input_open, .close = ca_midi_input_close, diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index 8f0f5f24e40e..fa7c51684dd2 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c @@ -1767,14 +1767,14 @@ static void snd_cs4281_midi_output_trigger(struct snd_rawmidi_substream *substre spin_unlock_irqrestore(&chip->reg_lock, flags); }
-static struct snd_rawmidi_ops snd_cs4281_midi_output = +static const struct snd_rawmidi_ops snd_cs4281_midi_output = { .open = snd_cs4281_midi_output_open, .close = snd_cs4281_midi_output_close, .trigger = snd_cs4281_midi_output_trigger, };
-static struct snd_rawmidi_ops snd_cs4281_midi_input = +static const struct snd_rawmidi_ops snd_cs4281_midi_input = { .open = snd_cs4281_midi_input_open, .close = snd_cs4281_midi_input_close, diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index fde3cd48258c..e561fd536f5b 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c @@ -2683,14 +2683,14 @@ static void snd_cs46xx_midi_output_trigger(struct snd_rawmidi_substream *substre spin_unlock_irqrestore(&chip->reg_lock, flags); }
-static struct snd_rawmidi_ops snd_cs46xx_midi_output = +static const struct snd_rawmidi_ops snd_cs46xx_midi_output = { .open = snd_cs46xx_midi_output_open, .close = snd_cs46xx_midi_output_close, .trigger = snd_cs46xx_midi_output_trigger, };
-static struct snd_rawmidi_ops snd_cs46xx_midi_input = +static const struct snd_rawmidi_ops snd_cs46xx_midi_input = { .open = snd_cs46xx_midi_input_open, .close = snd_cs46xx_midi_input_close, diff --git a/sound/pci/echoaudio/midi.c b/sound/pci/echoaudio/midi.c index a8fe58335ddc..8c685ddb1a41 100644 --- a/sound/pci/echoaudio/midi.c +++ b/sound/pci/echoaudio/midi.c @@ -288,13 +288,13 @@ static int snd_echo_midi_output_close(struct snd_rawmidi_substream *substream)
-static struct snd_rawmidi_ops snd_echo_midi_input = { +static const struct snd_rawmidi_ops snd_echo_midi_input = { .open = snd_echo_midi_input_open, .close = snd_echo_midi_input_close, .trigger = snd_echo_midi_input_trigger, };
-static struct snd_rawmidi_ops snd_echo_midi_output = { +static const struct snd_rawmidi_ops snd_echo_midi_output = { .open = snd_echo_midi_output_open, .close = snd_echo_midi_output_close, .trigger = snd_echo_midi_output_trigger, diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 921037ed8468..32842734ada6 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c @@ -1486,14 +1486,14 @@ static void snd_emu10k1x_midi_output_trigger(struct snd_rawmidi_substream *subst
*/
-static struct snd_rawmidi_ops snd_emu10k1x_midi_output = +static const struct snd_rawmidi_ops snd_emu10k1x_midi_output = { .open = snd_emu10k1x_midi_output_open, .close = snd_emu10k1x_midi_output_close, .trigger = snd_emu10k1x_midi_output_trigger, };
-static struct snd_rawmidi_ops snd_emu10k1x_midi_input = +static const struct snd_rawmidi_ops snd_emu10k1x_midi_input = { .open = snd_emu10k1x_midi_input_open, .close = snd_emu10k1x_midi_input_close, diff --git a/sound/pci/emu10k1/emumpu401.c b/sound/pci/emu10k1/emumpu401.c index fdf2b0ada489..b6650f5c1621 100644 --- a/sound/pci/emu10k1/emumpu401.c +++ b/sound/pci/emu10k1/emumpu401.c @@ -308,14 +308,14 @@ static void snd_emu10k1_midi_output_trigger(struct snd_rawmidi_substream *substr
*/
-static struct snd_rawmidi_ops snd_emu10k1_midi_output = +static const struct snd_rawmidi_ops snd_emu10k1_midi_output = { .open = snd_emu10k1_midi_output_open, .close = snd_emu10k1_midi_output_close, .trigger = snd_emu10k1_midi_output_trigger, };
-static struct snd_rawmidi_ops snd_emu10k1_midi_input = +static const struct snd_rawmidi_ops snd_emu10k1_midi_input = { .open = snd_emu10k1_midi_input_open, .close = snd_emu10k1_midi_input_close, diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index 51736c2b5a00..164adad91650 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c @@ -2317,14 +2317,14 @@ static void snd_ensoniq_midi_output_trigger(struct snd_rawmidi_substream *substr spin_unlock_irqrestore(&ensoniq->reg_lock, flags); }
-static struct snd_rawmidi_ops snd_ensoniq_midi_output = +static const struct snd_rawmidi_ops snd_ensoniq_midi_output = { .open = snd_ensoniq_midi_output_open, .close = snd_ensoniq_midi_output_close, .trigger = snd_ensoniq_midi_output_trigger, };
-static struct snd_rawmidi_ops snd_ensoniq_midi_input = +static const struct snd_rawmidi_ops snd_ensoniq_midi_input = { .open = snd_ensoniq_midi_input_open, .close = snd_ensoniq_midi_input_close, diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index e5c52ed9b674..842744e7a139 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -367,7 +367,7 @@ static void vt1724_midi_output_drain(struct snd_rawmidi_substream *s) } while (time_after(timeout, jiffies)); }
-static struct snd_rawmidi_ops vt1724_midi_output_ops = { +static const struct snd_rawmidi_ops vt1724_midi_output_ops = { .open = vt1724_midi_output_open, .close = vt1724_midi_output_close, .trigger = vt1724_midi_output_trigger, @@ -402,7 +402,7 @@ static void vt1724_midi_input_trigger(struct snd_rawmidi_substream *s, int up) spin_unlock_irqrestore(&ice->reg_lock, flags); }
-static struct snd_rawmidi_ops vt1724_midi_input_ops = { +static const struct snd_rawmidi_ops vt1724_midi_input_ops = { .open = vt1724_midi_input_open, .close = vt1724_midi_input_close, .trigger = vt1724_midi_input_trigger, diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index b94fc6357139..fc0face6cdc6 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -1510,14 +1510,14 @@ static int snd_hdsp_midi_output_close(struct snd_rawmidi_substream *substream) return 0; }
-static struct snd_rawmidi_ops snd_hdsp_midi_output = +static const struct snd_rawmidi_ops snd_hdsp_midi_output = { .open = snd_hdsp_midi_output_open, .close = snd_hdsp_midi_output_close, .trigger = snd_hdsp_midi_output_trigger, };
-static struct snd_rawmidi_ops snd_hdsp_midi_input = +static const struct snd_rawmidi_ops snd_hdsp_midi_input = { .open = snd_hdsp_midi_input_open, .close = snd_hdsp_midi_input_close, diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 14bbf55c1ef9..c48acdb0e186 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -2043,14 +2043,14 @@ static int snd_hdspm_midi_output_close(struct snd_rawmidi_substream *substream) return 0; }
-static struct snd_rawmidi_ops snd_hdspm_midi_output = +static const struct snd_rawmidi_ops snd_hdspm_midi_output = { .open = snd_hdspm_midi_output_open, .close = snd_hdspm_midi_output_close, .trigger = snd_hdspm_midi_output_trigger, };
-static struct snd_rawmidi_ops snd_hdspm_midi_input = +static const struct snd_rawmidi_ops snd_hdspm_midi_input = { .open = snd_hdspm_midi_input_open, .close = snd_hdspm_midi_input_close,
Now snd_rawmidi_ops is maintained as a const pointer in snd_rawmidi, we can constify the definitions.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/firewire/bebob/bebob_midi.c | 4 ++-- sound/firewire/dice/dice-midi.c | 4 ++-- sound/firewire/digi00x/digi00x-midi.c | 8 ++++---- sound/firewire/fireworks/fireworks_midi.c | 4 ++-- sound/firewire/oxfw/oxfw-midi.c | 4 ++-- sound/firewire/oxfw/oxfw-scs1x.c | 4 ++-- sound/firewire/tascam/tascam-midi.c | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/sound/firewire/bebob/bebob_midi.c b/sound/firewire/bebob/bebob_midi.c index 7e5fb4b990bd..3befa3eca6ef 100644 --- a/sound/firewire/bebob/bebob_midi.c +++ b/sound/firewire/bebob/bebob_midi.c @@ -120,12 +120,12 @@ static void set_midi_substream_names(struct snd_bebob *bebob,
int snd_bebob_create_midi_devices(struct snd_bebob *bebob) { - static struct snd_rawmidi_ops capture_ops = { + static const struct snd_rawmidi_ops capture_ops = { .open = midi_capture_open, .close = midi_capture_close, .trigger = midi_capture_trigger, }; - static struct snd_rawmidi_ops playback_ops = { + static const struct snd_rawmidi_ops playback_ops = { .open = midi_playback_open, .close = midi_playback_close, .trigger = midi_playback_trigger, diff --git a/sound/firewire/dice/dice-midi.c b/sound/firewire/dice/dice-midi.c index cdf71c211342..8ff6da3c51f7 100644 --- a/sound/firewire/dice/dice-midi.c +++ b/sound/firewire/dice/dice-midi.c @@ -91,12 +91,12 @@ static void set_midi_substream_names(struct snd_dice *dice,
int snd_dice_create_midi(struct snd_dice *dice) { - static struct snd_rawmidi_ops capture_ops = { + static const struct snd_rawmidi_ops capture_ops = { .open = midi_open, .close = midi_close, .trigger = midi_capture_trigger, }; - static struct snd_rawmidi_ops playback_ops = { + static const struct snd_rawmidi_ops playback_ops = { .open = midi_open, .close = midi_close, .trigger = midi_playback_trigger, diff --git a/sound/firewire/digi00x/digi00x-midi.c b/sound/firewire/digi00x/digi00x-midi.c index 8689c3bb4c6a..915d2a21223e 100644 --- a/sound/firewire/digi00x/digi00x-midi.c +++ b/sound/firewire/digi00x/digi00x-midi.c @@ -148,22 +148,22 @@ static void set_midi_substream_names(struct snd_dg00x *dg00x,
int snd_dg00x_create_midi_devices(struct snd_dg00x *dg00x) { - static struct snd_rawmidi_ops phys_capture_ops = { + static const struct snd_rawmidi_ops phys_capture_ops = { .open = midi_phys_open, .close = midi_phys_close, .trigger = midi_phys_capture_trigger, }; - static struct snd_rawmidi_ops phys_playback_ops = { + static const struct snd_rawmidi_ops phys_playback_ops = { .open = midi_phys_open, .close = midi_phys_close, .trigger = midi_phys_playback_trigger, }; - static struct snd_rawmidi_ops ctl_capture_ops = { + static const struct snd_rawmidi_ops ctl_capture_ops = { .open = midi_ctl_open, .close = midi_ctl_capture_close, .trigger = midi_ctl_capture_trigger, }; - static struct snd_rawmidi_ops ctl_playback_ops = { + static const struct snd_rawmidi_ops ctl_playback_ops = { .open = midi_ctl_open, .close = midi_ctl_playback_close, .trigger = midi_ctl_playback_trigger, diff --git a/sound/firewire/fireworks/fireworks_midi.c b/sound/firewire/fireworks/fireworks_midi.c index 2873eca22bfc..f5da2cd4ce42 100644 --- a/sound/firewire/fireworks/fireworks_midi.c +++ b/sound/firewire/fireworks/fireworks_midi.c @@ -120,12 +120,12 @@ static void set_midi_substream_names(struct snd_efw *efw,
int snd_efw_create_midi_devices(struct snd_efw *efw) { - static struct snd_rawmidi_ops capture_ops = { + static const struct snd_rawmidi_ops capture_ops = { .open = midi_capture_open, .close = midi_capture_close, .trigger = midi_capture_trigger, }; - static struct snd_rawmidi_ops playback_ops = { + static const struct snd_rawmidi_ops playback_ops = { .open = midi_playback_open, .close = midi_playback_close, .trigger = midi_playback_trigger, diff --git a/sound/firewire/oxfw/oxfw-midi.c b/sound/firewire/oxfw/oxfw-midi.c index 076a1a977275..b7bbd77dfff1 100644 --- a/sound/firewire/oxfw/oxfw-midi.c +++ b/sound/firewire/oxfw/oxfw-midi.c @@ -130,12 +130,12 @@ static void set_midi_substream_names(struct snd_oxfw *oxfw,
int snd_oxfw_create_midi(struct snd_oxfw *oxfw) { - static struct snd_rawmidi_ops capture_ops = { + static const struct snd_rawmidi_ops capture_ops = { .open = midi_capture_open, .close = midi_capture_close, .trigger = midi_capture_trigger, }; - static struct snd_rawmidi_ops playback_ops = { + static const struct snd_rawmidi_ops playback_ops = { .open = midi_playback_open, .close = midi_playback_close, .trigger = midi_playback_trigger, diff --git a/sound/firewire/oxfw/oxfw-scs1x.c b/sound/firewire/oxfw/oxfw-scs1x.c index f897c9831077..79400586b7ac 100644 --- a/sound/firewire/oxfw/oxfw-scs1x.c +++ b/sound/firewire/oxfw/oxfw-scs1x.c @@ -297,7 +297,7 @@ static void midi_capture_trigger(struct snd_rawmidi_substream *stream, int up) } }
-static struct snd_rawmidi_ops midi_capture_ops = { +static const struct snd_rawmidi_ops midi_capture_ops = { .open = midi_capture_open, .close = midi_capture_close, .trigger = midi_capture_trigger, @@ -338,7 +338,7 @@ static void midi_playback_drain(struct snd_rawmidi_substream *stream) wait_event(scs->idle_wait, scs->output_idle); }
-static struct snd_rawmidi_ops midi_playback_ops = { +static const struct snd_rawmidi_ops midi_playback_ops = { .open = midi_playback_open, .close = midi_playback_close, .trigger = midi_playback_trigger, diff --git a/sound/firewire/tascam/tascam-midi.c b/sound/firewire/tascam/tascam-midi.c index 7fdc71e4763e..df4f95d65925 100644 --- a/sound/firewire/tascam/tascam-midi.c +++ b/sound/firewire/tascam/tascam-midi.c @@ -70,12 +70,12 @@ static void midi_playback_trigger(struct snd_rawmidi_substream *substrm, int up)
int snd_tscm_create_midi_devices(struct snd_tscm *tscm) { - static struct snd_rawmidi_ops capture_ops = { + static const struct snd_rawmidi_ops capture_ops = { .open = midi_capture_open, .close = midi_capture_close, .trigger = midi_capture_trigger, }; - static struct snd_rawmidi_ops playback_ops = { + static const struct snd_rawmidi_ops playback_ops = { .open = midi_playback_open, .close = midi_playback_close, .trigger = midi_playback_trigger,
Now snd_rawmidi_ops is maintained as a const pointer in snd_rawmidi, we can constify the definitions.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/usb/6fire/midi.c | 4 ++-- sound/usb/bcd2000/bcd2000.c | 4 ++-- sound/usb/caiaq/midi.c | 4 ++-- sound/usb/line6/midi.c | 4 ++-- sound/usb/midi.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/sound/usb/6fire/midi.c b/sound/usb/6fire/midi.c index 3d410969553e..aa5adbb6eb5d 100644 --- a/sound/usb/6fire/midi.c +++ b/sound/usb/6fire/midi.c @@ -139,14 +139,14 @@ static void usb6fire_midi_in_trigger( spin_unlock_irqrestore(&rt->in_lock, flags); }
-static struct snd_rawmidi_ops out_ops = { +static const struct snd_rawmidi_ops out_ops = { .open = usb6fire_midi_out_open, .close = usb6fire_midi_out_close, .trigger = usb6fire_midi_out_trigger, .drain = usb6fire_midi_out_drain };
-static struct snd_rawmidi_ops in_ops = { +static const struct snd_rawmidi_ops in_ops = { .open = usb6fire_midi_in_open, .close = usb6fire_midi_in_close, .trigger = usb6fire_midi_in_trigger diff --git a/sound/usb/bcd2000/bcd2000.c b/sound/usb/bcd2000/bcd2000.c index d060dddcc52d..2ff9d578753a 100644 --- a/sound/usb/bcd2000/bcd2000.c +++ b/sound/usb/bcd2000/bcd2000.c @@ -252,13 +252,13 @@ static void bcd2000_input_complete(struct urb *urb) __func__, ret); }
-static struct snd_rawmidi_ops bcd2000_midi_output = { +static const struct snd_rawmidi_ops bcd2000_midi_output = { .open = bcd2000_midi_output_open, .close = bcd2000_midi_output_close, .trigger = bcd2000_midi_output_trigger, };
-static struct snd_rawmidi_ops bcd2000_midi_input = { +static const struct snd_rawmidi_ops bcd2000_midi_input = { .open = bcd2000_midi_input_open, .close = bcd2000_midi_input_close, .trigger = bcd2000_midi_input_trigger, diff --git a/sound/usb/caiaq/midi.c b/sound/usb/caiaq/midi.c index 2d7588461b33..f8e5b1b57c4f 100644 --- a/sound/usb/caiaq/midi.c +++ b/sound/usb/caiaq/midi.c @@ -102,14 +102,14 @@ static void snd_usb_caiaq_midi_output_trigger(struct snd_rawmidi_substream *subs }
-static struct snd_rawmidi_ops snd_usb_caiaq_midi_output = +static const struct snd_rawmidi_ops snd_usb_caiaq_midi_output = { .open = snd_usb_caiaq_midi_output_open, .close = snd_usb_caiaq_midi_output_close, .trigger = snd_usb_caiaq_midi_output_trigger, };
-static struct snd_rawmidi_ops snd_usb_caiaq_midi_input = +static const struct snd_rawmidi_ops snd_usb_caiaq_midi_input = { .open = snd_usb_caiaq_midi_input_open, .close = snd_usb_caiaq_midi_input_close, diff --git a/sound/usb/line6/midi.c b/sound/usb/line6/midi.c index d0fb2f205bd9..1d3a23b02d68 100644 --- a/sound/usb/line6/midi.c +++ b/sound/usb/line6/midi.c @@ -200,14 +200,14 @@ static void line6_midi_input_trigger(struct snd_rawmidi_substream *substream, line6->line6midi->substream_receive = NULL; }
-static struct snd_rawmidi_ops line6_midi_output_ops = { +static const struct snd_rawmidi_ops line6_midi_output_ops = { .open = line6_midi_output_open, .close = line6_midi_output_close, .trigger = line6_midi_output_trigger, .drain = line6_midi_output_drain, };
-static struct snd_rawmidi_ops line6_midi_input_ops = { +static const struct snd_rawmidi_ops line6_midi_input_ops = { .open = line6_midi_input_open, .close = line6_midi_input_close, .trigger = line6_midi_input_trigger, diff --git a/sound/usb/midi.c b/sound/usb/midi.c index 7ba92921bf28..6e763bc8d7db 100644 --- a/sound/usb/midi.c +++ b/sound/usb/midi.c @@ -1234,14 +1234,14 @@ static void snd_usbmidi_input_trigger(struct snd_rawmidi_substream *substream, clear_bit(substream->number, &umidi->input_triggered); }
-static struct snd_rawmidi_ops snd_usbmidi_output_ops = { +static const struct snd_rawmidi_ops snd_usbmidi_output_ops = { .open = snd_usbmidi_output_open, .close = snd_usbmidi_output_close, .trigger = snd_usbmidi_output_trigger, .drain = snd_usbmidi_output_drain, };
-static struct snd_rawmidi_ops snd_usbmidi_input_ops = { +static const struct snd_rawmidi_ops snd_usbmidi_input_ops = { .open = snd_usbmidi_input_open, .close = snd_usbmidi_input_close, .trigger = snd_usbmidi_input_trigger
Hi,
On Jan 12 2017 04:02, Takashi Iwai wrote:
this is a small patchset to constify snd_rawmidi_ops references, as already done for many other ops.
Takashi
==
Takashi Iwai (7): ALSA: rawmidi: Add const to snd_rawmidi_ops ALSA: seq: Constify snd_rawmidi_ops ALSA: drivers: Constify snd_rawmidi_ops ALSA: isa: Constify snd_rawmidi_ops ALSA: pci: Constify snd_rawmidi_ops ALSA: firewire: Constify snd_rawmidi_ops ALSA: usb: Constify snd_rawmidi_ops
I prefer this patchset. I reviewed all of them and did build check.
Reviewed-by: Takashi Sakamoto o-takashi@sakamocchi.jp
include/sound/rawmidi.h | 4 ++-- include/sound/snd_wavefront.h | 4 ++-- sound/core/rawmidi.c | 2 +- sound/core/seq/seq_virmidi.c | 4 ++-- sound/drivers/mpu401/mpu401_uart.c | 4 ++-- sound/drivers/mtpav.c | 4 ++-- sound/drivers/mts64.c | 4 ++-- sound/drivers/portman2x4.c | 4 ++-- sound/drivers/serial-u16550.c | 4 ++-- sound/firewire/bebob/bebob_midi.c | 4 ++-- sound/firewire/dice/dice-midi.c | 4 ++-- sound/firewire/digi00x/digi00x-midi.c | 8 ++++---- sound/firewire/fireworks/fireworks_midi.c | 4 ++-- sound/firewire/oxfw/oxfw-midi.c | 4 ++-- sound/firewire/oxfw/oxfw-scs1x.c | 4 ++-- sound/firewire/tascam/tascam-midi.c | 4 ++-- sound/isa/gus/gus_uart.c | 4 ++-- sound/isa/msnd/msnd_midi.c | 2 +- sound/isa/sb/sb8_midi.c | 4 ++-- sound/isa/wavefront/wavefront_midi.c | 4 ++-- sound/pci/ca0106/ca_midi.c | 4 ++-- sound/pci/cs4281.c | 4 ++-- sound/pci/cs46xx/cs46xx_lib.c | 4 ++-- sound/pci/echoaudio/midi.c | 4 ++-- sound/pci/emu10k1/emu10k1x.c | 4 ++-- sound/pci/emu10k1/emumpu401.c | 4 ++-- sound/pci/ens1370.c | 4 ++-- sound/pci/ice1712/ice1724.c | 4 ++-- sound/pci/rme9652/hdsp.c | 4 ++-- sound/pci/rme9652/hdspm.c | 4 ++-- sound/usb/6fire/midi.c | 4 ++-- sound/usb/bcd2000/bcd2000.c | 4 ++-- sound/usb/caiaq/midi.c | 4 ++-- sound/usb/line6/midi.c | 4 ++-- sound/usb/midi.c | 4 ++-- 35 files changed, 70 insertions(+), 70 deletions(-)
Thanks
Takashi Sakamoto
participants (2)
-
Takashi Iwai
-
Takashi Sakamoto