24 #include <linux/slab.h>
35 static int snd_ctl_elem_list_compat(
struct snd_card *
card,
130 switch (data->
type) {
165 unsigned char data[512];
166 #ifndef CONFIG_X86_64
194 err = kctl->
info(kctl, info);
198 *countp = info->
count;
204 static int get_elem_size(
int type,
int count)
208 return sizeof(
s64) * count;
210 return sizeof(
int) * count;
220 static int copy_ctl_value_from_user(
struct snd_card *card,
223 int *typep,
int *countp)
227 unsigned int indirect;
231 if (
get_user(indirect, &data32->indirect))
235 type = get_ctl_type(card, &data->
id, &count);
241 for (i = 0; i <
count; i++) {
243 if (
get_user(val, &data32->value.integer[i]))
248 size = get_elem_size(type, count);
250 printk(
KERN_ERR "snd_ioctl32_ctl_elem_value: unknown type %d\n", type);
254 data32->value.data, size))
272 for (i = 0; i <
count; i++) {
274 val = data->
value.integer.value[
i];
275 if (
put_user(val, &data32->value.integer[i]))
279 size = get_elem_size(type, count);
281 data->
value.bytes.data, size))
287 static int snd_ctl_elem_read_user_compat(
struct snd_card *card,
297 if ((err = copy_ctl_value_from_user(card, data, data32, &type, &count)) < 0)
303 err = snd_ctl_elem_read(card, data);
306 err = copy_ctl_value_to_user(data32, data, type, count);
323 if ((err = copy_ctl_value_from_user(card, data, data32, &type, &count)) < 0)
329 err = snd_ctl_elem_write(card, file, data);
332 err = copy_ctl_value_to_user(data32, data, type, count);
339 static int snd_ctl_elem_add_compat(
struct snd_ctl_file *file,
356 get_user(data->type, &data32->type))
358 switch (data->type) {
368 &data32->value.integer64,
374 &data32->value.enumerated,
383 err = snd_ctl_elem_add(file, data, replace);
421 return snd_ctl_ioctl(file, cmd, (
unsigned long)argp);
423 return snd_ctl_elem_list_compat(ctl->
card, argp);
425 return snd_ctl_elem_info_compat(ctl, argp);
427 return snd_ctl_elem_read_user_compat(ctl->
card, argp);
429 return snd_ctl_elem_write_user_compat(ctl, argp);
431 return snd_ctl_elem_add_compat(ctl, argp, 0);
433 return snd_ctl_elem_add_compat(ctl, argp, 1);