projects
/
linux-2.6-microblaze.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
[linux-2.6-microblaze.git]
/
sound
/
usb
/
mixer.c
diff --git
a/sound/usb/mixer.c
b/sound/usb/mixer.c
index
12b15ed
..
b1c78db
100644
(file)
--- a/
sound/usb/mixer.c
+++ b/
sound/usb/mixer.c
@@
-115,11
+115,14
@@
find_map(const struct usbmix_name_map *p, int unitid, int control)
static int
check_mapped_name(const struct usbmix_name_map *p, char *buf, int buflen)
{
static int
check_mapped_name(const struct usbmix_name_map *p, char *buf, int buflen)
{
+ int len;
+
if (!p || !p->name)
return 0;
buflen--;
if (!p || !p->name)
return 0;
buflen--;
- return strlcpy(buf, p->name, buflen);
+ len = strscpy(buf, p->name, buflen);
+ return len < 0 ? buflen : len;
}
/* ignore the error value if ignore_ctl_error flag is set */
}
/* ignore the error value if ignore_ctl_error flag is set */
@@
-151,12
+154,15
@@
static int check_mapped_selector_name(struct mixer_build *state, int unitid,
int index, char *buf, int buflen)
{
const struct usbmix_selector_map *p;
int index, char *buf, int buflen)
{
const struct usbmix_selector_map *p;
+ int len;
if (!state->selector_map)
return 0;
for (p = state->selector_map; p->id; p++) {
if (!state->selector_map)
return 0;
for (p = state->selector_map; p->id; p++) {
- if (p->id == unitid && index < p->count)
- return strlcpy(buf, p->names[index], buflen);
+ if (p->id == unitid && index < p->count) {
+ len = strscpy(buf, p->names[index], buflen);
+ return len < 0 ? buflen : len;
+ }
}
return 0;
}
}
return 0;
}
@@
-254,7
+260,7
@@
static int get_relative_value(struct usb_mixer_elem_info *cval, int val)
if (val < cval->min)
return 0;
else if (val >= cval->max)
if (val < cval->min)
return 0;
else if (val >= cval->max)
- return
(cval->max - cval->min + cval->res - 1) / cval->res
;
+ return
DIV_ROUND_UP(cval->max - cval->min, cval->res)
;
else
return (val - cval->min) / cval->res;
}
else
return (val - cval->min) / cval->res;
}
@@
-1232,7
+1238,7
@@
static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
(cval->control << 8) | minchn,
&cval->res) < 0) {
cval->res = 1;
(cval->control << 8) | minchn,
&cval->res) < 0) {
cval->res = 1;
- } else {
+ } else
if (cval->head.mixer->protocol == UAC_VERSION_1)
{
int last_valid_res = cval->res;
while (cval->res > 1) {
int last_valid_res = cval->res;
while (cval->res > 1) {
@@
-1338,7
+1344,7
@@
static int mixer_ctl_feature_info(struct snd_kcontrol *kcontrol,
}
uinfo->value.integer.min = 0;
uinfo->value.integer.max =
}
uinfo->value.integer.min = 0;
uinfo->value.integer.max =
-
(cval->max - cval->min + cval->res - 1) / cval->res
;
+
DIV_ROUND_UP(cval->max - cval->min, cval->res)
;
}
return 0;
}
}
return 0;
}
@@
-1556,7
+1562,7
@@
static void check_no_speaker_on_headset(struct snd_kcontrol *kctl,
if (!found)
return;
if (!found)
return;
- str
l
cpy(kctl->id.name, "Headphone", sizeof(kctl->id.name));
+ str
s
cpy(kctl->id.name, "Headphone", sizeof(kctl->id.name));
}
static const struct usb_feature_control_info *get_feature_control_info(int control)
}
static const struct usb_feature_control_info *get_feature_control_info(int control)
@@
-1691,7
+1697,7
@@
static void __build_feature_ctl(struct usb_mixer_interface *mixer,
break;
default:
if (!len)
break;
default:
if (!len)
- str
l
cpy(kctl->id.name, audio_feature_info[control-1].name,
+ str
s
cpy(kctl->id.name, audio_feature_info[control-1].name,
sizeof(kctl->id.name));
break;
}
sizeof(kctl->id.name));
break;
}
@@
-1770,7
+1776,7
@@
static void get_connector_control_name(struct usb_mixer_interface *mixer,
int name_len = get_term_name(mixer->chip, term, name, name_size, 0);
if (name_len == 0)
int name_len = get_term_name(mixer->chip, term, name, name_size, 0);
if (name_len == 0)
- str
l
cpy(name, "Unknown", name_size);
+ str
s
cpy(name, "Unknown", name_size);
/*
* sound/core/ctljack.c has a convention of naming jack controls
/*
* sound/core/ctljack.c has a convention of naming jack controls
@@
-2490,7
+2496,7
@@
static int build_audio_procunit(struct mixer_build *state, int unitid,
if (check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name))) {
/* nothing */ ;
} else if (info->name) {
if (check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name))) {
/* nothing */ ;
} else if (info->name) {
- str
l
cpy(kctl->id.name, info->name, sizeof(kctl->id.name));
+ str
s
cpy(kctl->id.name, info->name, sizeof(kctl->id.name));
} else {
if (extension_unit)
nameid = uac_extension_unit_iExtension(desc, state->mixer->protocol);
} else {
if (extension_unit)
nameid = uac_extension_unit_iExtension(desc, state->mixer->protocol);
@@
-2503,7
+2509,7
@@
static int build_audio_procunit(struct mixer_build *state, int unitid,
kctl->id.name,
sizeof(kctl->id.name));
if (!len)
kctl->id.name,
sizeof(kctl->id.name));
if (!len)
- str
l
cpy(kctl->id.name, name, sizeof(kctl->id.name));
+ str
s
cpy(kctl->id.name, name, sizeof(kctl->id.name));
}
append_ctl_name(kctl, " ");
append_ctl_name(kctl, valinfo->suffix);
}
append_ctl_name(kctl, " ");
append_ctl_name(kctl, valinfo->suffix);
@@
-2743,7
+2749,7
@@
static int parse_audio_selector_unit(struct mixer_build *state, int unitid,
kctl->id.name, sizeof(kctl->id.name), 0);
/* ... or use the fixed string "USB" as the last resort */
if (!len)
kctl->id.name, sizeof(kctl->id.name), 0);
/* ... or use the fixed string "USB" as the last resort */
if (!len)
- str
l
cpy(kctl->id.name, "USB", sizeof(kctl->id.name));
+ str
s
cpy(kctl->id.name, "USB", sizeof(kctl->id.name));
/* and add the proper suffix */
if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR ||
/* and add the proper suffix */
if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR ||