diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 08:04:02 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:17:52 -0500 |
commit | c7e0b5bf9fff1b726495081447c107a2333fb82c (patch) | |
tree | f4d9ec9a6446f8e2afde4c94e10a39f2b86a0bc9 /sound/core/seq/seq_device.c | |
parent | 6ac77bc180fbd985988015020c2e2347e802959d (diff) |
[ALSA] Remove xxx_t typedefs: Sequencer
Modules: ALSA sequencer
Remove xxx_t typedefs from the core sequencer codes.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/seq/seq_device.c')
-rw-r--r-- | sound/core/seq/seq_device.c | 120 |
1 files changed, 62 insertions, 58 deletions
diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c index 252b52731003..3f935a18b5e7 100644 --- a/sound/core/seq/seq_device.c +++ b/sound/core/seq/seq_device.c | |||
@@ -50,11 +50,6 @@ MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); | |||
50 | MODULE_DESCRIPTION("ALSA sequencer device management"); | 50 | MODULE_DESCRIPTION("ALSA sequencer device management"); |
51 | MODULE_LICENSE("GPL"); | 51 | MODULE_LICENSE("GPL"); |
52 | 52 | ||
53 | /* | ||
54 | * driver list | ||
55 | */ | ||
56 | typedef struct ops_list ops_list_t; | ||
57 | |||
58 | /* driver state */ | 53 | /* driver state */ |
59 | #define DRIVER_EMPTY 0 | 54 | #define DRIVER_EMPTY 0 |
60 | #define DRIVER_LOADED (1<<0) | 55 | #define DRIVER_LOADED (1<<0) |
@@ -68,7 +63,7 @@ struct ops_list { | |||
68 | int argsize; /* argument size */ | 63 | int argsize; /* argument size */ |
69 | 64 | ||
70 | /* operators */ | 65 | /* operators */ |
71 | snd_seq_dev_ops_t ops; | 66 | struct snd_seq_dev_ops ops; |
72 | 67 | ||
73 | /* registred devices */ | 68 | /* registred devices */ |
74 | struct list_head dev_list; /* list of devices */ | 69 | struct list_head dev_list; /* list of devices */ |
@@ -83,35 +78,36 @@ struct ops_list { | |||
83 | static LIST_HEAD(opslist); | 78 | static LIST_HEAD(opslist); |
84 | static int num_ops; | 79 | static int num_ops; |
85 | static DECLARE_MUTEX(ops_mutex); | 80 | static DECLARE_MUTEX(ops_mutex); |
86 | static snd_info_entry_t *info_entry = NULL; | 81 | static struct snd_info_entry *info_entry = NULL; |
87 | 82 | ||
88 | /* | 83 | /* |
89 | * prototypes | 84 | * prototypes |
90 | */ | 85 | */ |
91 | static int snd_seq_device_free(snd_seq_device_t *dev); | 86 | static int snd_seq_device_free(struct snd_seq_device *dev); |
92 | static int snd_seq_device_dev_free(snd_device_t *device); | 87 | static int snd_seq_device_dev_free(struct snd_device *device); |
93 | static int snd_seq_device_dev_register(snd_device_t *device); | 88 | static int snd_seq_device_dev_register(struct snd_device *device); |
94 | static int snd_seq_device_dev_disconnect(snd_device_t *device); | 89 | static int snd_seq_device_dev_disconnect(struct snd_device *device); |
95 | static int snd_seq_device_dev_unregister(snd_device_t *device); | 90 | static int snd_seq_device_dev_unregister(struct snd_device *device); |
96 | 91 | ||
97 | static int init_device(snd_seq_device_t *dev, ops_list_t *ops); | 92 | static int init_device(struct snd_seq_device *dev, struct ops_list *ops); |
98 | static int free_device(snd_seq_device_t *dev, ops_list_t *ops); | 93 | static int free_device(struct snd_seq_device *dev, struct ops_list *ops); |
99 | static ops_list_t *find_driver(char *id, int create_if_empty); | 94 | static struct ops_list *find_driver(char *id, int create_if_empty); |
100 | static ops_list_t *create_driver(char *id); | 95 | static struct ops_list *create_driver(char *id); |
101 | static void unlock_driver(ops_list_t *ops); | 96 | static void unlock_driver(struct ops_list *ops); |
102 | static void remove_drivers(void); | 97 | static void remove_drivers(void); |
103 | 98 | ||
104 | /* | 99 | /* |
105 | * show all drivers and their status | 100 | * show all drivers and their status |
106 | */ | 101 | */ |
107 | 102 | ||
108 | static void snd_seq_device_info(snd_info_entry_t *entry, snd_info_buffer_t * buffer) | 103 | static void snd_seq_device_info(struct snd_info_entry *entry, |
104 | struct snd_info_buffer *buffer) | ||
109 | { | 105 | { |
110 | struct list_head *head; | 106 | struct list_head *head; |
111 | 107 | ||
112 | down(&ops_mutex); | 108 | down(&ops_mutex); |
113 | list_for_each(head, &opslist) { | 109 | list_for_each(head, &opslist) { |
114 | ops_list_t *ops = list_entry(head, ops_list_t, list); | 110 | struct ops_list *ops = list_entry(head, struct ops_list, list); |
115 | snd_iprintf(buffer, "snd-%s%s%s%s,%d\n", | 111 | snd_iprintf(buffer, "snd-%s%s%s%s,%d\n", |
116 | ops->id, | 112 | ops->id, |
117 | ops->driver & DRIVER_LOADED ? ",loaded" : (ops->driver == DRIVER_EMPTY ? ",empty" : ""), | 113 | ops->driver & DRIVER_LOADED ? ",loaded" : (ops->driver == DRIVER_EMPTY ? ",empty" : ""), |
@@ -156,7 +152,7 @@ void snd_seq_device_load_drivers(void) | |||
156 | 152 | ||
157 | down(&ops_mutex); | 153 | down(&ops_mutex); |
158 | list_for_each(head, &opslist) { | 154 | list_for_each(head, &opslist) { |
159 | ops_list_t *ops = list_entry(head, ops_list_t, list); | 155 | struct ops_list *ops = list_entry(head, struct ops_list, list); |
160 | if (! (ops->driver & DRIVER_LOADED) && | 156 | if (! (ops->driver & DRIVER_LOADED) && |
161 | ! (ops->driver & DRIVER_REQUESTED)) { | 157 | ! (ops->driver & DRIVER_REQUESTED)) { |
162 | ops->used++; | 158 | ops->used++; |
@@ -178,13 +174,13 @@ void snd_seq_device_load_drivers(void) | |||
178 | * id = id of driver | 174 | * id = id of driver |
179 | * result = return pointer (NULL allowed if unnecessary) | 175 | * result = return pointer (NULL allowed if unnecessary) |
180 | */ | 176 | */ |
181 | int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize, | 177 | int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize, |
182 | snd_seq_device_t **result) | 178 | struct snd_seq_device **result) |
183 | { | 179 | { |
184 | snd_seq_device_t *dev; | 180 | struct snd_seq_device *dev; |
185 | ops_list_t *ops; | 181 | struct ops_list *ops; |
186 | int err; | 182 | int err; |
187 | static snd_device_ops_t dops = { | 183 | static struct snd_device_ops dops = { |
188 | .dev_free = snd_seq_device_dev_free, | 184 | .dev_free = snd_seq_device_dev_free, |
189 | .dev_register = snd_seq_device_dev_register, | 185 | .dev_register = snd_seq_device_dev_register, |
190 | .dev_disconnect = snd_seq_device_dev_disconnect, | 186 | .dev_disconnect = snd_seq_device_dev_disconnect, |
@@ -235,9 +231,9 @@ int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize, | |||
235 | /* | 231 | /* |
236 | * free the existing device | 232 | * free the existing device |
237 | */ | 233 | */ |
238 | static int snd_seq_device_free(snd_seq_device_t *dev) | 234 | static int snd_seq_device_free(struct snd_seq_device *dev) |
239 | { | 235 | { |
240 | ops_list_t *ops; | 236 | struct ops_list *ops; |
241 | 237 | ||
242 | snd_assert(dev != NULL, return -EINVAL); | 238 | snd_assert(dev != NULL, return -EINVAL); |
243 | 239 | ||
@@ -261,19 +257,19 @@ static int snd_seq_device_free(snd_seq_device_t *dev) | |||
261 | return 0; | 257 | return 0; |
262 | } | 258 | } |
263 | 259 | ||
264 | static int snd_seq_device_dev_free(snd_device_t *device) | 260 | static int snd_seq_device_dev_free(struct snd_device *device) |
265 | { | 261 | { |
266 | snd_seq_device_t *dev = device->device_data; | 262 | struct snd_seq_device *dev = device->device_data; |
267 | return snd_seq_device_free(dev); | 263 | return snd_seq_device_free(dev); |
268 | } | 264 | } |
269 | 265 | ||
270 | /* | 266 | /* |
271 | * register the device | 267 | * register the device |
272 | */ | 268 | */ |
273 | static int snd_seq_device_dev_register(snd_device_t *device) | 269 | static int snd_seq_device_dev_register(struct snd_device *device) |
274 | { | 270 | { |
275 | snd_seq_device_t *dev = device->device_data; | 271 | struct snd_seq_device *dev = device->device_data; |
276 | ops_list_t *ops; | 272 | struct ops_list *ops; |
277 | 273 | ||
278 | ops = find_driver(dev->id, 0); | 274 | ops = find_driver(dev->id, 0); |
279 | if (ops == NULL) | 275 | if (ops == NULL) |
@@ -292,10 +288,10 @@ static int snd_seq_device_dev_register(snd_device_t *device) | |||
292 | /* | 288 | /* |
293 | * disconnect the device | 289 | * disconnect the device |
294 | */ | 290 | */ |
295 | static int snd_seq_device_dev_disconnect(snd_device_t *device) | 291 | static int snd_seq_device_dev_disconnect(struct snd_device *device) |
296 | { | 292 | { |
297 | snd_seq_device_t *dev = device->device_data; | 293 | struct snd_seq_device *dev = device->device_data; |
298 | ops_list_t *ops; | 294 | struct ops_list *ops; |
299 | 295 | ||
300 | ops = find_driver(dev->id, 0); | 296 | ops = find_driver(dev->id, 0); |
301 | if (ops == NULL) | 297 | if (ops == NULL) |
@@ -310,9 +306,9 @@ static int snd_seq_device_dev_disconnect(snd_device_t *device) | |||
310 | /* | 306 | /* |
311 | * unregister the existing device | 307 | * unregister the existing device |
312 | */ | 308 | */ |
313 | static int snd_seq_device_dev_unregister(snd_device_t *device) | 309 | static int snd_seq_device_dev_unregister(struct snd_device *device) |
314 | { | 310 | { |
315 | snd_seq_device_t *dev = device->device_data; | 311 | struct snd_seq_device *dev = device->device_data; |
316 | return snd_seq_device_free(dev); | 312 | return snd_seq_device_free(dev); |
317 | } | 313 | } |
318 | 314 | ||
@@ -321,10 +317,11 @@ static int snd_seq_device_dev_unregister(snd_device_t *device) | |||
321 | * id = driver id | 317 | * id = driver id |
322 | * entry = driver operators - duplicated to each instance | 318 | * entry = driver operators - duplicated to each instance |
323 | */ | 319 | */ |
324 | int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsize) | 320 | int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, |
321 | int argsize) | ||
325 | { | 322 | { |
326 | struct list_head *head; | 323 | struct list_head *head; |
327 | ops_list_t *ops; | 324 | struct ops_list *ops; |
328 | 325 | ||
329 | if (id == NULL || entry == NULL || | 326 | if (id == NULL || entry == NULL || |
330 | entry->init_device == NULL || entry->free_device == NULL) | 327 | entry->init_device == NULL || entry->free_device == NULL) |
@@ -351,7 +348,7 @@ int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsi | |||
351 | 348 | ||
352 | /* initialize existing devices if necessary */ | 349 | /* initialize existing devices if necessary */ |
353 | list_for_each(head, &ops->dev_list) { | 350 | list_for_each(head, &ops->dev_list) { |
354 | snd_seq_device_t *dev = list_entry(head, snd_seq_device_t, list); | 351 | struct snd_seq_device *dev = list_entry(head, struct snd_seq_device, list); |
355 | init_device(dev, ops); | 352 | init_device(dev, ops); |
356 | } | 353 | } |
357 | up(&ops->reg_mutex); | 354 | up(&ops->reg_mutex); |
@@ -366,9 +363,9 @@ int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsi | |||
366 | /* | 363 | /* |
367 | * create driver record | 364 | * create driver record |
368 | */ | 365 | */ |
369 | static ops_list_t * create_driver(char *id) | 366 | static struct ops_list * create_driver(char *id) |
370 | { | 367 | { |
371 | ops_list_t *ops; | 368 | struct ops_list *ops; |
372 | 369 | ||
373 | ops = kmalloc(sizeof(*ops), GFP_KERNEL); | 370 | ops = kmalloc(sizeof(*ops), GFP_KERNEL); |
374 | if (ops == NULL) | 371 | if (ops == NULL) |
@@ -399,14 +396,15 @@ static ops_list_t * create_driver(char *id) | |||
399 | int snd_seq_device_unregister_driver(char *id) | 396 | int snd_seq_device_unregister_driver(char *id) |
400 | { | 397 | { |
401 | struct list_head *head; | 398 | struct list_head *head; |
402 | ops_list_t *ops; | 399 | struct ops_list *ops; |
403 | 400 | ||
404 | ops = find_driver(id, 0); | 401 | ops = find_driver(id, 0); |
405 | if (ops == NULL) | 402 | if (ops == NULL) |
406 | return -ENXIO; | 403 | return -ENXIO; |
407 | if (! (ops->driver & DRIVER_LOADED) || | 404 | if (! (ops->driver & DRIVER_LOADED) || |
408 | (ops->driver & DRIVER_LOCKED)) { | 405 | (ops->driver & DRIVER_LOCKED)) { |
409 | snd_printk(KERN_ERR "driver_unregister: cannot unload driver '%s': status=%x\n", id, ops->driver); | 406 | snd_printk(KERN_ERR "driver_unregister: cannot unload driver '%s': status=%x\n", |
407 | id, ops->driver); | ||
410 | unlock_driver(ops); | 408 | unlock_driver(ops); |
411 | return -EBUSY; | 409 | return -EBUSY; |
412 | } | 410 | } |
@@ -415,13 +413,14 @@ int snd_seq_device_unregister_driver(char *id) | |||
415 | down(&ops->reg_mutex); | 413 | down(&ops->reg_mutex); |
416 | ops->driver |= DRIVER_LOCKED; /* do not remove this driver recursively */ | 414 | ops->driver |= DRIVER_LOCKED; /* do not remove this driver recursively */ |
417 | list_for_each(head, &ops->dev_list) { | 415 | list_for_each(head, &ops->dev_list) { |
418 | snd_seq_device_t *dev = list_entry(head, snd_seq_device_t, list); | 416 | struct snd_seq_device *dev = list_entry(head, struct snd_seq_device, list); |
419 | free_device(dev, ops); | 417 | free_device(dev, ops); |
420 | } | 418 | } |
421 | 419 | ||
422 | ops->driver = 0; | 420 | ops->driver = 0; |
423 | if (ops->num_init_devices > 0) | 421 | if (ops->num_init_devices > 0) |
424 | snd_printk(KERN_ERR "free_driver: init_devices > 0!! (%d)\n", ops->num_init_devices); | 422 | snd_printk(KERN_ERR "free_driver: init_devices > 0!! (%d)\n", |
423 | ops->num_init_devices); | ||
425 | up(&ops->reg_mutex); | 424 | up(&ops->reg_mutex); |
426 | 425 | ||
427 | unlock_driver(ops); | 426 | unlock_driver(ops); |
@@ -443,7 +442,7 @@ static void remove_drivers(void) | |||
443 | down(&ops_mutex); | 442 | down(&ops_mutex); |
444 | head = opslist.next; | 443 | head = opslist.next; |
445 | while (head != &opslist) { | 444 | while (head != &opslist) { |
446 | ops_list_t *ops = list_entry(head, ops_list_t, list); | 445 | struct ops_list *ops = list_entry(head, struct ops_list, list); |
447 | if (! (ops->driver & DRIVER_LOADED) && | 446 | if (! (ops->driver & DRIVER_LOADED) && |
448 | ops->used == 0 && ops->num_devices == 0) { | 447 | ops->used == 0 && ops->num_devices == 0) { |
449 | head = head->next; | 448 | head = head->next; |
@@ -459,21 +458,23 @@ static void remove_drivers(void) | |||
459 | /* | 458 | /* |
460 | * initialize the device - call init_device operator | 459 | * initialize the device - call init_device operator |
461 | */ | 460 | */ |
462 | static int init_device(snd_seq_device_t *dev, ops_list_t *ops) | 461 | static int init_device(struct snd_seq_device *dev, struct ops_list *ops) |
463 | { | 462 | { |
464 | if (! (ops->driver & DRIVER_LOADED)) | 463 | if (! (ops->driver & DRIVER_LOADED)) |
465 | return 0; /* driver is not loaded yet */ | 464 | return 0; /* driver is not loaded yet */ |
466 | if (dev->status != SNDRV_SEQ_DEVICE_FREE) | 465 | if (dev->status != SNDRV_SEQ_DEVICE_FREE) |
467 | return 0; /* already initialized */ | 466 | return 0; /* already initialized */ |
468 | if (ops->argsize != dev->argsize) { | 467 | if (ops->argsize != dev->argsize) { |
469 | snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n", dev->name, ops->id, ops->argsize, dev->argsize); | 468 | snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n", |
469 | dev->name, ops->id, ops->argsize, dev->argsize); | ||
470 | return -EINVAL; | 470 | return -EINVAL; |
471 | } | 471 | } |
472 | if (ops->ops.init_device(dev) >= 0) { | 472 | if (ops->ops.init_device(dev) >= 0) { |
473 | dev->status = SNDRV_SEQ_DEVICE_REGISTERED; | 473 | dev->status = SNDRV_SEQ_DEVICE_REGISTERED; |
474 | ops->num_init_devices++; | 474 | ops->num_init_devices++; |
475 | } else { | 475 | } else { |
476 | snd_printk(KERN_ERR "init_device failed: %s: %s\n", dev->name, dev->id); | 476 | snd_printk(KERN_ERR "init_device failed: %s: %s\n", |
477 | dev->name, dev->id); | ||
477 | } | 478 | } |
478 | 479 | ||
479 | return 0; | 480 | return 0; |
@@ -482,7 +483,7 @@ static int init_device(snd_seq_device_t *dev, ops_list_t *ops) | |||
482 | /* | 483 | /* |
483 | * release the device - call free_device operator | 484 | * release the device - call free_device operator |
484 | */ | 485 | */ |
485 | static int free_device(snd_seq_device_t *dev, ops_list_t *ops) | 486 | static int free_device(struct snd_seq_device *dev, struct ops_list *ops) |
486 | { | 487 | { |
487 | int result; | 488 | int result; |
488 | 489 | ||
@@ -491,7 +492,8 @@ static int free_device(snd_seq_device_t *dev, ops_list_t *ops) | |||
491 | if (dev->status != SNDRV_SEQ_DEVICE_REGISTERED) | 492 | if (dev->status != SNDRV_SEQ_DEVICE_REGISTERED) |
492 | return 0; /* not registered */ | 493 | return 0; /* not registered */ |
493 | if (ops->argsize != dev->argsize) { | 494 | if (ops->argsize != dev->argsize) { |
494 | snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n", dev->name, ops->id, ops->argsize, dev->argsize); | 495 | snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n", |
496 | dev->name, ops->id, ops->argsize, dev->argsize); | ||
495 | return -EINVAL; | 497 | return -EINVAL; |
496 | } | 498 | } |
497 | if ((result = ops->ops.free_device(dev)) >= 0 || result == -ENXIO) { | 499 | if ((result = ops->ops.free_device(dev)) >= 0 || result == -ENXIO) { |
@@ -499,7 +501,8 @@ static int free_device(snd_seq_device_t *dev, ops_list_t *ops) | |||
499 | dev->driver_data = NULL; | 501 | dev->driver_data = NULL; |
500 | ops->num_init_devices--; | 502 | ops->num_init_devices--; |
501 | } else { | 503 | } else { |
502 | snd_printk(KERN_ERR "free_device failed: %s: %s\n", dev->name, dev->id); | 504 | snd_printk(KERN_ERR "free_device failed: %s: %s\n", |
505 | dev->name, dev->id); | ||
503 | } | 506 | } |
504 | 507 | ||
505 | return 0; | 508 | return 0; |
@@ -508,13 +511,13 @@ static int free_device(snd_seq_device_t *dev, ops_list_t *ops) | |||
508 | /* | 511 | /* |
509 | * find the matching driver with given id | 512 | * find the matching driver with given id |
510 | */ | 513 | */ |
511 | static ops_list_t * find_driver(char *id, int create_if_empty) | 514 | static struct ops_list * find_driver(char *id, int create_if_empty) |
512 | { | 515 | { |
513 | struct list_head *head; | 516 | struct list_head *head; |
514 | 517 | ||
515 | down(&ops_mutex); | 518 | down(&ops_mutex); |
516 | list_for_each(head, &opslist) { | 519 | list_for_each(head, &opslist) { |
517 | ops_list_t *ops = list_entry(head, ops_list_t, list); | 520 | struct ops_list *ops = list_entry(head, struct ops_list, list); |
518 | if (strcmp(ops->id, id) == 0) { | 521 | if (strcmp(ops->id, id) == 0) { |
519 | ops->used++; | 522 | ops->used++; |
520 | up(&ops_mutex); | 523 | up(&ops_mutex); |
@@ -527,7 +530,7 @@ static ops_list_t * find_driver(char *id, int create_if_empty) | |||
527 | return NULL; | 530 | return NULL; |
528 | } | 531 | } |
529 | 532 | ||
530 | static void unlock_driver(ops_list_t *ops) | 533 | static void unlock_driver(struct ops_list *ops) |
531 | { | 534 | { |
532 | down(&ops_mutex); | 535 | down(&ops_mutex); |
533 | ops->used--; | 536 | ops->used--; |
@@ -541,7 +544,8 @@ static void unlock_driver(ops_list_t *ops) | |||
541 | 544 | ||
542 | static int __init alsa_seq_device_init(void) | 545 | static int __init alsa_seq_device_init(void) |
543 | { | 546 | { |
544 | info_entry = snd_info_create_module_entry(THIS_MODULE, "drivers", snd_seq_root); | 547 | info_entry = snd_info_create_module_entry(THIS_MODULE, "drivers", |
548 | snd_seq_root); | ||
545 | if (info_entry == NULL) | 549 | if (info_entry == NULL) |
546 | return -ENOMEM; | 550 | return -ENOMEM; |
547 | info_entry->content = SNDRV_INFO_CONTENT_TEXT; | 551 | info_entry->content = SNDRV_INFO_CONTENT_TEXT; |