aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 07:53:23 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:17:32 -0500
commit82e9bae6fd253af4aea9c690223c7800313632ad (patch)
tree7a45a6ed1d354318ca25e6bcc92a83b808c13dc9
parent512bbd6a85230f16389f0dd51925472e72fc8a91 (diff)
[ALSA] Remove xxx_t typedefs: Controls
Modules: Control Midlevel Remove xxx_t typedefs from the core controls. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--include/sound/control.h94
-rw-r--r--sound/core/control.c274
-rw-r--r--sound/core/control_compat.c73
3 files changed, 228 insertions, 213 deletions
diff --git a/include/sound/control.h b/include/sound/control.h
index ef7903c7a327..2489b1eb0110 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -24,24 +24,14 @@
24 24
25#include <sound/asound.h> 25#include <sound/asound.h>
26 26
27typedef struct sndrv_aes_iec958 snd_aes_iec958_t;
28typedef struct sndrv_ctl_card_info snd_ctl_card_info_t;
29typedef enum sndrv_ctl_elem_type snd_ctl_elem_type_t;
30typedef enum sndrv_ctl_elem_iface snd_ctl_elem_iface_t;
31typedef struct sndrv_ctl_elem_id snd_ctl_elem_id_t;
32typedef struct sndrv_ctl_elem_list snd_ctl_elem_list_t;
33typedef struct sndrv_ctl_elem_info snd_ctl_elem_info_t;
34typedef struct sndrv_ctl_elem_value snd_ctl_elem_value_t;
35typedef enum sndrv_ctl_event_type snd_ctl_event_type_t;
36typedef struct sndrv_ctl_event snd_ctl_event_t;
37
38#define snd_kcontrol_chip(kcontrol) ((kcontrol)->private_data) 27#define snd_kcontrol_chip(kcontrol) ((kcontrol)->private_data)
39 28
40typedef int (snd_kcontrol_info_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo); 29struct snd_kcontrol;
41typedef int (snd_kcontrol_get_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 30typedef int (snd_kcontrol_info_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_info * uinfo);
42typedef int (snd_kcontrol_put_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 31typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
32typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
43 33
44typedef struct _snd_kcontrol_new { 34struct snd_kcontrol_new {
45 snd_ctl_elem_iface_t iface; /* interface identifier */ 35 snd_ctl_elem_iface_t iface; /* interface identifier */
46 unsigned int device; /* device/client number */ 36 unsigned int device; /* device/client number */
47 unsigned int subdevice; /* subdevice (substream) number */ 37 unsigned int subdevice; /* subdevice (substream) number */
@@ -53,40 +43,40 @@ typedef struct _snd_kcontrol_new {
53 snd_kcontrol_get_t *get; 43 snd_kcontrol_get_t *get;
54 snd_kcontrol_put_t *put; 44 snd_kcontrol_put_t *put;
55 unsigned long private_value; 45 unsigned long private_value;
56} snd_kcontrol_new_t; 46};
57 47
58typedef struct _snd_kcontrol_volatile { 48struct snd_kcontrol_volatile {
59 snd_ctl_file_t *owner; /* locked */ 49 struct snd_ctl_file *owner; /* locked */
60 pid_t owner_pid; 50 pid_t owner_pid;
61 unsigned int access; /* access rights */ 51 unsigned int access; /* access rights */
62} snd_kcontrol_volatile_t; 52};
63 53
64struct _snd_kcontrol { 54struct snd_kcontrol {
65 struct list_head list; /* list of controls */ 55 struct list_head list; /* list of controls */
66 snd_ctl_elem_id_t id; 56 struct snd_ctl_elem_id id;
67 unsigned int count; /* count of same elements */ 57 unsigned int count; /* count of same elements */
68 snd_kcontrol_info_t *info; 58 snd_kcontrol_info_t *info;
69 snd_kcontrol_get_t *get; 59 snd_kcontrol_get_t *get;
70 snd_kcontrol_put_t *put; 60 snd_kcontrol_put_t *put;
71 unsigned long private_value; 61 unsigned long private_value;
72 void *private_data; 62 void *private_data;
73 void (*private_free)(snd_kcontrol_t *kcontrol); 63 void (*private_free)(struct snd_kcontrol *kcontrol);
74 snd_kcontrol_volatile_t vd[0]; /* volatile data */ 64 struct snd_kcontrol_volatile vd[0]; /* volatile data */
75}; 65};
76 66
77#define snd_kcontrol(n) list_entry(n, snd_kcontrol_t, list) 67#define snd_kcontrol(n) list_entry(n, struct snd_kcontrol, list)
78 68
79typedef struct _snd_kctl_event { 69struct snd_kctl_event {
80 struct list_head list; /* list of events */ 70 struct list_head list; /* list of events */
81 snd_ctl_elem_id_t id; 71 struct snd_ctl_elem_id id;
82 unsigned int mask; 72 unsigned int mask;
83} snd_kctl_event_t; 73};
84 74
85#define snd_kctl_event(n) list_entry(n, snd_kctl_event_t, list) 75#define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list)
86 76
87struct _snd_ctl_file { 77struct snd_ctl_file {
88 struct list_head list; /* list of all control files */ 78 struct list_head list; /* list of all control files */
89 snd_card_t *card; 79 struct snd_card *card;
90 pid_t pid; 80 pid_t pid;
91 int prefer_pcm_subdevice; 81 int prefer_pcm_subdevice;
92 int prefer_rawmidi_subdevice; 82 int prefer_rawmidi_subdevice;
@@ -97,25 +87,25 @@ struct _snd_ctl_file {
97 struct list_head events; /* waiting events for read */ 87 struct list_head events; /* waiting events for read */
98}; 88};
99 89
100#define snd_ctl_file(n) list_entry(n, snd_ctl_file_t, list) 90#define snd_ctl_file(n) list_entry(n, struct snd_ctl_file, list)
101 91
102typedef int (*snd_kctl_ioctl_func_t) (snd_card_t * card, 92typedef int (*snd_kctl_ioctl_func_t) (struct snd_card * card,
103 snd_ctl_file_t * control, 93 struct snd_ctl_file * control,
104 unsigned int cmd, unsigned long arg); 94 unsigned int cmd, unsigned long arg);
105 95
106void snd_ctl_notify(snd_card_t * card, unsigned int mask, snd_ctl_elem_id_t * id); 96void snd_ctl_notify(struct snd_card * card, unsigned int mask, struct snd_ctl_elem_id * id);
107 97
108snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * kcontrol, unsigned int access); 98struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol * kcontrol, unsigned int access);
109snd_kcontrol_t *snd_ctl_new1(const snd_kcontrol_new_t * kcontrolnew, void * private_data); 99struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new * kcontrolnew, void * private_data);
110void snd_ctl_free_one(snd_kcontrol_t * kcontrol); 100void snd_ctl_free_one(struct snd_kcontrol * kcontrol);
111int snd_ctl_add(snd_card_t * card, snd_kcontrol_t * kcontrol); 101int snd_ctl_add(struct snd_card * card, struct snd_kcontrol * kcontrol);
112int snd_ctl_remove(snd_card_t * card, snd_kcontrol_t * kcontrol); 102int snd_ctl_remove(struct snd_card * card, struct snd_kcontrol * kcontrol);
113int snd_ctl_remove_id(snd_card_t * card, snd_ctl_elem_id_t *id); 103int snd_ctl_remove_id(struct snd_card * card, struct snd_ctl_elem_id *id);
114int snd_ctl_rename_id(snd_card_t * card, snd_ctl_elem_id_t *src_id, snd_ctl_elem_id_t *dst_id); 104int snd_ctl_rename_id(struct snd_card * card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id);
115snd_kcontrol_t *snd_ctl_find_numid(snd_card_t * card, unsigned int numid); 105struct snd_kcontrol *snd_ctl_find_numid(struct snd_card * card, unsigned int numid);
116snd_kcontrol_t *snd_ctl_find_id(snd_card_t * card, snd_ctl_elem_id_t *id); 106struct snd_kcontrol *snd_ctl_find_id(struct snd_card * card, struct snd_ctl_elem_id *id);
117 107
118int snd_ctl_create(snd_card_t *card); 108int snd_ctl_create(struct snd_card *card);
119 109
120int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn); 110int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn);
121int snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn); 111int snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn);
@@ -127,20 +117,20 @@ int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn);
127#define snd_ctl_unregister_ioctl_compat(fcn) 117#define snd_ctl_unregister_ioctl_compat(fcn)
128#endif 118#endif
129 119
130int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t *control); 120int snd_ctl_elem_read(struct snd_card *card, struct snd_ctl_elem_value *control);
131int snd_ctl_elem_write(snd_card_t *card, snd_ctl_file_t *file, snd_ctl_elem_value_t *control); 121int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file, struct snd_ctl_elem_value *control);
132 122
133static inline unsigned int snd_ctl_get_ioffnum(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id) 123static inline unsigned int snd_ctl_get_ioffnum(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
134{ 124{
135 return id->numid - kctl->id.numid; 125 return id->numid - kctl->id.numid;
136} 126}
137 127
138static inline unsigned int snd_ctl_get_ioffidx(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id) 128static inline unsigned int snd_ctl_get_ioffidx(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
139{ 129{
140 return id->index - kctl->id.index; 130 return id->index - kctl->id.index;
141} 131}
142 132
143static inline unsigned int snd_ctl_get_ioff(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id) 133static inline unsigned int snd_ctl_get_ioff(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
144{ 134{
145 if (id->numid) { 135 if (id->numid) {
146 return snd_ctl_get_ioffnum(kctl, id); 136 return snd_ctl_get_ioffnum(kctl, id);
@@ -149,8 +139,8 @@ static inline unsigned int snd_ctl_get_ioff(snd_kcontrol_t *kctl, snd_ctl_elem_i
149 } 139 }
150} 140}
151 141
152static inline snd_ctl_elem_id_t *snd_ctl_build_ioff(snd_ctl_elem_id_t *dst_id, 142static inline struct snd_ctl_elem_id *snd_ctl_build_ioff(struct snd_ctl_elem_id *dst_id,
153 snd_kcontrol_t *src_kctl, 143 struct snd_kcontrol *src_kctl,
154 unsigned int offset) 144 unsigned int offset)
155{ 145{
156 *dst_id = src_kctl->id; 146 *dst_id = src_kctl->id;
diff --git a/sound/core/control.c b/sound/core/control.c
index 212c46a94376..1a14338bd516 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -34,12 +34,10 @@
34/* max number of user-defined controls */ 34/* max number of user-defined controls */
35#define MAX_USER_CONTROLS 32 35#define MAX_USER_CONTROLS 32
36 36
37typedef struct _snd_kctl_ioctl { 37struct snd_kctl_ioctl {
38 struct list_head list; /* list of all ioctls */ 38 struct list_head list; /* list of all ioctls */
39 snd_kctl_ioctl_func_t fioctl; 39 snd_kctl_ioctl_func_t fioctl;
40} snd_kctl_ioctl_t; 40};
41
42#define snd_kctl_ioctl(n) list_entry(n, snd_kctl_ioctl_t, list)
43 41
44static DECLARE_RWSEM(snd_ioctl_rwsem); 42static DECLARE_RWSEM(snd_ioctl_rwsem);
45static LIST_HEAD(snd_control_ioctls); 43static LIST_HEAD(snd_control_ioctls);
@@ -51,8 +49,8 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
51{ 49{
52 int cardnum = SNDRV_MINOR_CARD(iminor(inode)); 50 int cardnum = SNDRV_MINOR_CARD(iminor(inode));
53 unsigned long flags; 51 unsigned long flags;
54 snd_card_t *card; 52 struct snd_card *card;
55 snd_ctl_file_t *ctl; 53 struct snd_ctl_file *ctl;
56 int err; 54 int err;
57 55
58 card = snd_cards[cardnum]; 56 card = snd_cards[cardnum];
@@ -93,9 +91,9 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
93 return err; 91 return err;
94} 92}
95 93
96static void snd_ctl_empty_read_queue(snd_ctl_file_t * ctl) 94static void snd_ctl_empty_read_queue(struct snd_ctl_file * ctl)
97{ 95{
98 snd_kctl_event_t *cread; 96 struct snd_kctl_event *cread;
99 97
100 spin_lock(&ctl->read_lock); 98 spin_lock(&ctl->read_lock);
101 while (!list_empty(&ctl->events)) { 99 while (!list_empty(&ctl->events)) {
@@ -110,9 +108,9 @@ static int snd_ctl_release(struct inode *inode, struct file *file)
110{ 108{
111 unsigned long flags; 109 unsigned long flags;
112 struct list_head *list; 110 struct list_head *list;
113 snd_card_t *card; 111 struct snd_card *card;
114 snd_ctl_file_t *ctl; 112 struct snd_ctl_file *ctl;
115 snd_kcontrol_t *control; 113 struct snd_kcontrol *control;
116 unsigned int idx; 114 unsigned int idx;
117 115
118 ctl = file->private_data; 116 ctl = file->private_data;
@@ -137,12 +135,13 @@ static int snd_ctl_release(struct inode *inode, struct file *file)
137 return 0; 135 return 0;
138} 136}
139 137
140void snd_ctl_notify(snd_card_t *card, unsigned int mask, snd_ctl_elem_id_t *id) 138void snd_ctl_notify(struct snd_card *card, unsigned int mask,
139 struct snd_ctl_elem_id *id)
141{ 140{
142 unsigned long flags; 141 unsigned long flags;
143 struct list_head *flist; 142 struct list_head *flist;
144 snd_ctl_file_t *ctl; 143 struct snd_ctl_file *ctl;
145 snd_kctl_event_t *ev; 144 struct snd_kctl_event *ev;
146 145
147 snd_assert(card != NULL && id != NULL, return); 146 snd_assert(card != NULL && id != NULL, return);
148 read_lock(&card->ctl_files_rwlock); 147 read_lock(&card->ctl_files_rwlock);
@@ -183,19 +182,19 @@ void snd_ctl_notify(snd_card_t *card, unsigned int mask, snd_ctl_elem_id_t *id)
183 * @control: the control template 182 * @control: the control template
184 * @access: the default control access 183 * @access: the default control access
185 * 184 *
186 * Allocates a new snd_kcontrol_t instance and copies the given template 185 * Allocates a new struct snd_kcontrol instance and copies the given template
187 * to the new instance. It does not copy volatile data (access). 186 * to the new instance. It does not copy volatile data (access).
188 * 187 *
189 * Returns the pointer of the new instance, or NULL on failure. 188 * Returns the pointer of the new instance, or NULL on failure.
190 */ 189 */
191snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * control, unsigned int access) 190struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control, unsigned int access)
192{ 191{
193 snd_kcontrol_t *kctl; 192 struct snd_kcontrol *kctl;
194 unsigned int idx; 193 unsigned int idx;
195 194
196 snd_assert(control != NULL, return NULL); 195 snd_assert(control != NULL, return NULL);
197 snd_assert(control->count > 0, return NULL); 196 snd_assert(control->count > 0, return NULL);
198 kctl = kzalloc(sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL); 197 kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL);
199 if (kctl == NULL) 198 if (kctl == NULL)
200 return NULL; 199 return NULL;
201 *kctl = *control; 200 *kctl = *control;
@@ -209,15 +208,16 @@ snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * control, unsigned int access)
209 * @ncontrol: the initialization record 208 * @ncontrol: the initialization record
210 * @private_data: the private data to set 209 * @private_data: the private data to set
211 * 210 *
212 * Allocates a new snd_kcontrol_t instance and initialize from the given 211 * Allocates a new struct snd_kcontrol instance and initialize from the given
213 * template. When the access field of ncontrol is 0, it's assumed as 212 * template. When the access field of ncontrol is 0, it's assumed as
214 * READWRITE access. When the count field is 0, it's assumes as one. 213 * READWRITE access. When the count field is 0, it's assumes as one.
215 * 214 *
216 * Returns the pointer of the newly generated instance, or NULL on failure. 215 * Returns the pointer of the newly generated instance, or NULL on failure.
217 */ 216 */
218snd_kcontrol_t *snd_ctl_new1(const snd_kcontrol_new_t * ncontrol, void *private_data) 217struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol,
218 void *private_data)
219{ 219{
220 snd_kcontrol_t kctl; 220 struct snd_kcontrol kctl;
221 unsigned int access; 221 unsigned int access;
222 222
223 snd_assert(ncontrol != NULL, return NULL); 223 snd_assert(ncontrol != NULL, return NULL);
@@ -249,7 +249,7 @@ snd_kcontrol_t *snd_ctl_new1(const snd_kcontrol_new_t * ncontrol, void *private_
249 * or snd_ctl_new1(). 249 * or snd_ctl_new1().
250 * Don't call this after the control was added to the card. 250 * Don't call this after the control was added to the card.
251 */ 251 */
252void snd_ctl_free_one(snd_kcontrol_t * kcontrol) 252void snd_ctl_free_one(struct snd_kcontrol *kcontrol)
253{ 253{
254 if (kcontrol) { 254 if (kcontrol) {
255 if (kcontrol->private_free) 255 if (kcontrol->private_free)
@@ -258,11 +258,11 @@ void snd_ctl_free_one(snd_kcontrol_t * kcontrol)
258 } 258 }
259} 259}
260 260
261static unsigned int snd_ctl_hole_check(snd_card_t * card, 261static unsigned int snd_ctl_hole_check(struct snd_card *card,
262 unsigned int count) 262 unsigned int count)
263{ 263{
264 struct list_head *list; 264 struct list_head *list;
265 snd_kcontrol_t *kctl; 265 struct snd_kcontrol *kctl;
266 266
267 list_for_each(list, &card->controls) { 267 list_for_each(list, &card->controls) {
268 kctl = snd_kcontrol(list); 268 kctl = snd_kcontrol(list);
@@ -275,7 +275,7 @@ static unsigned int snd_ctl_hole_check(snd_card_t * card,
275 return card->last_numid; 275 return card->last_numid;
276} 276}
277 277
278static int snd_ctl_find_hole(snd_card_t * card, unsigned int count) 278static int snd_ctl_find_hole(struct snd_card *card, unsigned int count)
279{ 279{
280 unsigned int last_numid, iter = 100000; 280 unsigned int last_numid, iter = 100000;
281 281
@@ -304,9 +304,9 @@ static int snd_ctl_find_hole(snd_card_t * card, unsigned int count)
304 * 304 *
305 * It frees automatically the control which cannot be added. 305 * It frees automatically the control which cannot be added.
306 */ 306 */
307int snd_ctl_add(snd_card_t * card, snd_kcontrol_t * kcontrol) 307int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)
308{ 308{
309 snd_ctl_elem_id_t id; 309 struct snd_ctl_elem_id id;
310 unsigned int idx; 310 unsigned int idx;
311 311
312 snd_assert(card != NULL && kcontrol != NULL, return -EINVAL); 312 snd_assert(card != NULL && kcontrol != NULL, return -EINVAL);
@@ -350,9 +350,9 @@ int snd_ctl_add(snd_card_t * card, snd_kcontrol_t * kcontrol)
350 * 350 *
351 * Returns 0 if successful, or a negative error code on failure. 351 * Returns 0 if successful, or a negative error code on failure.
352 */ 352 */
353int snd_ctl_remove(snd_card_t * card, snd_kcontrol_t * kcontrol) 353int snd_ctl_remove(struct snd_card *card, struct snd_kcontrol *kcontrol)
354{ 354{
355 snd_ctl_elem_id_t id; 355 struct snd_ctl_elem_id id;
356 unsigned int idx; 356 unsigned int idx;
357 357
358 snd_assert(card != NULL && kcontrol != NULL, return -EINVAL); 358 snd_assert(card != NULL && kcontrol != NULL, return -EINVAL);
@@ -375,9 +375,9 @@ int snd_ctl_remove(snd_card_t * card, snd_kcontrol_t * kcontrol)
375 * 375 *
376 * Returns 0 if successful, or a negative error code on failure. 376 * Returns 0 if successful, or a negative error code on failure.
377 */ 377 */
378int snd_ctl_remove_id(snd_card_t * card, snd_ctl_elem_id_t *id) 378int snd_ctl_remove_id(struct snd_card *card, struct snd_ctl_elem_id *id)
379{ 379{
380 snd_kcontrol_t *kctl; 380 struct snd_kcontrol *kctl;
381 int ret; 381 int ret;
382 382
383 down_write(&card->controls_rwsem); 383 down_write(&card->controls_rwsem);
@@ -401,10 +401,11 @@ int snd_ctl_remove_id(snd_card_t * card, snd_ctl_elem_id_t *id)
401 * 401 *
402 * Returns 0 if successful, or a negative error code on failure. 402 * Returns 0 if successful, or a negative error code on failure.
403 */ 403 */
404static int snd_ctl_remove_unlocked_id(snd_ctl_file_t * file, snd_ctl_elem_id_t *id) 404static int snd_ctl_remove_unlocked_id(struct snd_ctl_file * file,
405 struct snd_ctl_elem_id *id)
405{ 406{
406 snd_card_t *card = file->card; 407 struct snd_card *card = file->card;
407 snd_kcontrol_t *kctl; 408 struct snd_kcontrol *kctl;
408 int idx, ret; 409 int idx, ret;
409 410
410 down_write(&card->controls_rwsem); 411 down_write(&card->controls_rwsem);
@@ -434,9 +435,10 @@ static int snd_ctl_remove_unlocked_id(snd_ctl_file_t * file, snd_ctl_elem_id_t *
434 * 435 *
435 * Returns zero if successful, or a negative error code on failure. 436 * Returns zero if successful, or a negative error code on failure.
436 */ 437 */
437int snd_ctl_rename_id(snd_card_t * card, snd_ctl_elem_id_t *src_id, snd_ctl_elem_id_t *dst_id) 438int snd_ctl_rename_id(struct snd_card *card, struct snd_ctl_elem_id *src_id,
439 struct snd_ctl_elem_id *dst_id)
438{ 440{
439 snd_kcontrol_t *kctl; 441 struct snd_kcontrol *kctl;
440 442
441 down_write(&card->controls_rwsem); 443 down_write(&card->controls_rwsem);
442 kctl = snd_ctl_find_id(card, src_id); 444 kctl = snd_ctl_find_id(card, src_id);
@@ -463,10 +465,10 @@ int snd_ctl_rename_id(snd_card_t * card, snd_ctl_elem_id_t *src_id, snd_ctl_elem
463 * The caller must down card->controls_rwsem before calling this function 465 * The caller must down card->controls_rwsem before calling this function
464 * (if the race condition can happen). 466 * (if the race condition can happen).
465 */ 467 */
466snd_kcontrol_t *snd_ctl_find_numid(snd_card_t * card, unsigned int numid) 468struct snd_kcontrol *snd_ctl_find_numid(struct snd_card *card, unsigned int numid)
467{ 469{
468 struct list_head *list; 470 struct list_head *list;
469 snd_kcontrol_t *kctl; 471 struct snd_kcontrol *kctl;
470 472
471 snd_assert(card != NULL && numid != 0, return NULL); 473 snd_assert(card != NULL && numid != 0, return NULL);
472 list_for_each(list, &card->controls) { 474 list_for_each(list, &card->controls) {
@@ -489,10 +491,11 @@ snd_kcontrol_t *snd_ctl_find_numid(snd_card_t * card, unsigned int numid)
489 * The caller must down card->controls_rwsem before calling this function 491 * The caller must down card->controls_rwsem before calling this function
490 * (if the race condition can happen). 492 * (if the race condition can happen).
491 */ 493 */
492snd_kcontrol_t *snd_ctl_find_id(snd_card_t * card, snd_ctl_elem_id_t *id) 494struct snd_kcontrol *snd_ctl_find_id(struct snd_card *card,
495 struct snd_ctl_elem_id *id)
493{ 496{
494 struct list_head *list; 497 struct list_head *list;
495 snd_kcontrol_t *kctl; 498 struct snd_kcontrol *kctl;
496 499
497 snd_assert(card != NULL && id != NULL, return NULL); 500 snd_assert(card != NULL && id != NULL, return NULL);
498 if (id->numid != 0) 501 if (id->numid != 0)
@@ -516,10 +519,10 @@ snd_kcontrol_t *snd_ctl_find_id(snd_card_t * card, snd_ctl_elem_id_t *id)
516 return NULL; 519 return NULL;
517} 520}
518 521
519static int snd_ctl_card_info(snd_card_t * card, snd_ctl_file_t * ctl, 522static int snd_ctl_card_info(struct snd_card *card, struct snd_ctl_file * ctl,
520 unsigned int cmd, void __user *arg) 523 unsigned int cmd, void __user *arg)
521{ 524{
522 snd_ctl_card_info_t *info; 525 struct snd_ctl_card_info *info;
523 526
524 info = kzalloc(sizeof(*info), GFP_KERNEL); 527 info = kzalloc(sizeof(*info), GFP_KERNEL);
525 if (! info) 528 if (! info)
@@ -533,7 +536,7 @@ static int snd_ctl_card_info(snd_card_t * card, snd_ctl_file_t * ctl,
533 strlcpy(info->mixername, card->mixername, sizeof(info->mixername)); 536 strlcpy(info->mixername, card->mixername, sizeof(info->mixername));
534 strlcpy(info->components, card->components, sizeof(info->components)); 537 strlcpy(info->components, card->components, sizeof(info->components));
535 up_read(&snd_ioctl_rwsem); 538 up_read(&snd_ioctl_rwsem);
536 if (copy_to_user(arg, info, sizeof(snd_ctl_card_info_t))) { 539 if (copy_to_user(arg, info, sizeof(struct snd_ctl_card_info))) {
537 kfree(info); 540 kfree(info);
538 return -EFAULT; 541 return -EFAULT;
539 } 542 }
@@ -541,12 +544,13 @@ static int snd_ctl_card_info(snd_card_t * card, snd_ctl_file_t * ctl,
541 return 0; 544 return 0;
542} 545}
543 546
544static int snd_ctl_elem_list(snd_card_t *card, snd_ctl_elem_list_t __user *_list) 547static int snd_ctl_elem_list(struct snd_card *card,
548 struct snd_ctl_elem_list __user *_list)
545{ 549{
546 struct list_head *plist; 550 struct list_head *plist;
547 snd_ctl_elem_list_t list; 551 struct snd_ctl_elem_list list;
548 snd_kcontrol_t *kctl; 552 struct snd_kcontrol *kctl;
549 snd_ctl_elem_id_t *dst, *id; 553 struct snd_ctl_elem_id *dst, *id;
550 unsigned int offset, space, first, jidx; 554 unsigned int offset, space, first, jidx;
551 555
552 if (copy_from_user(&list, _list, sizeof(list))) 556 if (copy_from_user(&list, _list, sizeof(list)))
@@ -559,7 +563,7 @@ static int snd_ctl_elem_list(snd_card_t *card, snd_ctl_elem_list_t __user *_list
559 return -ENOMEM; 563 return -ENOMEM;
560 if (space > 0) { 564 if (space > 0) {
561 /* allocate temporary buffer for atomic operation */ 565 /* allocate temporary buffer for atomic operation */
562 dst = vmalloc(space * sizeof(snd_ctl_elem_id_t)); 566 dst = vmalloc(space * sizeof(struct snd_ctl_elem_id));
563 if (dst == NULL) 567 if (dst == NULL)
564 return -ENOMEM; 568 return -ENOMEM;
565 down_read(&card->controls_rwsem); 569 down_read(&card->controls_rwsem);
@@ -588,7 +592,9 @@ static int snd_ctl_elem_list(snd_card_t *card, snd_ctl_elem_list_t __user *_list
588 offset = 0; 592 offset = 0;
589 } 593 }
590 up_read(&card->controls_rwsem); 594 up_read(&card->controls_rwsem);
591 if (list.used > 0 && copy_to_user(list.pids, dst, list.used * sizeof(snd_ctl_elem_id_t))) { 595 if (list.used > 0 &&
596 copy_to_user(list.pids, dst,
597 list.used * sizeof(struct snd_ctl_elem_id))) {
592 vfree(dst); 598 vfree(dst);
593 return -EFAULT; 599 return -EFAULT;
594 } 600 }
@@ -603,11 +609,12 @@ static int snd_ctl_elem_list(snd_card_t *card, snd_ctl_elem_list_t __user *_list
603 return 0; 609 return 0;
604} 610}
605 611
606static int snd_ctl_elem_info(snd_ctl_file_t *ctl, snd_ctl_elem_info_t *info) 612static int snd_ctl_elem_info(struct snd_ctl_file *ctl,
613 struct snd_ctl_elem_info *info)
607{ 614{
608 snd_card_t *card = ctl->card; 615 struct snd_card *card = ctl->card;
609 snd_kcontrol_t *kctl; 616 struct snd_kcontrol *kctl;
610 snd_kcontrol_volatile_t *vd; 617 struct snd_kcontrol_volatile *vd;
611 unsigned int index_offset; 618 unsigned int index_offset;
612 int result; 619 int result;
613 620
@@ -640,9 +647,10 @@ static int snd_ctl_elem_info(snd_ctl_file_t *ctl, snd_ctl_elem_info_t *info)
640 return result; 647 return result;
641} 648}
642 649
643static int snd_ctl_elem_info_user(snd_ctl_file_t *ctl, snd_ctl_elem_info_t __user *_info) 650static int snd_ctl_elem_info_user(struct snd_ctl_file *ctl,
651 struct snd_ctl_elem_info __user *_info)
644{ 652{
645 snd_ctl_elem_info_t info; 653 struct snd_ctl_elem_info info;
646 int result; 654 int result;
647 655
648 if (copy_from_user(&info, _info, sizeof(info))) 656 if (copy_from_user(&info, _info, sizeof(info)))
@@ -654,10 +662,10 @@ static int snd_ctl_elem_info_user(snd_ctl_file_t *ctl, snd_ctl_elem_info_t __use
654 return result; 662 return result;
655} 663}
656 664
657int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t *control) 665int snd_ctl_elem_read(struct snd_card *card, struct snd_ctl_elem_value *control)
658{ 666{
659 snd_kcontrol_t *kctl; 667 struct snd_kcontrol *kctl;
660 snd_kcontrol_volatile_t *vd; 668 struct snd_kcontrol_volatile *vd;
661 unsigned int index_offset; 669 unsigned int index_offset;
662 int result, indirect; 670 int result, indirect;
663 671
@@ -684,9 +692,10 @@ int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t *control)
684 return result; 692 return result;
685} 693}
686 694
687static int snd_ctl_elem_read_user(snd_card_t *card, snd_ctl_elem_value_t __user *_control) 695static int snd_ctl_elem_read_user(struct snd_card *card,
696 struct snd_ctl_elem_value __user *_control)
688{ 697{
689 snd_ctl_elem_value_t *control; 698 struct snd_ctl_elem_value *control;
690 int result; 699 int result;
691 700
692 control = kmalloc(sizeof(*control), GFP_KERNEL); 701 control = kmalloc(sizeof(*control), GFP_KERNEL);
@@ -704,10 +713,11 @@ static int snd_ctl_elem_read_user(snd_card_t *card, snd_ctl_elem_value_t __user
704 return result; 713 return result;
705} 714}
706 715
707int snd_ctl_elem_write(snd_card_t *card, snd_ctl_file_t *file, snd_ctl_elem_value_t *control) 716int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file,
717 struct snd_ctl_elem_value *control)
708{ 718{
709 snd_kcontrol_t *kctl; 719 struct snd_kcontrol *kctl;
710 snd_kcontrol_volatile_t *vd; 720 struct snd_kcontrol_volatile *vd;
711 unsigned int index_offset; 721 unsigned int index_offset;
712 int result, indirect; 722 int result, indirect;
713 723
@@ -741,9 +751,10 @@ int snd_ctl_elem_write(snd_card_t *card, snd_ctl_file_t *file, snd_ctl_elem_valu
741 return result; 751 return result;
742} 752}
743 753
744static int snd_ctl_elem_write_user(snd_ctl_file_t *file, snd_ctl_elem_value_t __user *_control) 754static int snd_ctl_elem_write_user(struct snd_ctl_file *file,
755 struct snd_ctl_elem_value __user *_control)
745{ 756{
746 snd_ctl_elem_value_t *control; 757 struct snd_ctl_elem_value *control;
747 int result; 758 int result;
748 759
749 control = kmalloc(sizeof(*control), GFP_KERNEL); 760 control = kmalloc(sizeof(*control), GFP_KERNEL);
@@ -761,12 +772,13 @@ static int snd_ctl_elem_write_user(snd_ctl_file_t *file, snd_ctl_elem_value_t __
761 return result; 772 return result;
762} 773}
763 774
764static int snd_ctl_elem_lock(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_id) 775static int snd_ctl_elem_lock(struct snd_ctl_file *file,
776 struct snd_ctl_elem_id __user *_id)
765{ 777{
766 snd_card_t *card = file->card; 778 struct snd_card *card = file->card;
767 snd_ctl_elem_id_t id; 779 struct snd_ctl_elem_id id;
768 snd_kcontrol_t *kctl; 780 struct snd_kcontrol *kctl;
769 snd_kcontrol_volatile_t *vd; 781 struct snd_kcontrol_volatile *vd;
770 int result; 782 int result;
771 783
772 if (copy_from_user(&id, _id, sizeof(id))) 784 if (copy_from_user(&id, _id, sizeof(id)))
@@ -789,12 +801,13 @@ static int snd_ctl_elem_lock(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_id
789 return result; 801 return result;
790} 802}
791 803
792static int snd_ctl_elem_unlock(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_id) 804static int snd_ctl_elem_unlock(struct snd_ctl_file *file,
805 struct snd_ctl_elem_id __user *_id)
793{ 806{
794 snd_card_t *card = file->card; 807 struct snd_card *card = file->card;
795 snd_ctl_elem_id_t id; 808 struct snd_ctl_elem_id id;
796 snd_kcontrol_t *kctl; 809 struct snd_kcontrol *kctl;
797 snd_kcontrol_volatile_t *vd; 810 struct snd_kcontrol_volatile *vd;
798 int result; 811 int result;
799 812
800 if (copy_from_user(&id, _id, sizeof(id))) 813 if (copy_from_user(&id, _id, sizeof(id)))
@@ -820,14 +833,15 @@ static int snd_ctl_elem_unlock(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_
820} 833}
821 834
822struct user_element { 835struct user_element {
823 snd_ctl_elem_info_t info; 836 struct snd_ctl_elem_info info;
824 void *elem_data; /* element data */ 837 void *elem_data; /* element data */
825 unsigned long elem_data_size; /* size of element data in bytes */ 838 unsigned long elem_data_size; /* size of element data in bytes */
826 void *priv_data; /* private data (like strings for enumerated type) */ 839 void *priv_data; /* private data (like strings for enumerated type) */
827 unsigned long priv_data_size; /* size of private data in bytes */ 840 unsigned long priv_data_size; /* size of private data in bytes */
828}; 841};
829 842
830static int snd_ctl_elem_user_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 843static int snd_ctl_elem_user_info(struct snd_kcontrol *kcontrol,
844 struct snd_ctl_elem_info *uinfo)
831{ 845{
832 struct user_element *ue = kcontrol->private_data; 846 struct user_element *ue = kcontrol->private_data;
833 847
@@ -835,7 +849,8 @@ static int snd_ctl_elem_user_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
835 return 0; 849 return 0;
836} 850}
837 851
838static int snd_ctl_elem_user_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 852static int snd_ctl_elem_user_get(struct snd_kcontrol *kcontrol,
853 struct snd_ctl_elem_value *ucontrol)
839{ 854{
840 struct user_element *ue = kcontrol->private_data; 855 struct user_element *ue = kcontrol->private_data;
841 856
@@ -843,7 +858,8 @@ static int snd_ctl_elem_user_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
843 return 0; 858 return 0;
844} 859}
845 860
846static int snd_ctl_elem_user_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 861static int snd_ctl_elem_user_put(struct snd_kcontrol *kcontrol,
862 struct snd_ctl_elem_value *ucontrol)
847{ 863{
848 int change; 864 int change;
849 struct user_element *ue = kcontrol->private_data; 865 struct user_element *ue = kcontrol->private_data;
@@ -854,15 +870,16 @@ static int snd_ctl_elem_user_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
854 return change; 870 return change;
855} 871}
856 872
857static void snd_ctl_elem_user_free(snd_kcontrol_t * kcontrol) 873static void snd_ctl_elem_user_free(struct snd_kcontrol *kcontrol)
858{ 874{
859 kfree(kcontrol->private_data); 875 kfree(kcontrol->private_data);
860} 876}
861 877
862static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t *info, int replace) 878static int snd_ctl_elem_add(struct snd_ctl_file *file,
879 struct snd_ctl_elem_info *info, int replace)
863{ 880{
864 snd_card_t *card = file->card; 881 struct snd_card *card = file->card;
865 snd_kcontrol_t kctl, *_kctl; 882 struct snd_kcontrol kctl, *_kctl;
866 unsigned int access; 883 unsigned int access;
867 long private_size; 884 long private_size;
868 struct user_element *ue; 885 struct user_element *ue;
@@ -873,7 +890,8 @@ static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t *info, int
873 if (info->count > 1024) 890 if (info->count > 1024)
874 return -EINVAL; 891 return -EINVAL;
875 access = info->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE : 892 access = info->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE :
876 (info->access & (SNDRV_CTL_ELEM_ACCESS_READWRITE|SNDRV_CTL_ELEM_ACCESS_INACTIVE)); 893 (info->access & (SNDRV_CTL_ELEM_ACCESS_READWRITE|
894 SNDRV_CTL_ELEM_ACCESS_INACTIVE));
877 info->id.numid = 0; 895 info->id.numid = 0;
878 memset(&kctl, 0, sizeof(kctl)); 896 memset(&kctl, 0, sizeof(kctl));
879 down_write(&card->controls_rwsem); 897 down_write(&card->controls_rwsem);
@@ -921,7 +939,7 @@ static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t *info, int
921 return -EINVAL; 939 return -EINVAL;
922 break; 940 break;
923 case SNDRV_CTL_ELEM_TYPE_IEC958: 941 case SNDRV_CTL_ELEM_TYPE_IEC958:
924 private_size = sizeof(struct sndrv_aes_iec958); 942 private_size = sizeof(struct snd_aes_iec958);
925 if (info->count != 1) 943 if (info->count != 1)
926 return -EINVAL; 944 return -EINVAL;
927 break; 945 break;
@@ -957,24 +975,26 @@ static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t *info, int
957 return 0; 975 return 0;
958} 976}
959 977
960static int snd_ctl_elem_add_user(snd_ctl_file_t *file, snd_ctl_elem_info_t __user *_info, int replace) 978static int snd_ctl_elem_add_user(struct snd_ctl_file *file,
979 struct snd_ctl_elem_info __user *_info, int replace)
961{ 980{
962 snd_ctl_elem_info_t info; 981 struct snd_ctl_elem_info info;
963 if (copy_from_user(&info, _info, sizeof(info))) 982 if (copy_from_user(&info, _info, sizeof(info)))
964 return -EFAULT; 983 return -EFAULT;
965 return snd_ctl_elem_add(file, &info, replace); 984 return snd_ctl_elem_add(file, &info, replace);
966} 985}
967 986
968static int snd_ctl_elem_remove(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_id) 987static int snd_ctl_elem_remove(struct snd_ctl_file *file,
988 struct snd_ctl_elem_id __user *_id)
969{ 989{
970 snd_ctl_elem_id_t id; 990 struct snd_ctl_elem_id id;
971 int err; 991 int err;
972 992
973 if (copy_from_user(&id, _id, sizeof(id))) 993 if (copy_from_user(&id, _id, sizeof(id)))
974 return -EFAULT; 994 return -EFAULT;
975 err = snd_ctl_remove_unlocked_id(file, &id); 995 err = snd_ctl_remove_unlocked_id(file, &id);
976 if (! err) { 996 if (! err) {
977 snd_card_t *card = file->card; 997 struct snd_card *card = file->card;
978 down_write(&card->controls_rwsem); 998 down_write(&card->controls_rwsem);
979 card->user_ctl_count--; 999 card->user_ctl_count--;
980 up_write(&card->controls_rwsem); 1000 up_write(&card->controls_rwsem);
@@ -982,7 +1002,7 @@ static int snd_ctl_elem_remove(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_
982 return err; 1002 return err;
983} 1003}
984 1004
985static int snd_ctl_subscribe_events(snd_ctl_file_t *file, int __user *ptr) 1005static int snd_ctl_subscribe_events(struct snd_ctl_file *file, int __user *ptr)
986{ 1006{
987 int subscribe; 1007 int subscribe;
988 if (get_user(subscribe, ptr)) 1008 if (get_user(subscribe, ptr))
@@ -1007,7 +1027,7 @@ static int snd_ctl_subscribe_events(snd_ctl_file_t *file, int __user *ptr)
1007/* 1027/*
1008 * change the power state 1028 * change the power state
1009 */ 1029 */
1010static int snd_ctl_set_power_state(snd_card_t *card, unsigned int power_state) 1030static int snd_ctl_set_power_state(struct snd_card *card, unsigned int power_state)
1011{ 1031{
1012 switch (power_state) { 1032 switch (power_state) {
1013 case SNDRV_CTL_POWER_D0: 1033 case SNDRV_CTL_POWER_D0:
@@ -1035,10 +1055,10 @@ static int snd_ctl_set_power_state(snd_card_t *card, unsigned int power_state)
1035 1055
1036static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 1056static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1037{ 1057{
1038 snd_ctl_file_t *ctl; 1058 struct snd_ctl_file *ctl;
1039 snd_card_t *card; 1059 struct snd_card *card;
1040 struct list_head *list; 1060 struct list_head *list;
1041 snd_kctl_ioctl_t *p; 1061 struct snd_kctl_ioctl *p;
1042 void __user *argp = (void __user *)arg; 1062 void __user *argp = (void __user *)arg;
1043 int __user *ip = argp; 1063 int __user *ip = argp;
1044 int err; 1064 int err;
@@ -1094,7 +1114,7 @@ static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg
1094 } 1114 }
1095 down_read(&snd_ioctl_rwsem); 1115 down_read(&snd_ioctl_rwsem);
1096 list_for_each(list, &snd_control_ioctls) { 1116 list_for_each(list, &snd_control_ioctls) {
1097 p = list_entry(list, snd_kctl_ioctl_t, list); 1117 p = list_entry(list, struct snd_kctl_ioctl, list);
1098 err = p->fioctl(card, ctl, cmd, arg); 1118 err = p->fioctl(card, ctl, cmd, arg);
1099 if (err != -ENOIOCTLCMD) { 1119 if (err != -ENOIOCTLCMD) {
1100 up_read(&snd_ioctl_rwsem); 1120 up_read(&snd_ioctl_rwsem);
@@ -1106,9 +1126,10 @@ static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg
1106 return -ENOTTY; 1126 return -ENOTTY;
1107} 1127}
1108 1128
1109static ssize_t snd_ctl_read(struct file *file, char __user *buffer, size_t count, loff_t * offset) 1129static ssize_t snd_ctl_read(struct file *file, char __user *buffer,
1130 size_t count, loff_t * offset)
1110{ 1131{
1111 snd_ctl_file_t *ctl; 1132 struct snd_ctl_file *ctl;
1112 int err = 0; 1133 int err = 0;
1113 ssize_t result = 0; 1134 ssize_t result = 0;
1114 1135
@@ -1116,12 +1137,12 @@ static ssize_t snd_ctl_read(struct file *file, char __user *buffer, size_t count
1116 snd_assert(ctl != NULL && ctl->card != NULL, return -ENXIO); 1137 snd_assert(ctl != NULL && ctl->card != NULL, return -ENXIO);
1117 if (!ctl->subscribed) 1138 if (!ctl->subscribed)
1118 return -EBADFD; 1139 return -EBADFD;
1119 if (count < sizeof(snd_ctl_event_t)) 1140 if (count < sizeof(struct snd_ctl_event))
1120 return -EINVAL; 1141 return -EINVAL;
1121 spin_lock_irq(&ctl->read_lock); 1142 spin_lock_irq(&ctl->read_lock);
1122 while (count >= sizeof(snd_ctl_event_t)) { 1143 while (count >= sizeof(struct snd_ctl_event)) {
1123 snd_ctl_event_t ev; 1144 struct snd_ctl_event ev;
1124 snd_kctl_event_t *kev; 1145 struct snd_kctl_event *kev;
1125 while (list_empty(&ctl->events)) { 1146 while (list_empty(&ctl->events)) {
1126 wait_queue_t wait; 1147 wait_queue_t wait;
1127 if ((file->f_flags & O_NONBLOCK) != 0 || result > 0) { 1148 if ((file->f_flags & O_NONBLOCK) != 0 || result > 0) {
@@ -1145,14 +1166,14 @@ static ssize_t snd_ctl_read(struct file *file, char __user *buffer, size_t count
1145 list_del(&kev->list); 1166 list_del(&kev->list);
1146 spin_unlock_irq(&ctl->read_lock); 1167 spin_unlock_irq(&ctl->read_lock);
1147 kfree(kev); 1168 kfree(kev);
1148 if (copy_to_user(buffer, &ev, sizeof(snd_ctl_event_t))) { 1169 if (copy_to_user(buffer, &ev, sizeof(struct snd_ctl_event))) {
1149 err = -EFAULT; 1170 err = -EFAULT;
1150 goto __end; 1171 goto __end;
1151 } 1172 }
1152 spin_lock_irq(&ctl->read_lock); 1173 spin_lock_irq(&ctl->read_lock);
1153 buffer += sizeof(snd_ctl_event_t); 1174 buffer += sizeof(struct snd_ctl_event);
1154 count -= sizeof(snd_ctl_event_t); 1175 count -= sizeof(struct snd_ctl_event);
1155 result += sizeof(snd_ctl_event_t); 1176 result += sizeof(struct snd_ctl_event);
1156 } 1177 }
1157 __end_lock: 1178 __end_lock:
1158 spin_unlock_irq(&ctl->read_lock); 1179 spin_unlock_irq(&ctl->read_lock);
@@ -1163,7 +1184,7 @@ static ssize_t snd_ctl_read(struct file *file, char __user *buffer, size_t count
1163static unsigned int snd_ctl_poll(struct file *file, poll_table * wait) 1184static unsigned int snd_ctl_poll(struct file *file, poll_table * wait)
1164{ 1185{
1165 unsigned int mask; 1186 unsigned int mask;
1166 snd_ctl_file_t *ctl; 1187 struct snd_ctl_file *ctl;
1167 1188
1168 ctl = file->private_data; 1189 ctl = file->private_data;
1169 if (!ctl->subscribed) 1190 if (!ctl->subscribed)
@@ -1183,9 +1204,9 @@ static unsigned int snd_ctl_poll(struct file *file, poll_table * wait)
1183 */ 1204 */
1184static int _snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn, struct list_head *lists) 1205static int _snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn, struct list_head *lists)
1185{ 1206{
1186 snd_kctl_ioctl_t *pn; 1207 struct snd_kctl_ioctl *pn;
1187 1208
1188 pn = kzalloc(sizeof(snd_kctl_ioctl_t), GFP_KERNEL); 1209 pn = kzalloc(sizeof(struct snd_kctl_ioctl), GFP_KERNEL);
1189 if (pn == NULL) 1210 if (pn == NULL)
1190 return -ENOMEM; 1211 return -ENOMEM;
1191 pn->fioctl = fcn; 1212 pn->fioctl = fcn;
@@ -1210,15 +1231,16 @@ int snd_ctl_register_ioctl_compat(snd_kctl_ioctl_func_t fcn)
1210/* 1231/*
1211 * de-register the device-specific control-ioctls. 1232 * de-register the device-specific control-ioctls.
1212 */ 1233 */
1213static int _snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn, struct list_head *lists) 1234static int _snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn,
1235 struct list_head *lists)
1214{ 1236{
1215 struct list_head *list; 1237 struct list_head *list;
1216 snd_kctl_ioctl_t *p; 1238 struct snd_kctl_ioctl *p;
1217 1239
1218 snd_assert(fcn != NULL, return -EINVAL); 1240 snd_assert(fcn != NULL, return -EINVAL);
1219 down_write(&snd_ioctl_rwsem); 1241 down_write(&snd_ioctl_rwsem);
1220 list_for_each(list, lists) { 1242 list_for_each(list, lists) {
1221 p = list_entry(list, snd_kctl_ioctl_t, list); 1243 p = list_entry(list, struct snd_kctl_ioctl, list);
1222 if (p->fioctl == fcn) { 1244 if (p->fioctl == fcn) {
1223 list_del(&p->list); 1245 list_del(&p->list);
1224 up_write(&snd_ioctl_rwsem); 1246 up_write(&snd_ioctl_rwsem);
@@ -1246,7 +1268,7 @@ int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn)
1246 1268
1247static int snd_ctl_fasync(int fd, struct file * file, int on) 1269static int snd_ctl_fasync(int fd, struct file * file, int on)
1248{ 1270{
1249 snd_ctl_file_t *ctl; 1271 struct snd_ctl_file *ctl;
1250 int err; 1272 int err;
1251 ctl = file->private_data; 1273 ctl = file->private_data;
1252 err = fasync_helper(fd, file, on, &ctl->fasync); 1274 err = fasync_helper(fd, file, on, &ctl->fasync);
@@ -1280,7 +1302,7 @@ static struct file_operations snd_ctl_f_ops =
1280 .fasync = snd_ctl_fasync, 1302 .fasync = snd_ctl_fasync,
1281}; 1303};
1282 1304
1283static snd_minor_t snd_ctl_reg = 1305static struct snd_minor snd_ctl_reg =
1284{ 1306{
1285 .comment = "ctl", 1307 .comment = "ctl",
1286 .f_ops = &snd_ctl_f_ops, 1308 .f_ops = &snd_ctl_f_ops,
@@ -1289,9 +1311,9 @@ static snd_minor_t snd_ctl_reg =
1289/* 1311/*
1290 * registration of the control device 1312 * registration of the control device
1291 */ 1313 */
1292static int snd_ctl_dev_register(snd_device_t *device) 1314static int snd_ctl_dev_register(struct snd_device *device)
1293{ 1315{
1294 snd_card_t *card = device->device_data; 1316 struct snd_card *card = device->device_data;
1295 int err, cardnum; 1317 int err, cardnum;
1296 char name[16]; 1318 char name[16];
1297 1319
@@ -1308,11 +1330,11 @@ static int snd_ctl_dev_register(snd_device_t *device)
1308/* 1330/*
1309 * disconnection of the control device 1331 * disconnection of the control device
1310 */ 1332 */
1311static int snd_ctl_dev_disconnect(snd_device_t *device) 1333static int snd_ctl_dev_disconnect(struct snd_device *device)
1312{ 1334{
1313 snd_card_t *card = device->device_data; 1335 struct snd_card *card = device->device_data;
1314 struct list_head *flist; 1336 struct list_head *flist;
1315 snd_ctl_file_t *ctl; 1337 struct snd_ctl_file *ctl;
1316 1338
1317 down_read(&card->controls_rwsem); 1339 down_read(&card->controls_rwsem);
1318 list_for_each(flist, &card->ctl_files) { 1340 list_for_each(flist, &card->ctl_files) {
@@ -1327,10 +1349,10 @@ static int snd_ctl_dev_disconnect(snd_device_t *device)
1327/* 1349/*
1328 * free all controls 1350 * free all controls
1329 */ 1351 */
1330static int snd_ctl_dev_free(snd_device_t *device) 1352static int snd_ctl_dev_free(struct snd_device *device)
1331{ 1353{
1332 snd_card_t *card = device->device_data; 1354 struct snd_card *card = device->device_data;
1333 snd_kcontrol_t *control; 1355 struct snd_kcontrol *control;
1334 1356
1335 down_write(&card->controls_rwsem); 1357 down_write(&card->controls_rwsem);
1336 while (!list_empty(&card->controls)) { 1358 while (!list_empty(&card->controls)) {
@@ -1344,9 +1366,9 @@ static int snd_ctl_dev_free(snd_device_t *device)
1344/* 1366/*
1345 * de-registration of the control device 1367 * de-registration of the control device
1346 */ 1368 */
1347static int snd_ctl_dev_unregister(snd_device_t *device) 1369static int snd_ctl_dev_unregister(struct snd_device *device)
1348{ 1370{
1349 snd_card_t *card = device->device_data; 1371 struct snd_card *card = device->device_data;
1350 int err, cardnum; 1372 int err, cardnum;
1351 1373
1352 snd_assert(card != NULL, return -ENXIO); 1374 snd_assert(card != NULL, return -ENXIO);
@@ -1361,9 +1383,9 @@ static int snd_ctl_dev_unregister(snd_device_t *device)
1361 * create control core: 1383 * create control core:
1362 * called from init.c 1384 * called from init.c
1363 */ 1385 */
1364int snd_ctl_create(snd_card_t *card) 1386int snd_ctl_create(struct snd_card *card)
1365{ 1387{
1366 static snd_device_ops_t ops = { 1388 static struct snd_device_ops ops = {
1367 .dev_free = snd_ctl_dev_free, 1389 .dev_free = snd_ctl_dev_free,
1368 .dev_register = snd_ctl_dev_register, 1390 .dev_register = snd_ctl_dev_register,
1369 .dev_disconnect = snd_ctl_dev_disconnect, 1391 .dev_disconnect = snd_ctl_dev_disconnect,
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
25struct sndrv_ctl_elem_list32 { 25struct 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
34static int snd_ctl_elem_list_compat(snd_card_t *card, struct sndrv_ctl_elem_list32 __user *data32) 34static 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
63struct sndrv_ctl_elem_info32 { 64struct 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
90static int snd_ctl_elem_info_compat(snd_ctl_file_t *ctl, struct sndrv_ctl_elem_info32 __user *data32) 91static 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 */
149struct sndrv_ctl_elem_value32 { 151struct 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 */
164static int get_ctl_type(snd_card_t *card, snd_ctl_elem_id_t *id, int *countp) 166static 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
202static int copy_ctl_value_from_user(snd_card_t *card, 205static 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 */
245static int copy_ctl_value_to_user(struct sndrv_ctl_elem_value32 __user *data32, 248static 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
268static int snd_ctl_elem_read_user_compat(snd_card_t *card, 271static 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
288static int snd_ctl_elem_write_user_compat(snd_ctl_file_t *file, 291static 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 */
309static int snd_ctl_elem_add_compat(snd_ctl_file_t *file, 312static 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
357enum { 360enum {
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
366static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) 369static 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) {