X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Fusb%2Fusbmixer.c;h=0bfea72373957e2d49982b61455aa694c76143b7;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=ce86283ee0fa6ded6c992aa24af05980e8a3f627;hpb=f7ed79d23a47594e7834d66a8f14449796d4f3e6;p=linux-2.6.git diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index ce86283ee..0bfea7237 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c @@ -306,8 +306,8 @@ static int get_relative_value(struct usb_mixer_elem_info *cval, int val) cval->res = 1; if (val < cval->min) return 0; - else if (val >= cval->max) - return (cval->max - cval->min + cval->res - 1) / cval->res; + else if (val > cval->max) + return (cval->max - cval->min) / cval->res; else return (val - cval->min) / cval->res; } @@ -670,36 +670,6 @@ static int get_min_max(struct usb_mixer_elem_info *cval, int default_min) } if (cval->res == 0) cval->res = 1; - - /* Additional checks for the proper resolution - * - * Some devices report smaller resolutions than actually - * reacting. They don't return errors but simply clip - * to the lower aligned value. - */ - if (cval->min + cval->res < cval->max) { - int last_valid_res = cval->res; - int saved, test, check; - get_cur_mix_value(cval, minchn, &saved); - for (;;) { - test = saved; - if (test < cval->max) - test += cval->res; - else - test -= cval->res; - if (test < cval->min || test > cval->max || - set_cur_mix_value(cval, minchn, test) || - get_cur_mix_value(cval, minchn, &check)) { - cval->res = last_valid_res; - break; - } - if (test == check) - break; - cval->res *= 2; - } - set_cur_mix_value(cval, minchn, saved); - } - cval->initialized = 1; } return 0; @@ -725,8 +695,7 @@ static int mixer_ctl_feature_info(struct snd_kcontrol *kcontrol, struct snd_ctl_ if (! cval->initialized) get_min_max(cval, 0); uinfo->value.integer.min = 0; - uinfo->value.integer.max = - (cval->max - cval->min + cval->res - 1) / cval->res; + uinfo->value.integer.max = (cval->max - cval->min) / cval->res; } return 0; } @@ -1499,7 +1468,6 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, unsi kctl = snd_ctl_new1(&mixer_selectunit_ctl, cval); if (! kctl) { snd_printk(KERN_ERR "cannot malloc kcontrol\n"); - kfree(namelist); kfree(cval); return -ENOMEM; }