Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

ALSA: gus: remove unused local flag



ALSA driver series for devices of Gravis Ultra Sound includes local
variable 'snd_gf1_pcm_use_dma'. Although this is a flag to change
behaviours of local implementations for 'struct snd_pcm_ops.copy' and
'struct snd_pcm_ops.silence', it's invariable during module lifetime.

This commit removes this local variable and the relevant operations.

Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 4e361d3c
Loading
Loading
Loading
Loading
+22 −27
Original line number Diff line number Diff line
@@ -61,8 +61,6 @@ struct gus_pcm_private {
	int final_volume;
};

static int snd_gf1_pcm_use_dma = 1;

static void snd_gf1_pcm_block_change_ack(struct snd_gus_card * gus, void *private_data)
{
	struct gus_pcm_private *pcmp = private_data;
@@ -363,7 +361,9 @@ static int snd_gf1_pcm_playback_copy(struct snd_pcm_substream *substream,
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct gus_pcm_private *pcmp = runtime->private_data;
	struct snd_gus_card *gus = pcmp->gus;
	unsigned int bpos, len;
	int w16, invert;
	
	bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2));
	len = samples_to_bytes(runtime, count);
@@ -373,18 +373,14 @@ static int snd_gf1_pcm_playback_copy(struct snd_pcm_substream *substream,
		return -EIO;
	if (copy_from_user(runtime->dma_area + bpos, src, len))
		return -EFAULT;
	if (snd_gf1_pcm_use_dma && len > 32) {
		return snd_gf1_pcm_block_change(substream, bpos, pcmp->memory + bpos, len);
	} else {
		struct snd_gus_card *gus = pcmp->gus;
		int err, w16, invert;
	if (len > 32)
		return snd_gf1_pcm_block_change(substream, bpos,
						pcmp->memory + bpos, len);

	w16 = (snd_pcm_format_width(runtime->format) == 16);
	invert = snd_pcm_format_unsigned(runtime->format);
		if ((err = snd_gf1_pcm_poke_block(gus, runtime->dma_area + bpos, pcmp->memory + bpos, len, w16, invert)) < 0)
			return err;
	}
	return 0;
	return snd_gf1_pcm_poke_block(gus, runtime->dma_area + bpos,
				      pcmp->memory + bpos, len, w16, invert);
}

static int snd_gf1_pcm_playback_silence(struct snd_pcm_substream *substream,
@@ -394,7 +390,9 @@ static int snd_gf1_pcm_playback_silence(struct snd_pcm_substream *substream,
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct gus_pcm_private *pcmp = runtime->private_data;
	struct snd_gus_card *gus = pcmp->gus;
	unsigned int bpos, len;
	int w16, invert;
	
	bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2));
	len = samples_to_bytes(runtime, count);
@@ -402,19 +400,16 @@ static int snd_gf1_pcm_playback_silence(struct snd_pcm_substream *substream,
		return -EIO;
	if (snd_BUG_ON(bpos + len > pcmp->dma_size))
		return -EIO;
	snd_pcm_format_set_silence(runtime->format, runtime->dma_area + bpos, count);
	if (snd_gf1_pcm_use_dma && len > 32) {
		return snd_gf1_pcm_block_change(substream, bpos, pcmp->memory + bpos, len);
	} else {
		struct snd_gus_card *gus = pcmp->gus;
		int err, w16, invert;
	snd_pcm_format_set_silence(runtime->format, runtime->dma_area + bpos,
				   count);
	if (len > 32)
		return snd_gf1_pcm_block_change(substream, bpos,
						pcmp->memory + bpos, len);

	w16 = (snd_pcm_format_width(runtime->format) == 16);
	invert = snd_pcm_format_unsigned(runtime->format);
		if ((err = snd_gf1_pcm_poke_block(gus, runtime->dma_area + bpos, pcmp->memory + bpos, len, w16, invert)) < 0)
			return err;
	}
	return 0;
	return snd_gf1_pcm_poke_block(gus, runtime->dma_area + bpos,
				      pcmp->memory + bpos, len, w16, invert);
}

static int snd_gf1_pcm_playback_hw_params(struct snd_pcm_substream *substream,