Commit d2dc2a96 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai
Browse files

ALSA: fireface: constify ALSA specific operations



ALSA fireface driver has ALSA specific operations for MIDI/PCM data.
Structured data for the operations can be constified. Additionally,
The structured data can be function local.

Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 875becf8
Loading
Loading
Loading
Loading
+10 −12
Original line number Diff line number Diff line
@@ -74,18 +74,6 @@ static void midi_playback_trigger(struct snd_rawmidi_substream *substream,
	spin_unlock_irqrestore(&ff->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_rawmidi_str *stream,
				     const char *const name)
{
@@ -99,6 +87,16 @@ static void set_midi_substream_names(struct snd_rawmidi_str *stream,

int snd_ff_create_midi_devices(struct snd_ff *ff)
{
	static const struct snd_rawmidi_ops midi_capture_ops = {
		.open		= midi_capture_open,
		.close		= midi_capture_close,
		.trigger	= midi_capture_trigger,
	};
	static const struct snd_rawmidi_ops midi_playback_ops = {
		.open		= midi_playback_open,
		.close		= midi_playback_close,
		.trigger	= midi_playback_trigger,
	};
	struct snd_rawmidi *rmidi;
	struct snd_rawmidi_str *stream;
	int err;
+25 −27
Original line number Diff line number Diff line
@@ -379,7 +379,9 @@ static int pcm_playback_ack(struct snd_pcm_substream *substream)
	return amdtp_stream_pcm_ack(&ff->rx_stream);
}

static struct snd_pcm_ops pcm_capture_ops = {
int snd_ff_create_pcm_devices(struct snd_ff *ff)
{
	static const struct snd_pcm_ops pcm_capture_ops = {
		.open		= pcm_open,
		.close		= pcm_close,
		.ioctl		= snd_pcm_lib_ioctl,
@@ -391,8 +393,7 @@ static struct snd_pcm_ops pcm_capture_ops = {
		.ack		= pcm_capture_ack,
		.page		= snd_pcm_lib_get_vmalloc_page,
	};

static struct snd_pcm_ops pcm_playback_ops = {
	static const struct snd_pcm_ops pcm_playback_ops = {
		.open		= pcm_open,
		.close		= pcm_close,
		.ioctl		= snd_pcm_lib_ioctl,
@@ -405,9 +406,6 @@ static struct snd_pcm_ops pcm_playback_ops = {
		.page		= snd_pcm_lib_get_vmalloc_page,
		.mmap		= snd_pcm_lib_mmap_vmalloc,
	};

int snd_ff_create_pcm_devices(struct snd_ff *ff)
{
	struct snd_pcm *pcm;
	int err;