summaryrefslogtreecommitdiffstats
path: root/sound/firewire
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2017-01-05 07:48:09 -0500
committerTakashi Iwai <tiwai@suse.de>2017-01-05 10:58:05 -0500
commit39feaf2d0a2e1844a7d4c26ac1fac66176a15515 (patch)
tree38f2f5fee933156800f9de5f9c65863948a62073 /sound/firewire
parent7cdc887a00d79a1553009eb7afd308882e4b74d5 (diff)
ALSA: oxfw: enclose identifiers referred by single function
Some identifiers are referred just by one functions. In this case, they can be put into the function definition. This brings two merits; readers can easily follow codes related to the identifiers, developers are free from name conflict. This commit moves such identifiers to each function definition. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire')
-rw-r--r--sound/firewire/oxfw/oxfw-midi.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/sound/firewire/oxfw/oxfw-midi.c b/sound/firewire/oxfw/oxfw-midi.c
index 8665e1043d41..076a1a977275 100644
--- a/sound/firewire/oxfw/oxfw-midi.c
+++ b/sound/firewire/oxfw/oxfw-midi.c
@@ -116,18 +116,6 @@ static void midi_playback_trigger(struct snd_rawmidi_substream *substrm, int up)
116 spin_unlock_irqrestore(&oxfw->lock, flags); 116 spin_unlock_irqrestore(&oxfw->lock, flags);
117} 117}
118 118
119static struct snd_rawmidi_ops midi_capture_ops = {
120 .open = midi_capture_open,
121 .close = midi_capture_close,
122 .trigger = midi_capture_trigger,
123};
124
125static struct snd_rawmidi_ops midi_playback_ops = {
126 .open = midi_playback_open,
127 .close = midi_playback_close,
128 .trigger = midi_playback_trigger,
129};
130
131static void set_midi_substream_names(struct snd_oxfw *oxfw, 119static void set_midi_substream_names(struct snd_oxfw *oxfw,
132 struct snd_rawmidi_str *str) 120 struct snd_rawmidi_str *str)
133{ 121{
@@ -142,6 +130,16 @@ static void set_midi_substream_names(struct snd_oxfw *oxfw,
142 130
143int snd_oxfw_create_midi(struct snd_oxfw *oxfw) 131int snd_oxfw_create_midi(struct snd_oxfw *oxfw)
144{ 132{
133 static struct snd_rawmidi_ops capture_ops = {
134 .open = midi_capture_open,
135 .close = midi_capture_close,
136 .trigger = midi_capture_trigger,
137 };
138 static struct snd_rawmidi_ops playback_ops = {
139 .open = midi_playback_open,
140 .close = midi_playback_close,
141 .trigger = midi_playback_trigger,
142 };
145 struct snd_rawmidi *rmidi; 143 struct snd_rawmidi *rmidi;
146 struct snd_rawmidi_str *str; 144 struct snd_rawmidi_str *str;
147 int err; 145 int err;
@@ -164,7 +162,7 @@ int snd_oxfw_create_midi(struct snd_oxfw *oxfw)
164 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_INPUT; 162 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_INPUT;
165 163
166 snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, 164 snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT,
167 &midi_capture_ops); 165 &capture_ops);
168 166
169 str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]; 167 str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT];
170 168
@@ -175,7 +173,7 @@ int snd_oxfw_create_midi(struct snd_oxfw *oxfw)
175 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT; 173 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT;
176 174
177 snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, 175 snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT,
178 &midi_playback_ops); 176 &playback_ops);
179 177
180 str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT]; 178 str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT];
181 179