Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: seq: Constify struct snd_midi_op

Change the argument of snd_midi_process_event() to receive a const
snd_midi_op pointer and its callers respectively. This allows further
optimizations.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-30-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+28 -20
+2 -1
include/sound/seq_midi_emul.h
··· 174 174 }; 175 175 176 176 /* Prototypes for midi_process.c */ 177 - void snd_midi_process_event(struct snd_midi_op *ops, struct snd_seq_event *ev, 177 + void snd_midi_process_event(const struct snd_midi_op *ops, 178 + struct snd_seq_event *ev, 178 179 struct snd_midi_channel_set *chanset); 179 180 void snd_midi_channel_set_clear(struct snd_midi_channel_set *chset); 180 181 struct snd_midi_channel_set *snd_midi_channel_alloc_set(int n);
+22 -15
sound/core/seq/seq_midi_emul.c
··· 30 30 MODULE_LICENSE("GPL"); 31 31 32 32 /* Prototypes for static functions */ 33 - static void note_off(struct snd_midi_op *ops, void *drv, 33 + static void note_off(const struct snd_midi_op *ops, void *drv, 34 34 struct snd_midi_channel *chan, 35 35 int note, int vel); 36 - static void do_control(struct snd_midi_op *ops, void *private, 36 + static void do_control(const struct snd_midi_op *ops, void *private, 37 37 struct snd_midi_channel_set *chset, 38 38 struct snd_midi_channel *chan, 39 39 int control, int value); 40 - static void rpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan, 40 + static void rpn(const struct snd_midi_op *ops, void *drv, 41 + struct snd_midi_channel *chan, 41 42 struct snd_midi_channel_set *chset); 42 - static void nrpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan, 43 + static void nrpn(const struct snd_midi_op *ops, void *drv, 44 + struct snd_midi_channel *chan, 43 45 struct snd_midi_channel_set *chset); 44 - static void sysex(struct snd_midi_op *ops, void *private, unsigned char *sysex, 46 + static void sysex(const struct snd_midi_op *ops, void *private, 47 + unsigned char *sysex, 45 48 int len, struct snd_midi_channel_set *chset); 46 - static void all_sounds_off(struct snd_midi_op *ops, void *private, 49 + static void all_sounds_off(const struct snd_midi_op *ops, void *private, 47 50 struct snd_midi_channel *chan); 48 - static void all_notes_off(struct snd_midi_op *ops, void *private, 51 + static void all_notes_off(const struct snd_midi_op *ops, void *private, 49 52 struct snd_midi_channel *chan); 50 53 static void snd_midi_reset_controllers(struct snd_midi_channel *chan); 51 54 static void reset_all_channels(struct snd_midi_channel_set *chset); ··· 69 66 * be interpreted. 70 67 */ 71 68 void 72 - snd_midi_process_event(struct snd_midi_op *ops, 69 + snd_midi_process_event(const struct snd_midi_op *ops, 73 70 struct snd_seq_event *ev, 74 71 struct snd_midi_channel_set *chanset) 75 72 { ··· 232 229 * release note 233 230 */ 234 231 static void 235 - note_off(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan, 232 + note_off(const struct snd_midi_op *ops, void *drv, 233 + struct snd_midi_channel *chan, 236 234 int note, int vel) 237 235 { 238 236 if (chan->gm_hold) { ··· 255 251 * events that need to take place immediately to the driver. 256 252 */ 257 253 static void 258 - do_control(struct snd_midi_op *ops, void *drv, struct snd_midi_channel_set *chset, 254 + do_control(const struct snd_midi_op *ops, void *drv, 255 + struct snd_midi_channel_set *chset, 259 256 struct snd_midi_channel *chan, int control, int value) 260 257 { 261 258 int i; ··· 407 402 * Process a rpn message. 408 403 */ 409 404 static void 410 - rpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan, 405 + rpn(const struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan, 411 406 struct snd_midi_channel_set *chset) 412 407 { 413 408 int type; ··· 447 442 * Process an nrpn message. 448 443 */ 449 444 static void 450 - nrpn(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan, 445 + nrpn(const struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan, 451 446 struct snd_midi_channel_set *chset) 452 447 { 453 448 /* parse XG NRPNs here if possible */ ··· 475 470 * Process a sysex message. 476 471 */ 477 472 static void 478 - sysex(struct snd_midi_op *ops, void *private, unsigned char *buf, int len, 473 + sysex(const struct snd_midi_op *ops, void *private, unsigned char *buf, int len, 479 474 struct snd_midi_channel_set *chset) 480 475 { 481 476 /* GM on */ ··· 589 584 * all sound off 590 585 */ 591 586 static void 592 - all_sounds_off(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan) 587 + all_sounds_off(const struct snd_midi_op *ops, void *drv, 588 + struct snd_midi_channel *chan) 593 589 { 594 590 int n; 595 591 ··· 608 602 * all notes off 609 603 */ 610 604 static void 611 - all_notes_off(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan) 605 + all_notes_off(const struct snd_midi_op *ops, void *drv, 606 + struct snd_midi_channel *chan) 612 607 { 613 608 int n; 614 609
+1 -1
sound/drivers/opl3/opl3_seq.c
··· 128 128 /* 129 129 * MIDI emulation operators 130 130 */ 131 - struct snd_midi_op opl3_ops = { 131 + const struct snd_midi_op opl3_ops = { 132 132 .note_on = snd_opl3_note_on, 133 133 .note_off = snd_opl3_note_off, 134 134 .key_press = snd_opl3_key_press,
+1 -1
sound/drivers/opl3/opl3_voice.h
··· 41 41 42 42 extern char snd_opl3_regmap[MAX_OPL2_VOICES][4]; 43 43 extern bool use_internal_drums; 44 - extern struct snd_midi_op opl3_ops; 44 + extern const struct snd_midi_op opl3_ops; 45 45 46 46 #endif
+1 -1
sound/drivers/opl4/opl4_seq.c
··· 100 100 return 0; 101 101 } 102 102 103 - static struct snd_midi_op opl4_ops = { 103 + static const struct snd_midi_op opl4_ops = { 104 104 .note_on = snd_opl4_note_on, 105 105 .note_off = snd_opl4_note_off, 106 106 .note_terminate = snd_opl4_terminate_note,
+1 -1
sound/synth/emux/emux_seq.c
··· 19 19 /* 20 20 * MIDI emulation operators 21 21 */ 22 - static struct snd_midi_op emux_ops = { 22 + static const struct snd_midi_op emux_ops = { 23 23 .note_on = snd_emux_note_on, 24 24 .note_off = snd_emux_note_off, 25 25 .key_press = snd_emux_key_press,