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>
This commit is contained in:
parent
7cdc887a00
commit
39feaf2d0a
|
@ -116,18 +116,6 @@ static void midi_playback_trigger(struct snd_rawmidi_substream *substrm, int up)
|
||||||
spin_unlock_irqrestore(&oxfw->lock, flags);
|
spin_unlock_irqrestore(&oxfw->lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct snd_rawmidi_ops midi_capture_ops = {
|
|
||||||
.open = midi_capture_open,
|
|
||||||
.close = midi_capture_close,
|
|
||||||
.trigger = midi_capture_trigger,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct snd_rawmidi_ops midi_playback_ops = {
|
|
||||||
.open = midi_playback_open,
|
|
||||||
.close = midi_playback_close,
|
|
||||||
.trigger = midi_playback_trigger,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void set_midi_substream_names(struct snd_oxfw *oxfw,
|
static void set_midi_substream_names(struct snd_oxfw *oxfw,
|
||||||
struct snd_rawmidi_str *str)
|
struct snd_rawmidi_str *str)
|
||||||
{
|
{
|
||||||
|
@ -142,6 +130,16 @@ static void set_midi_substream_names(struct snd_oxfw *oxfw,
|
||||||
|
|
||||||
int snd_oxfw_create_midi(struct snd_oxfw *oxfw)
|
int snd_oxfw_create_midi(struct snd_oxfw *oxfw)
|
||||||
{
|
{
|
||||||
|
static 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 = {
|
||||||
|
.open = midi_playback_open,
|
||||||
|
.close = midi_playback_close,
|
||||||
|
.trigger = midi_playback_trigger,
|
||||||
|
};
|
||||||
struct snd_rawmidi *rmidi;
|
struct snd_rawmidi *rmidi;
|
||||||
struct snd_rawmidi_str *str;
|
struct snd_rawmidi_str *str;
|
||||||
int err;
|
int err;
|
||||||
|
@ -164,7 +162,7 @@ int snd_oxfw_create_midi(struct snd_oxfw *oxfw)
|
||||||
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_INPUT;
|
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_INPUT;
|
||||||
|
|
||||||
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT,
|
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT,
|
||||||
&midi_capture_ops);
|
&capture_ops);
|
||||||
|
|
||||||
str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT];
|
str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT];
|
||||||
|
|
||||||
|
@ -175,7 +173,7 @@ int snd_oxfw_create_midi(struct snd_oxfw *oxfw)
|
||||||
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT;
|
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT;
|
||||||
|
|
||||||
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT,
|
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT,
|
||||||
&midi_playback_ops);
|
&playback_ops);
|
||||||
|
|
||||||
str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT];
|
str = &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue