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: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Sakamoto 2017-05-23 22:40:20 +09:00 committed by Takashi Iwai
parent 4e361d3c96
commit 097a7fe369
1 changed files with 20 additions and 25 deletions

View File

@ -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;
w16 = (snd_pcm_format_width(runtime->format) == 16);
invert = snd_pcm_format_unsigned(runtime->format);
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;
w16 = (snd_pcm_format_width(runtime->format) == 16);
invert = snd_pcm_format_unsigned(runtime->format);
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,