[ALSA] remove dead code

YMFPCI driver
This patch removes some dead code found by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Adrian Bunk 2005-04-11 14:11:00 +02:00 committed by Jaroslav Kysela
parent aed058e871
commit 467a8c2f41
1 changed files with 8 additions and 23 deletions

View File

@ -1421,17 +1421,15 @@ static snd_kcontrol_new_t snd_ymfpci_drec_source __devinitdata = {
static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
{ {
unsigned int mask = 1;
switch (kcontrol->private_value) { switch (kcontrol->private_value) {
case YDSXGR_SPDIFOUTCTRL: break; case YDSXGR_SPDIFOUTCTRL: break;
case YDSXGR_SPDIFINCTRL: break; case YDSXGR_SPDIFINCTRL: break;
default: return -EINVAL; default: return -EINVAL;
} }
uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 1; uinfo->count = 1;
uinfo->value.integer.min = 0; uinfo->value.integer.min = 0;
uinfo->value.integer.max = mask; uinfo->value.integer.max = 1;
return 0; return 0;
} }
@ -1439,7 +1437,7 @@ static int snd_ymfpci_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
{ {
ymfpci_t *chip = snd_kcontrol_chip(kcontrol); ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
int reg = kcontrol->private_value; int reg = kcontrol->private_value;
unsigned int shift = 0, mask = 1, invert = 0; unsigned int shift = 0, mask = 1;
switch (kcontrol->private_value) { switch (kcontrol->private_value) {
case YDSXGR_SPDIFOUTCTRL: break; case YDSXGR_SPDIFOUTCTRL: break;
@ -1447,8 +1445,6 @@ static int snd_ymfpci_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
default: return -EINVAL; default: return -EINVAL;
} }
ucontrol->value.integer.value[0] = (snd_ymfpci_readl(chip, reg) >> shift) & mask; ucontrol->value.integer.value[0] = (snd_ymfpci_readl(chip, reg) >> shift) & mask;
if (invert)
ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0];
return 0; return 0;
} }
@ -1456,7 +1452,7 @@ static int snd_ymfpci_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
{ {
ymfpci_t *chip = snd_kcontrol_chip(kcontrol); ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
int reg = kcontrol->private_value; int reg = kcontrol->private_value;
unsigned int shift = 0, mask = 1, invert = 0; unsigned int shift = 0, mask = 1;
int change; int change;
unsigned int val, oval; unsigned int val, oval;
@ -1466,8 +1462,6 @@ static int snd_ymfpci_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
default: return -EINVAL; default: return -EINVAL;
} }
val = (ucontrol->value.integer.value[0] & mask); val = (ucontrol->value.integer.value[0] & mask);
if (invert)
val = mask - val;
val <<= shift; val <<= shift;
spin_lock_irq(&chip->reg_lock); spin_lock_irq(&chip->reg_lock);
oval = snd_ymfpci_readl(chip, reg); oval = snd_ymfpci_readl(chip, reg);
@ -1487,14 +1481,13 @@ static int snd_ymfpci_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
static int snd_ymfpci_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_ymfpci_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
{ {
unsigned int reg = kcontrol->private_value; unsigned int reg = kcontrol->private_value;
unsigned int mask = 16383;
if (reg < 0x80 || reg >= 0xc0) if (reg < 0x80 || reg >= 0xc0)
return -EINVAL; return -EINVAL;
uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 2; uinfo->count = 2;
uinfo->value.integer.min = 0; uinfo->value.integer.min = 0;
uinfo->value.integer.max = mask; uinfo->value.integer.max = 16383;
return 0; return 0;
} }
@ -1502,7 +1495,7 @@ static int snd_ymfpci_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
{ {
ymfpci_t *chip = snd_kcontrol_chip(kcontrol); ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
unsigned int reg = kcontrol->private_value; unsigned int reg = kcontrol->private_value;
unsigned int shift_left = 0, shift_right = 16, mask = 16383, invert = 0; unsigned int shift_left = 0, shift_right = 16, mask = 16383;
unsigned int val; unsigned int val;
if (reg < 0x80 || reg >= 0xc0) if (reg < 0x80 || reg >= 0xc0)
@ -1512,10 +1505,6 @@ static int snd_ymfpci_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
spin_unlock_irq(&chip->reg_lock); spin_unlock_irq(&chip->reg_lock);
ucontrol->value.integer.value[0] = (val >> shift_left) & mask; ucontrol->value.integer.value[0] = (val >> shift_left) & mask;
ucontrol->value.integer.value[1] = (val >> shift_right) & mask; ucontrol->value.integer.value[1] = (val >> shift_right) & mask;
if (invert) {
ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0];
ucontrol->value.integer.value[1] = mask - ucontrol->value.integer.value[1];
}
return 0; return 0;
} }
@ -1523,7 +1512,7 @@ static int snd_ymfpci_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
{ {
ymfpci_t *chip = snd_kcontrol_chip(kcontrol); ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
unsigned int reg = kcontrol->private_value; unsigned int reg = kcontrol->private_value;
unsigned int shift_left = 0, shift_right = 16, mask = 16383, invert = 0; unsigned int shift_left = 0, shift_right = 16, mask = 16383;
int change; int change;
unsigned int val1, val2, oval; unsigned int val1, val2, oval;
@ -1531,10 +1520,6 @@ static int snd_ymfpci_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
return -EINVAL; return -EINVAL;
val1 = ucontrol->value.integer.value[0] & mask; val1 = ucontrol->value.integer.value[0] & mask;
val2 = ucontrol->value.integer.value[1] & mask; val2 = ucontrol->value.integer.value[1] & mask;
if (invert) {
val1 = mask - val1;
val2 = mask - val2;
}
val1 <<= shift_left; val1 <<= shift_left;
val2 <<= shift_right; val2 <<= shift_right;
spin_lock_irq(&chip->reg_lock); spin_lock_irq(&chip->reg_lock);