X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=sound%2Fpci%2Frme96.c;h=3fdd488d09759afca5389383c76590e57bb4dc63;hb=refs%2Ftags%2Fv2.6.28-rc4;hp=0b3c532c4014270e69abe05482e79256777b5af2;hpb=347c53dca73fca317d57781f510f5ff4f6c0d0d7;p=linux-2.6-omap-h63xx.git diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index 0b3c532c401..3fdd488d097 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c @@ -23,7 +23,6 @@ * */ -#include #include #include #include @@ -1560,7 +1559,8 @@ snd_rme96_create(struct rme96 *rme96) return err; rme96->port = pci_resource_start(rme96->pci, 0); - if ((rme96->iobase = ioremap_nocache(rme96->port, RME96_IO_SIZE)) == 0) { + rme96->iobase = ioremap_nocache(rme96->port, RME96_IO_SIZE); + if (!rme96->iobase) { snd_printk(KERN_ERR "unable to remap memory region 0x%lx-0x%lx\n", rme96->port, rme96->port + RME96_IO_SIZE - 1); return -ENOMEM; } @@ -2195,22 +2195,25 @@ snd_rme96_dac_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu { struct rme96 *rme96 = snd_kcontrol_chip(kcontrol); int change = 0; + unsigned int vol, maxvol; - if (!RME96_HAS_ANALOG_OUT(rme96)) { + + if (!RME96_HAS_ANALOG_OUT(rme96)) return -EINVAL; - } + maxvol = RME96_185X_MAX_OUT(rme96); spin_lock_irq(&rme96->lock); - if (u->value.integer.value[0] != rme96->vol[0]) { - rme96->vol[0] = u->value.integer.value[0]; - change = 1; - } - if (u->value.integer.value[1] != rme96->vol[1]) { - rme96->vol[1] = u->value.integer.value[1]; - change = 1; - } - if (change) { - snd_rme96_apply_dac_volume(rme96); + vol = u->value.integer.value[0]; + if (vol != rme96->vol[0] && vol <= maxvol) { + rme96->vol[0] = vol; + change = 1; + } + vol = u->value.integer.value[1]; + if (vol != rme96->vol[1] && vol <= maxvol) { + rme96->vol[1] = vol; + change = 1; } + if (change) + snd_rme96_apply_dac_volume(rme96); spin_unlock_irq(&rme96->lock); return change;