Skip to content

Commit a683030

Browse files
committed
ALSA: seq: ump: Use the common RPN/bank conversion context
The UMP core conversion helper API already defines the context needed to record the bank and RPN/NRPN values, and we can simply re-use the same struct instead of re-defining the same content as a different name. Link: https://patch.msgid.link/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 50a6dd1 commit a683030

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

sound/core/seq/seq_ports.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#define __SND_SEQ_PORTS_H
88

99
#include <sound/seq_kernel.h>
10+
#include <sound/ump_convert.h>
1011
#include "seq_lock.h"
1112

1213
/* list of 'exported' ports */
@@ -42,17 +43,6 @@ struct snd_seq_port_subs_info {
4243
int (*close)(void *private_data, struct snd_seq_port_subscribe *info);
4344
};
4445

45-
/* context for converting from legacy control event to UMP packet */
46-
struct snd_seq_ump_midi2_bank {
47-
bool rpn_set;
48-
bool nrpn_set;
49-
bool bank_set;
50-
unsigned char cc_rpn_msb, cc_rpn_lsb;
51-
unsigned char cc_nrpn_msb, cc_nrpn_lsb;
52-
unsigned char cc_data_msb, cc_data_lsb;
53-
unsigned char cc_bank_msb, cc_bank_lsb;
54-
};
55-
5646
struct snd_seq_client_port {
5747

5848
struct snd_seq_addr addr; /* client/port number */
@@ -88,7 +78,7 @@ struct snd_seq_client_port {
8878
unsigned char ump_group;
8979

9080
#if IS_ENABLED(CONFIG_SND_SEQ_UMP)
91-
struct snd_seq_ump_midi2_bank midi2_bank[16]; /* per channel */
81+
struct ump_cvt_to_ump_bank midi2_bank[16]; /* per channel */
9282
#endif
9383
};
9484

sound/core/seq/seq_ump_convert.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ static int cvt_ump_midi1_to_midi2(struct snd_seq_client *dest,
368368
struct snd_seq_ump_event ev_cvt;
369369
const union snd_ump_midi1_msg *midi1 = (const union snd_ump_midi1_msg *)event->ump;
370370
union snd_ump_midi2_msg *midi2 = (union snd_ump_midi2_msg *)ev_cvt.ump;
371-
struct snd_seq_ump_midi2_bank *cc;
371+
struct ump_cvt_to_ump_bank *cc;
372372

373373
ev_cvt = *event;
374374
memset(&ev_cvt.ump, 0, sizeof(ev_cvt.ump));
@@ -790,7 +790,7 @@ static int paf_ev_to_ump_midi2(const struct snd_seq_event *event,
790790
}
791791

792792
/* set up the MIDI2 RPN/NRPN packet data from the parsed info */
793-
static void fill_rpn(struct snd_seq_ump_midi2_bank *cc,
793+
static void fill_rpn(struct ump_cvt_to_ump_bank *cc,
794794
union snd_ump_midi2_msg *data,
795795
unsigned char channel)
796796
{
@@ -822,7 +822,7 @@ static int cc_ev_to_ump_midi2(const struct snd_seq_event *event,
822822
unsigned char channel = event->data.control.channel & 0x0f;
823823
unsigned char index = event->data.control.param & 0x7f;
824824
unsigned char val = event->data.control.value & 0x7f;
825-
struct snd_seq_ump_midi2_bank *cc = &dest_port->midi2_bank[channel];
825+
struct ump_cvt_to_ump_bank *cc = &dest_port->midi2_bank[channel];
826826

827827
/* process special CC's (bank/rpn/nrpn) */
828828
switch (index) {
@@ -887,7 +887,7 @@ static int pgm_ev_to_ump_midi2(const struct snd_seq_event *event,
887887
unsigned char status)
888888
{
889889
unsigned char channel = event->data.control.channel & 0x0f;
890-
struct snd_seq_ump_midi2_bank *cc = &dest_port->midi2_bank[channel];
890+
struct ump_cvt_to_ump_bank *cc = &dest_port->midi2_bank[channel];
891891

892892
data->pg.status = status;
893893
data->pg.channel = channel;
@@ -924,7 +924,7 @@ static int ctrl14_ev_to_ump_midi2(const struct snd_seq_event *event,
924924
{
925925
unsigned char channel = event->data.control.channel & 0x0f;
926926
unsigned char index = event->data.control.param & 0x7f;
927-
struct snd_seq_ump_midi2_bank *cc = &dest_port->midi2_bank[channel];
927+
struct ump_cvt_to_ump_bank *cc = &dest_port->midi2_bank[channel];
928928
unsigned char msb, lsb;
929929

930930
msb = (event->data.control.value >> 7) & 0x7f;

0 commit comments

Comments
 (0)