aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/init.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 07:51:18 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:17:30 -0500
commit512bbd6a85230f16389f0dd51925472e72fc8a91 (patch)
treef563f496c46355ed6ed1bca4ab876e984eb69a84 /sound/core/init.c
parent3f05f868f1112b970e7fb9c0aa42cc99370098fe (diff)
[ALSA] Remove xxx_t typedefs: Core component
Modules: ALSA Core Remove xxx_t typedefs from the core component. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/init.c')
-rw-r--r--sound/core/init.c86
1 files changed, 44 insertions, 42 deletions
diff --git a/sound/core/init.c b/sound/core/init.c
index 33813f92ab52..dca64d199cbe 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -40,14 +40,15 @@ struct snd_shutdown_f_ops {
40}; 40};
41 41
42unsigned int snd_cards_lock = 0; /* locked for registering/using */ 42unsigned int snd_cards_lock = 0; /* locked for registering/using */
43snd_card_t *snd_cards[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = NULL}; 43struct snd_card *snd_cards[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = NULL};
44DEFINE_RWLOCK(snd_card_rwlock); 44DEFINE_RWLOCK(snd_card_rwlock);
45 45
46#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) 46#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
47int (*snd_mixer_oss_notify_callback)(snd_card_t *card, int free_flag); 47int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int free_flag);
48#endif 48#endif
49 49
50static void snd_card_id_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer) 50static void snd_card_id_read(struct snd_info_entry *entry,
51 struct snd_info_buffer *buffer)
51{ 52{
52 snd_iprintf(buffer, "%s\n", entry->card->id); 53 snd_iprintf(buffer, "%s\n", entry->card->id);
53} 54}
@@ -63,13 +64,13 @@ static void snd_card_free_thread(void * __card);
63 * 64 *
64 * Creates and initializes a soundcard structure. 65 * Creates and initializes a soundcard structure.
65 * 66 *
66 * Returns kmallocated snd_card_t structure. Creates the ALSA control interface 67 * Returns kmallocated snd_card structure. Creates the ALSA control interface
67 * (which is blocked until snd_card_register function is called). 68 * (which is blocked until snd_card_register function is called).
68 */ 69 */
69snd_card_t *snd_card_new(int idx, const char *xid, 70struct snd_card *snd_card_new(int idx, const char *xid,
70 struct module *module, int extra_size) 71 struct module *module, int extra_size)
71{ 72{
72 snd_card_t *card; 73 struct snd_card *card;
73 int err; 74 int err;
74 75
75 if (extra_size < 0) 76 if (extra_size < 0)
@@ -132,7 +133,7 @@ snd_card_t *snd_card_new(int idx, const char *xid,
132 goto __error_ctl; 133 goto __error_ctl;
133 } 134 }
134 if (extra_size > 0) 135 if (extra_size > 0)
135 card->private_data = (char *)card + sizeof(snd_card_t); 136 card->private_data = (char *)card + sizeof(struct snd_card);
136 return card; 137 return card;
137 138
138 __error_ctl: 139 __error_ctl:
@@ -158,7 +159,7 @@ static unsigned int snd_disconnect_poll(struct file * file, poll_table * wait)
158 * Note: The current implementation replaces all active file->f_op with special 159 * Note: The current implementation replaces all active file->f_op with special
159 * dummy file operations (they do nothing except release). 160 * dummy file operations (they do nothing except release).
160 */ 161 */
161int snd_card_disconnect(snd_card_t * card) 162int snd_card_disconnect(struct snd_card *card)
162{ 163{
163 struct snd_monitor_file *mfile; 164 struct snd_monitor_file *mfile;
164 struct file *file; 165 struct file *file;
@@ -229,7 +230,7 @@ int snd_card_disconnect(snd_card_t * card)
229} 230}
230 231
231#ifdef CONFIG_SND_GENERIC_DRIVER 232#ifdef CONFIG_SND_GENERIC_DRIVER
232static void snd_generic_device_unregister(snd_card_t *card); 233static void snd_generic_device_unregister(struct snd_card *card);
233#else 234#else
234#define snd_generic_device_unregister(x) /*NOP*/ 235#define snd_generic_device_unregister(x) /*NOP*/
235#endif 236#endif
@@ -245,7 +246,7 @@ static void snd_generic_device_unregister(snd_card_t *card);
245 * Returns zero. Frees all associated devices and frees the control 246 * Returns zero. Frees all associated devices and frees the control
246 * interface associated to given soundcard. 247 * interface associated to given soundcard.
247 */ 248 */
248int snd_card_free(snd_card_t * card) 249int snd_card_free(struct snd_card *card)
249{ 250{
250 struct snd_shutdown_f_ops *s_f_ops; 251 struct snd_shutdown_f_ops *s_f_ops;
251 252
@@ -300,7 +301,7 @@ int snd_card_free(snd_card_t * card)
300 301
301static void snd_card_free_thread(void * __card) 302static void snd_card_free_thread(void * __card)
302{ 303{
303 snd_card_t *card = __card; 304 struct snd_card *card = __card;
304 struct module * module = card->module; 305 struct module * module = card->module;
305 306
306 if (!try_module_get(module)) { 307 if (!try_module_get(module)) {
@@ -327,7 +328,7 @@ static void snd_card_free_thread(void * __card)
327 * 328 *
328 * Returns - zero otherwise a negative error code if the start of thread failed. 329 * Returns - zero otherwise a negative error code if the start of thread failed.
329 */ 330 */
330int snd_card_free_in_thread(snd_card_t * card) 331int snd_card_free_in_thread(struct snd_card *card)
331{ 332{
332 if (card->files == NULL) { 333 if (card->files == NULL) {
333 snd_card_free(card); 334 snd_card_free(card);
@@ -343,7 +344,7 @@ int snd_card_free_in_thread(snd_card_t * card)
343 return -EFAULT; 344 return -EFAULT;
344} 345}
345 346
346static void choose_default_id(snd_card_t * card) 347static void choose_default_id(struct snd_card *card)
347{ 348{
348 int i, len, idx_flag = 0, loops = 8; 349 int i, len, idx_flag = 0, loops = 8;
349 char *id, *spos; 350 char *id, *spos;
@@ -415,10 +416,10 @@ static void choose_default_id(snd_card_t * card)
415 * 416 *
416 * Returns zero otherwise a negative error code if the registrain failed. 417 * Returns zero otherwise a negative error code if the registrain failed.
417 */ 418 */
418int snd_card_register(snd_card_t * card) 419int snd_card_register(struct snd_card *card)
419{ 420{
420 int err; 421 int err;
421 snd_info_entry_t *entry; 422 struct snd_info_entry *entry;
422 423
423 snd_assert(card != NULL, return -EINVAL); 424 snd_assert(card != NULL, return -EINVAL);
424 if ((err = snd_device_register_all(card)) < 0) 425 if ((err = snd_device_register_all(card)) < 0)
@@ -456,12 +457,12 @@ int snd_card_register(snd_card_t * card)
456 return 0; 457 return 0;
457} 458}
458 459
459static snd_info_entry_t *snd_card_info_entry = NULL; 460static struct snd_info_entry *snd_card_info_entry = NULL;
460 461
461static void snd_card_info_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer) 462static void snd_card_info_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
462{ 463{
463 int idx, count; 464 int idx, count;
464 snd_card_t *card; 465 struct snd_card *card;
465 466
466 for (idx = count = 0; idx < SNDRV_CARDS; idx++) { 467 for (idx = count = 0; idx < SNDRV_CARDS; idx++) {
467 read_lock(&snd_card_rwlock); 468 read_lock(&snd_card_rwlock);
@@ -483,10 +484,10 @@ static void snd_card_info_read(snd_info_entry_t *entry, snd_info_buffer_t * buff
483 484
484#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS) 485#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
485 486
486void snd_card_info_read_oss(snd_info_buffer_t * buffer) 487void snd_card_info_read_oss(struct snd_info_buffer *buffer)
487{ 488{
488 int idx, count; 489 int idx, count;
489 snd_card_t *card; 490 struct snd_card *card;
490 491
491 for (idx = count = 0; idx < SNDRV_CARDS; idx++) { 492 for (idx = count = 0; idx < SNDRV_CARDS; idx++) {
492 read_lock(&snd_card_rwlock); 493 read_lock(&snd_card_rwlock);
@@ -504,11 +505,12 @@ void snd_card_info_read_oss(snd_info_buffer_t * buffer)
504#endif 505#endif
505 506
506#ifdef MODULE 507#ifdef MODULE
507static snd_info_entry_t *snd_card_module_info_entry; 508static struct snd_info_entry *snd_card_module_info_entry;
508static void snd_card_module_info_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer) 509static void snd_card_module_info_read(struct snd_info_entry *entry,
510 struct snd_info_buffer *buffer)
509{ 511{
510 int idx; 512 int idx;
511 snd_card_t *card; 513 struct snd_card *card;
512 514
513 for (idx = 0; idx < SNDRV_CARDS; idx++) { 515 for (idx = 0; idx < SNDRV_CARDS; idx++) {
514 read_lock(&snd_card_rwlock); 516 read_lock(&snd_card_rwlock);
@@ -521,7 +523,7 @@ static void snd_card_module_info_read(snd_info_entry_t *entry, snd_info_buffer_t
521 523
522int __init snd_card_info_init(void) 524int __init snd_card_info_init(void)
523{ 525{
524 snd_info_entry_t *entry; 526 struct snd_info_entry *entry;
525 527
526 entry = snd_info_create_module_entry(THIS_MODULE, "cards", NULL); 528 entry = snd_info_create_module_entry(THIS_MODULE, "cards", NULL);
527 if (! entry) 529 if (! entry)
@@ -571,7 +573,7 @@ int __exit snd_card_info_done(void)
571 * Returns zero otherwise a negative error code. 573 * Returns zero otherwise a negative error code.
572 */ 574 */
573 575
574int snd_component_add(snd_card_t *card, const char *component) 576int snd_component_add(struct snd_card *card, const char *component)
575{ 577{
576 char *ptr; 578 char *ptr;
577 int len = strlen(component); 579 int len = strlen(component);
@@ -602,7 +604,7 @@ int snd_component_add(snd_card_t *card, const char *component)
602 * 604 *
603 * Returns zero or a negative error code. 605 * Returns zero or a negative error code.
604 */ 606 */
605int snd_card_file_add(snd_card_t *card, struct file *file) 607int snd_card_file_add(struct snd_card *card, struct file *file)
606{ 608{
607 struct snd_monitor_file *mfile; 609 struct snd_monitor_file *mfile;
608 610
@@ -636,7 +638,7 @@ int snd_card_file_add(snd_card_t *card, struct file *file)
636 * 638 *
637 * Returns zero or a negative error code. 639 * Returns zero or a negative error code.
638 */ 640 */
639int snd_card_file_remove(snd_card_t *card, struct file *file) 641int snd_card_file_remove(struct snd_card *card, struct file *file)
640{ 642{
641 struct snd_monitor_file *mfile, *pfile = NULL; 643 struct snd_monitor_file *mfile, *pfile = NULL;
642 644
@@ -671,7 +673,7 @@ int snd_card_file_remove(snd_card_t *card, struct file *file)
671 */ 673 */
672struct snd_generic_device { 674struct snd_generic_device {
673 struct platform_device pdev; 675 struct platform_device pdev;
674 snd_card_t *card; 676 struct snd_card *card;
675}; 677};
676 678
677#define get_snd_generic_card(dev) container_of(dev, struct snd_generic_device, pdev)->card 679#define get_snd_generic_card(dev) container_of(dev, struct snd_generic_device, pdev)->card
@@ -698,7 +700,7 @@ void snd_generic_device_release(struct device *dev)
698{ 700{
699} 701}
700 702
701static int snd_generic_device_register(snd_card_t *card) 703static int snd_generic_device_register(struct snd_card *card)
702{ 704{
703 struct snd_generic_device *dev; 705 struct snd_generic_device *dev;
704 int err; 706 int err;
@@ -724,7 +726,7 @@ static int snd_generic_device_register(snd_card_t *card)
724 return 0; 726 return 0;
725} 727}
726 728
727static void snd_generic_device_unregister(snd_card_t *card) 729static void snd_generic_device_unregister(struct snd_card *card)
728{ 730{
729 struct snd_generic_device *dev = card->generic_dev; 731 struct snd_generic_device *dev = card->generic_dev;
730 if (dev) { 732 if (dev) {
@@ -744,7 +746,7 @@ static void snd_generic_device_unregister(snd_card_t *card)
744 * 746 *
745 * Returns zero if successful, or a negative error code. 747 * Returns zero if successful, or a negative error code.
746 */ 748 */
747int snd_card_set_generic_dev(snd_card_t *card) 749int snd_card_set_generic_dev(struct snd_card *card)
748{ 750{
749 int err; 751 int err;
750 if ((err = snd_generic_device_register(card)) < 0) 752 if ((err = snd_generic_device_register(card)) < 0)
@@ -766,7 +768,7 @@ int snd_card_set_generic_dev(snd_card_t *card)
766 * 768 *
767 * Note: the power lock must be active before call. 769 * Note: the power lock must be active before call.
768 */ 770 */
769int snd_power_wait(snd_card_t *card, unsigned int power_state, struct file *file) 771int snd_power_wait(struct snd_card *card, unsigned int power_state, struct file *file)
770{ 772{
771 wait_queue_t wait; 773 wait_queue_t wait;
772 int result = 0; 774 int result = 0;
@@ -809,9 +811,9 @@ int snd_power_wait(snd_card_t *card, unsigned int power_state, struct file *file
809 * These callbacks are called from ALSA's common PCI suspend/resume 811 * These callbacks are called from ALSA's common PCI suspend/resume
810 * handler and from the control API. 812 * handler and from the control API.
811 */ 813 */
812int snd_card_set_pm_callback(snd_card_t *card, 814int snd_card_set_pm_callback(struct snd_card *card,
813 int (*suspend)(snd_card_t *, pm_message_t), 815 int (*suspend)(struct snd_card *, pm_message_t),
814 int (*resume)(snd_card_t *), 816 int (*resume)(struct snd_card *),
815 void *private_data) 817 void *private_data)
816{ 818{
817 card->pm_suspend = suspend; 819 card->pm_suspend = suspend;
@@ -824,7 +826,7 @@ int snd_card_set_pm_callback(snd_card_t *card,
824/* suspend/resume callbacks for snd_generic platform device */ 826/* suspend/resume callbacks for snd_generic platform device */
825static int snd_generic_suspend(struct platform_device *dev, pm_message_t state) 827static int snd_generic_suspend(struct platform_device *dev, pm_message_t state)
826{ 828{
827 snd_card_t *card; 829 struct snd_card *card;
828 830
829 card = get_snd_generic_card(dev); 831 card = get_snd_generic_card(dev);
830 if (card->power_state == SNDRV_CTL_POWER_D3hot) 832 if (card->power_state == SNDRV_CTL_POWER_D3hot)
@@ -837,7 +839,7 @@ static int snd_generic_suspend(struct platform_device *dev, pm_message_t state)
837 839
838static int snd_generic_resume(struct platform_device *dev) 840static int snd_generic_resume(struct platform_device *dev)
839{ 841{
840 snd_card_t *card; 842 struct snd_card *card;
841 843
842 card = get_snd_generic_card(dev); 844 card = get_snd_generic_card(dev);
843 if (card->power_state == SNDRV_CTL_POWER_D0) 845 if (card->power_state == SNDRV_CTL_POWER_D0)
@@ -859,9 +861,9 @@ static int snd_generic_resume(struct platform_device *dev)
859 * the given card. These callbacks are called from the ALSA's common 861 * the given card. These callbacks are called from the ALSA's common
860 * PM handler and from the control API. 862 * PM handler and from the control API.
861 */ 863 */
862int snd_card_set_generic_pm_callback(snd_card_t *card, 864int snd_card_set_generic_pm_callback(struct snd_card *card,
863 int (*suspend)(snd_card_t *, pm_message_t), 865 int (*suspend)(struct snd_card *, pm_message_t),
864 int (*resume)(snd_card_t *), 866 int (*resume)(struct snd_card *),
865 void *private_data) 867 void *private_data)
866{ 868{
867 int err; 869 int err;
@@ -874,7 +876,7 @@ int snd_card_set_generic_pm_callback(snd_card_t *card,
874#ifdef CONFIG_PCI 876#ifdef CONFIG_PCI
875int snd_card_pci_suspend(struct pci_dev *dev, pm_message_t state) 877int snd_card_pci_suspend(struct pci_dev *dev, pm_message_t state)
876{ 878{
877 snd_card_t *card = pci_get_drvdata(dev); 879 struct snd_card *card = pci_get_drvdata(dev);
878 int err; 880 int err;
879 if (! card || ! card->pm_suspend) 881 if (! card || ! card->pm_suspend)
880 return 0; 882 return 0;
@@ -888,7 +890,7 @@ int snd_card_pci_suspend(struct pci_dev *dev, pm_message_t state)
888 890
889int snd_card_pci_resume(struct pci_dev *dev) 891int snd_card_pci_resume(struct pci_dev *dev)
890{ 892{
891 snd_card_t *card = pci_get_drvdata(dev); 893 struct snd_card *card = pci_get_drvdata(dev);
892 if (! card || ! card->pm_resume) 894 if (! card || ! card->pm_resume)
893 return 0; 895 return 0;
894 if (card->power_state == SNDRV_CTL_POWER_D0) 896 if (card->power_state == SNDRV_CTL_POWER_D0)