diff options
Diffstat (limited to 'sound/core/control_compat.c')
-rw-r--r-- | sound/core/control_compat.c | 73 |
1 files changed, 38 insertions, 35 deletions
diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c index 207c7de5129c..418c6d4e5daf 100644 --- a/sound/core/control_compat.c +++ b/sound/core/control_compat.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/compat.h> | 23 | #include <linux/compat.h> |
24 | 24 | ||
25 | struct sndrv_ctl_elem_list32 { | 25 | struct snd_ctl_elem_list32 { |
26 | u32 offset; | 26 | u32 offset; |
27 | u32 space; | 27 | u32 space; |
28 | u32 used; | 28 | u32 used; |
@@ -31,9 +31,10 @@ struct sndrv_ctl_elem_list32 { | |||
31 | unsigned char reserved[50]; | 31 | unsigned char reserved[50]; |
32 | } /* don't set packed attribute here */; | 32 | } /* don't set packed attribute here */; |
33 | 33 | ||
34 | static int snd_ctl_elem_list_compat(snd_card_t *card, struct sndrv_ctl_elem_list32 __user *data32) | 34 | static int snd_ctl_elem_list_compat(struct snd_card *card, |
35 | struct snd_ctl_elem_list32 __user *data32) | ||
35 | { | 36 | { |
36 | struct sndrv_ctl_elem_list __user *data; | 37 | struct snd_ctl_elem_list __user *data; |
37 | compat_caddr_t ptr; | 38 | compat_caddr_t ptr; |
38 | int err; | 39 | int err; |
39 | 40 | ||
@@ -60,8 +61,8 @@ static int snd_ctl_elem_list_compat(snd_card_t *card, struct sndrv_ctl_elem_list | |||
60 | * it uses union, so the things are not easy.. | 61 | * it uses union, so the things are not easy.. |
61 | */ | 62 | */ |
62 | 63 | ||
63 | struct sndrv_ctl_elem_info32 { | 64 | struct snd_ctl_elem_info32 { |
64 | struct sndrv_ctl_elem_id id; // the size of struct is same | 65 | struct snd_ctl_elem_id id; // the size of struct is same |
65 | s32 type; | 66 | s32 type; |
66 | u32 access; | 67 | u32 access; |
67 | u32 count; | 68 | u32 count; |
@@ -87,9 +88,10 @@ struct sndrv_ctl_elem_info32 { | |||
87 | unsigned char reserved[64]; | 88 | unsigned char reserved[64]; |
88 | } __attribute__((packed)); | 89 | } __attribute__((packed)); |
89 | 90 | ||
90 | static int snd_ctl_elem_info_compat(snd_ctl_file_t *ctl, struct sndrv_ctl_elem_info32 __user *data32) | 91 | static int snd_ctl_elem_info_compat(struct snd_ctl_file *ctl, |
92 | struct snd_ctl_elem_info32 __user *data32) | ||
91 | { | 93 | { |
92 | struct sndrv_ctl_elem_info *data; | 94 | struct snd_ctl_elem_info *data; |
93 | int err; | 95 | int err; |
94 | 96 | ||
95 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 97 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
@@ -146,8 +148,8 @@ static int snd_ctl_elem_info_compat(snd_ctl_file_t *ctl, struct sndrv_ctl_elem_i | |||
146 | } | 148 | } |
147 | 149 | ||
148 | /* read / write */ | 150 | /* read / write */ |
149 | struct sndrv_ctl_elem_value32 { | 151 | struct snd_ctl_elem_value32 { |
150 | struct sndrv_ctl_elem_id id; | 152 | struct snd_ctl_elem_id id; |
151 | unsigned int indirect; /* bit-field causes misalignment */ | 153 | unsigned int indirect; /* bit-field causes misalignment */ |
152 | union { | 154 | union { |
153 | s32 integer[128]; | 155 | s32 integer[128]; |
@@ -161,10 +163,11 @@ struct sndrv_ctl_elem_value32 { | |||
161 | 163 | ||
162 | 164 | ||
163 | /* get the value type and count of the control */ | 165 | /* get the value type and count of the control */ |
164 | static int get_ctl_type(snd_card_t *card, snd_ctl_elem_id_t *id, int *countp) | 166 | static int get_ctl_type(struct snd_card *card, struct snd_ctl_elem_id *id, |
167 | int *countp) | ||
165 | { | 168 | { |
166 | snd_kcontrol_t *kctl; | 169 | struct snd_kcontrol *kctl; |
167 | snd_ctl_elem_info_t info; | 170 | struct snd_ctl_elem_info info; |
168 | int err; | 171 | int err; |
169 | 172 | ||
170 | down_read(&card->controls_rwsem); | 173 | down_read(&card->controls_rwsem); |
@@ -193,15 +196,15 @@ static int get_elem_size(int type, int count) | |||
193 | case SNDRV_CTL_ELEM_TYPE_BYTES: | 196 | case SNDRV_CTL_ELEM_TYPE_BYTES: |
194 | return 512; | 197 | return 512; |
195 | case SNDRV_CTL_ELEM_TYPE_IEC958: | 198 | case SNDRV_CTL_ELEM_TYPE_IEC958: |
196 | return sizeof(struct sndrv_aes_iec958); | 199 | return sizeof(struct snd_aes_iec958); |
197 | default: | 200 | default: |
198 | return -1; | 201 | return -1; |
199 | } | 202 | } |
200 | } | 203 | } |
201 | 204 | ||
202 | static int copy_ctl_value_from_user(snd_card_t *card, | 205 | static int copy_ctl_value_from_user(struct snd_card *card, |
203 | struct sndrv_ctl_elem_value *data, | 206 | struct snd_ctl_elem_value *data, |
204 | struct sndrv_ctl_elem_value32 __user *data32, | 207 | struct snd_ctl_elem_value32 __user *data32, |
205 | int *typep, int *countp) | 208 | int *typep, int *countp) |
206 | { | 209 | { |
207 | int i, type, count, size; | 210 | int i, type, count, size; |
@@ -242,8 +245,8 @@ static int copy_ctl_value_from_user(snd_card_t *card, | |||
242 | } | 245 | } |
243 | 246 | ||
244 | /* restore the value to 32bit */ | 247 | /* restore the value to 32bit */ |
245 | static int copy_ctl_value_to_user(struct sndrv_ctl_elem_value32 __user *data32, | 248 | static int copy_ctl_value_to_user(struct snd_ctl_elem_value32 __user *data32, |
246 | struct sndrv_ctl_elem_value *data, | 249 | struct snd_ctl_elem_value *data, |
247 | int type, int count) | 250 | int type, int count) |
248 | { | 251 | { |
249 | int i, size; | 252 | int i, size; |
@@ -265,10 +268,10 @@ static int copy_ctl_value_to_user(struct sndrv_ctl_elem_value32 __user *data32, | |||
265 | return 0; | 268 | return 0; |
266 | } | 269 | } |
267 | 270 | ||
268 | static int snd_ctl_elem_read_user_compat(snd_card_t *card, | 271 | static int snd_ctl_elem_read_user_compat(struct snd_card *card, |
269 | struct sndrv_ctl_elem_value32 __user *data32) | 272 | struct snd_ctl_elem_value32 __user *data32) |
270 | { | 273 | { |
271 | struct sndrv_ctl_elem_value *data; | 274 | struct snd_ctl_elem_value *data; |
272 | int err, type, count; | 275 | int err, type, count; |
273 | 276 | ||
274 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 277 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
@@ -285,10 +288,10 @@ static int snd_ctl_elem_read_user_compat(snd_card_t *card, | |||
285 | return err; | 288 | return err; |
286 | } | 289 | } |
287 | 290 | ||
288 | static int snd_ctl_elem_write_user_compat(snd_ctl_file_t *file, | 291 | static int snd_ctl_elem_write_user_compat(struct snd_ctl_file *file, |
289 | struct sndrv_ctl_elem_value32 __user *data32) | 292 | struct snd_ctl_elem_value32 __user *data32) |
290 | { | 293 | { |
291 | struct sndrv_ctl_elem_value *data; | 294 | struct snd_ctl_elem_value *data; |
292 | int err, type, count; | 295 | int err, type, count; |
293 | 296 | ||
294 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 297 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
@@ -306,11 +309,11 @@ static int snd_ctl_elem_write_user_compat(snd_ctl_file_t *file, | |||
306 | } | 309 | } |
307 | 310 | ||
308 | /* add or replace a user control */ | 311 | /* add or replace a user control */ |
309 | static int snd_ctl_elem_add_compat(snd_ctl_file_t *file, | 312 | static int snd_ctl_elem_add_compat(struct snd_ctl_file *file, |
310 | struct sndrv_ctl_elem_info32 __user *data32, | 313 | struct snd_ctl_elem_info32 __user *data32, |
311 | int replace) | 314 | int replace) |
312 | { | 315 | { |
313 | struct sndrv_ctl_elem_info *data; | 316 | struct snd_ctl_elem_info *data; |
314 | int err; | 317 | int err; |
315 | 318 | ||
316 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 319 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
@@ -355,17 +358,17 @@ static int snd_ctl_elem_add_compat(snd_ctl_file_t *file, | |||
355 | } | 358 | } |
356 | 359 | ||
357 | enum { | 360 | enum { |
358 | SNDRV_CTL_IOCTL_ELEM_LIST32 = _IOWR('U', 0x10, struct sndrv_ctl_elem_list32), | 361 | SNDRV_CTL_IOCTL_ELEM_LIST32 = _IOWR('U', 0x10, struct snd_ctl_elem_list32), |
359 | SNDRV_CTL_IOCTL_ELEM_INFO32 = _IOWR('U', 0x11, struct sndrv_ctl_elem_info32), | 362 | SNDRV_CTL_IOCTL_ELEM_INFO32 = _IOWR('U', 0x11, struct snd_ctl_elem_info32), |
360 | SNDRV_CTL_IOCTL_ELEM_READ32 = _IOWR('U', 0x12, struct sndrv_ctl_elem_value32), | 363 | SNDRV_CTL_IOCTL_ELEM_READ32 = _IOWR('U', 0x12, struct snd_ctl_elem_value32), |
361 | SNDRV_CTL_IOCTL_ELEM_WRITE32 = _IOWR('U', 0x13, struct sndrv_ctl_elem_value32), | 364 | SNDRV_CTL_IOCTL_ELEM_WRITE32 = _IOWR('U', 0x13, struct snd_ctl_elem_value32), |
362 | SNDRV_CTL_IOCTL_ELEM_ADD32 = _IOWR('U', 0x17, struct sndrv_ctl_elem_info32), | 365 | SNDRV_CTL_IOCTL_ELEM_ADD32 = _IOWR('U', 0x17, struct snd_ctl_elem_info32), |
363 | SNDRV_CTL_IOCTL_ELEM_REPLACE32 = _IOWR('U', 0x18, struct sndrv_ctl_elem_info32), | 366 | SNDRV_CTL_IOCTL_ELEM_REPLACE32 = _IOWR('U', 0x18, struct snd_ctl_elem_info32), |
364 | }; | 367 | }; |
365 | 368 | ||
366 | static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) | 369 | static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) |
367 | { | 370 | { |
368 | snd_ctl_file_t *ctl; | 371 | struct snd_ctl_file *ctl; |
369 | struct list_head *list; | 372 | struct list_head *list; |
370 | void __user *argp = compat_ptr(arg); | 373 | void __user *argp = compat_ptr(arg); |
371 | int err; | 374 | int err; |
@@ -398,7 +401,7 @@ static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, uns | |||
398 | 401 | ||
399 | down_read(&snd_ioctl_rwsem); | 402 | down_read(&snd_ioctl_rwsem); |
400 | list_for_each(list, &snd_control_compat_ioctls) { | 403 | list_for_each(list, &snd_control_compat_ioctls) { |
401 | snd_kctl_ioctl_t *p = list_entry(list, snd_kctl_ioctl_t, list); | 404 | struct snd_kctl_ioctl *p = list_entry(list, struct snd_kctl_ioctl, list); |
402 | if (p->fioctl) { | 405 | if (p->fioctl) { |
403 | err = p->fioctl(ctl->card, ctl, cmd, arg); | 406 | err = p->fioctl(ctl->card, ctl, cmd, arg); |
404 | if (err != -ENOIOCTLCMD) { | 407 | if (err != -ENOIOCTLCMD) { |