aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/emu10k1/emufx.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 08:50:13 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:18:47 -0500
commiteb4698f347ec908c365504c4edddadd1acd406ea (patch)
tree4962019c8bf4a52e35ab55137e17aa150edf9661 /sound/pci/emu10k1/emufx.c
parent3d19f804ef5f1d15fe001fc8d1ed58fac9d591fb (diff)
[ALSA] Remove xxx_t typedefs: PCI emu10k1
Modules: EMU10K1/EMU10K2 driver Remove xxx_t typedefs from the PCI emu10k1 driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/emu10k1/emufx.c')
-rw-r--r--sound/pci/emu10k1/emufx.c244
1 files changed, 140 insertions, 104 deletions
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 03e8c1678952..f4452c5cb4cd 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -309,9 +309,10 @@ static inline void snd_leave_user(mm_segment_t fs)
309 * controls 309 * controls
310 */ 310 */
311 311
312static int snd_emu10k1_gpr_ctl_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 312static int snd_emu10k1_gpr_ctl_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
313{ 313{
314 snd_emu10k1_fx8010_ctl_t *ctl = (snd_emu10k1_fx8010_ctl_t *)kcontrol->private_value; 314 struct snd_emu10k1_fx8010_ctl *ctl =
315 (struct snd_emu10k1_fx8010_ctl *) kcontrol->private_value;
315 316
316 if (ctl->min == 0 && ctl->max == 1) 317 if (ctl->min == 0 && ctl->max == 1)
317 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 318 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
@@ -323,10 +324,11 @@ static int snd_emu10k1_gpr_ctl_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_
323 return 0; 324 return 0;
324} 325}
325 326
326static int snd_emu10k1_gpr_ctl_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 327static int snd_emu10k1_gpr_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
327{ 328{
328 emu10k1_t *emu = snd_kcontrol_chip(kcontrol); 329 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
329 snd_emu10k1_fx8010_ctl_t *ctl = (snd_emu10k1_fx8010_ctl_t *)kcontrol->private_value; 330 struct snd_emu10k1_fx8010_ctl *ctl =
331 (struct snd_emu10k1_fx8010_ctl *) kcontrol->private_value;
330 unsigned long flags; 332 unsigned long flags;
331 unsigned int i; 333 unsigned int i;
332 334
@@ -337,10 +339,11 @@ static int snd_emu10k1_gpr_ctl_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value
337 return 0; 339 return 0;
338} 340}
339 341
340static int snd_emu10k1_gpr_ctl_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 342static int snd_emu10k1_gpr_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
341{ 343{
342 emu10k1_t *emu = snd_kcontrol_chip(kcontrol); 344 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
343 snd_emu10k1_fx8010_ctl_t *ctl = (snd_emu10k1_fx8010_ctl_t *)kcontrol->private_value; 345 struct snd_emu10k1_fx8010_ctl *ctl =
346 (struct snd_emu10k1_fx8010_ctl *) kcontrol->private_value;
344 unsigned long flags; 347 unsigned long flags;
345 unsigned int nval, val; 348 unsigned int nval, val;
346 unsigned int i, j; 349 unsigned int i, j;
@@ -393,9 +396,9 @@ static int snd_emu10k1_gpr_ctl_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value
393 * Interrupt handler 396 * Interrupt handler
394 */ 397 */
395 398
396static void snd_emu10k1_fx8010_interrupt(emu10k1_t *emu) 399static void snd_emu10k1_fx8010_interrupt(struct snd_emu10k1 *emu)
397{ 400{
398 snd_emu10k1_fx8010_irq_t *irq, *nirq; 401 struct snd_emu10k1_fx8010_irq *irq, *nirq;
399 402
400 irq = emu->fx8010.irq_handlers; 403 irq = emu->fx8010.irq_handlers;
401 while (irq) { 404 while (irq) {
@@ -409,13 +412,13 @@ static void snd_emu10k1_fx8010_interrupt(emu10k1_t *emu)
409 } 412 }
410} 413}
411 414
412int snd_emu10k1_fx8010_register_irq_handler(emu10k1_t *emu, 415int snd_emu10k1_fx8010_register_irq_handler(struct snd_emu10k1 *emu,
413 snd_fx8010_irq_handler_t *handler, 416 snd_fx8010_irq_handler_t *handler,
414 unsigned char gpr_running, 417 unsigned char gpr_running,
415 void *private_data, 418 void *private_data,
416 snd_emu10k1_fx8010_irq_t **r_irq) 419 struct snd_emu10k1_fx8010_irq **r_irq)
417{ 420{
418 snd_emu10k1_fx8010_irq_t *irq; 421 struct snd_emu10k1_fx8010_irq *irq;
419 unsigned long flags; 422 unsigned long flags;
420 423
421 irq = kmalloc(sizeof(*irq), GFP_ATOMIC); 424 irq = kmalloc(sizeof(*irq), GFP_ATOMIC);
@@ -440,10 +443,10 @@ int snd_emu10k1_fx8010_register_irq_handler(emu10k1_t *emu,
440 return 0; 443 return 0;
441} 444}
442 445
443int snd_emu10k1_fx8010_unregister_irq_handler(emu10k1_t *emu, 446int snd_emu10k1_fx8010_unregister_irq_handler(struct snd_emu10k1 *emu,
444 snd_emu10k1_fx8010_irq_t *irq) 447 struct snd_emu10k1_fx8010_irq *irq)
445{ 448{
446 snd_emu10k1_fx8010_irq_t *tmp; 449 struct snd_emu10k1_fx8010_irq *tmp;
447 unsigned long flags; 450 unsigned long flags;
448 451
449 spin_lock_irqsave(&emu->fx8010.irq_lock, flags); 452 spin_lock_irqsave(&emu->fx8010.irq_lock, flags);
@@ -468,7 +471,8 @@ int snd_emu10k1_fx8010_unregister_irq_handler(emu10k1_t *emu,
468 * EMU10K1 effect manager 471 * EMU10K1 effect manager
469 *************************************************************************/ 472 *************************************************************************/
470 473
471static void snd_emu10k1_write_op(emu10k1_fx8010_code_t *icode, unsigned int *ptr, 474static void snd_emu10k1_write_op(struct snd_emu10k1_fx8010_code *icode,
475 unsigned int *ptr,
472 u32 op, u32 r, u32 a, u32 x, u32 y) 476 u32 op, u32 r, u32 a, u32 x, u32 y)
473{ 477{
474 u_int32_t *code; 478 u_int32_t *code;
@@ -483,7 +487,8 @@ static void snd_emu10k1_write_op(emu10k1_fx8010_code_t *icode, unsigned int *ptr
483#define OP(icode, ptr, op, r, a, x, y) \ 487#define OP(icode, ptr, op, r, a, x, y) \
484 snd_emu10k1_write_op(icode, ptr, op, r, a, x, y) 488 snd_emu10k1_write_op(icode, ptr, op, r, a, x, y)
485 489
486static void snd_emu10k1_audigy_write_op(emu10k1_fx8010_code_t *icode, unsigned int *ptr, 490static void snd_emu10k1_audigy_write_op(struct snd_emu10k1_fx8010_code *icode,
491 unsigned int *ptr,
487 u32 op, u32 r, u32 a, u32 x, u32 y) 492 u32 op, u32 r, u32 a, u32 x, u32 y)
488{ 493{
489 u_int32_t *code; 494 u_int32_t *code;
@@ -498,19 +503,20 @@ static void snd_emu10k1_audigy_write_op(emu10k1_fx8010_code_t *icode, unsigned i
498#define A_OP(icode, ptr, op, r, a, x, y) \ 503#define A_OP(icode, ptr, op, r, a, x, y) \
499 snd_emu10k1_audigy_write_op(icode, ptr, op, r, a, x, y) 504 snd_emu10k1_audigy_write_op(icode, ptr, op, r, a, x, y)
500 505
501static void snd_emu10k1_efx_write(emu10k1_t *emu, unsigned int pc, unsigned int data) 506static void snd_emu10k1_efx_write(struct snd_emu10k1 *emu, unsigned int pc, unsigned int data)
502{ 507{
503 pc += emu->audigy ? A_MICROCODEBASE : MICROCODEBASE; 508 pc += emu->audigy ? A_MICROCODEBASE : MICROCODEBASE;
504 snd_emu10k1_ptr_write(emu, pc, 0, data); 509 snd_emu10k1_ptr_write(emu, pc, 0, data);
505} 510}
506 511
507unsigned int snd_emu10k1_efx_read(emu10k1_t *emu, unsigned int pc) 512unsigned int snd_emu10k1_efx_read(struct snd_emu10k1 *emu, unsigned int pc)
508{ 513{
509 pc += emu->audigy ? A_MICROCODEBASE : MICROCODEBASE; 514 pc += emu->audigy ? A_MICROCODEBASE : MICROCODEBASE;
510 return snd_emu10k1_ptr_read(emu, pc, 0); 515 return snd_emu10k1_ptr_read(emu, pc, 0);
511} 516}
512 517
513static int snd_emu10k1_gpr_poke(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) 518static int snd_emu10k1_gpr_poke(struct snd_emu10k1 *emu,
519 struct snd_emu10k1_fx8010_code *icode)
514{ 520{
515 int gpr; 521 int gpr;
516 u32 val; 522 u32 val;
@@ -525,7 +531,8 @@ static int snd_emu10k1_gpr_poke(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
525 return 0; 531 return 0;
526} 532}
527 533
528static int snd_emu10k1_gpr_peek(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) 534static int snd_emu10k1_gpr_peek(struct snd_emu10k1 *emu,
535 struct snd_emu10k1_fx8010_code *icode)
529{ 536{
530 int gpr; 537 int gpr;
531 u32 val; 538 u32 val;
@@ -539,7 +546,8 @@ static int snd_emu10k1_gpr_peek(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
539 return 0; 546 return 0;
540} 547}
541 548
542static int snd_emu10k1_tram_poke(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) 549static int snd_emu10k1_tram_poke(struct snd_emu10k1 *emu,
550 struct snd_emu10k1_fx8010_code *icode)
543{ 551{
544 int tram; 552 int tram;
545 u32 addr, val; 553 u32 addr, val;
@@ -561,7 +569,8 @@ static int snd_emu10k1_tram_poke(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
561 return 0; 569 return 0;
562} 570}
563 571
564static int snd_emu10k1_tram_peek(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) 572static int snd_emu10k1_tram_peek(struct snd_emu10k1 *emu,
573 struct snd_emu10k1_fx8010_code *icode)
565{ 574{
566 int tram; 575 int tram;
567 u32 val, addr; 576 u32 val, addr;
@@ -583,7 +592,8 @@ static int snd_emu10k1_tram_peek(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
583 return 0; 592 return 0;
584} 593}
585 594
586static int snd_emu10k1_code_poke(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) 595static int snd_emu10k1_code_poke(struct snd_emu10k1 *emu,
596 struct snd_emu10k1_fx8010_code *icode)
587{ 597{
588 u32 pc, lo, hi; 598 u32 pc, lo, hi;
589 599
@@ -599,7 +609,8 @@ static int snd_emu10k1_code_poke(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
599 return 0; 609 return 0;
600} 610}
601 611
602static int snd_emu10k1_code_peek(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) 612static int snd_emu10k1_code_peek(struct snd_emu10k1 *emu,
613 struct snd_emu10k1_fx8010_code *icode)
603{ 614{
604 u32 pc; 615 u32 pc;
605 616
@@ -614,10 +625,11 @@ static int snd_emu10k1_code_peek(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
614 return 0; 625 return 0;
615} 626}
616 627
617static snd_emu10k1_fx8010_ctl_t *snd_emu10k1_look_for_ctl(emu10k1_t *emu, snd_ctl_elem_id_t *id) 628static struct snd_emu10k1_fx8010_ctl *
629snd_emu10k1_look_for_ctl(struct snd_emu10k1 *emu, struct snd_ctl_elem_id *id)
618{ 630{
619 snd_emu10k1_fx8010_ctl_t *ctl; 631 struct snd_emu10k1_fx8010_ctl *ctl;
620 snd_kcontrol_t *kcontrol; 632 struct snd_kcontrol *kcontrol;
621 struct list_head *list; 633 struct list_head *list;
622 634
623 list_for_each(list, &emu->fx8010.gpr_ctl) { 635 list_for_each(list, &emu->fx8010.gpr_ctl) {
@@ -631,13 +643,14 @@ static snd_emu10k1_fx8010_ctl_t *snd_emu10k1_look_for_ctl(emu10k1_t *emu, snd_ct
631 return NULL; 643 return NULL;
632} 644}
633 645
634static int snd_emu10k1_verify_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) 646static int snd_emu10k1_verify_controls(struct snd_emu10k1 *emu,
647 struct snd_emu10k1_fx8010_code *icode)
635{ 648{
636 unsigned int i; 649 unsigned int i;
637 snd_ctl_elem_id_t __user *_id; 650 struct snd_ctl_elem_id __user *_id;
638 snd_ctl_elem_id_t id; 651 struct snd_ctl_elem_id id;
639 emu10k1_fx8010_control_gpr_t __user *_gctl; 652 struct snd_emu10k1_fx8010_control_gpr __user *_gctl;
640 emu10k1_fx8010_control_gpr_t *gctl; 653 struct snd_emu10k1_fx8010_control_gpr *gctl;
641 int err; 654 int err;
642 655
643 for (i = 0, _id = icode->gpr_del_controls; 656 for (i = 0, _id = icode->gpr_del_controls;
@@ -685,28 +698,29 @@ static int snd_emu10k1_verify_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *ic
685 return err; 698 return err;
686} 699}
687 700
688static void snd_emu10k1_ctl_private_free(snd_kcontrol_t *kctl) 701static void snd_emu10k1_ctl_private_free(struct snd_kcontrol *kctl)
689{ 702{
690 snd_emu10k1_fx8010_ctl_t *ctl; 703 struct snd_emu10k1_fx8010_ctl *ctl;
691 704
692 ctl = (snd_emu10k1_fx8010_ctl_t *)kctl->private_value; 705 ctl = (struct snd_emu10k1_fx8010_ctl *) kctl->private_value;
693 kctl->private_value = 0; 706 kctl->private_value = 0;
694 list_del(&ctl->list); 707 list_del(&ctl->list);
695 kfree(ctl); 708 kfree(ctl);
696} 709}
697 710
698static int snd_emu10k1_add_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) 711static int snd_emu10k1_add_controls(struct snd_emu10k1 *emu,
712 struct snd_emu10k1_fx8010_code *icode)
699{ 713{
700 unsigned int i, j; 714 unsigned int i, j;
701 emu10k1_fx8010_control_gpr_t __user *_gctl; 715 struct snd_emu10k1_fx8010_control_gpr __user *_gctl;
702 emu10k1_fx8010_control_gpr_t *gctl; 716 struct snd_emu10k1_fx8010_control_gpr *gctl;
703 snd_emu10k1_fx8010_ctl_t *ctl, *nctl; 717 struct snd_emu10k1_fx8010_ctl *ctl, *nctl;
704 snd_kcontrol_new_t knew; 718 struct snd_kcontrol_new knew;
705 snd_kcontrol_t *kctl; 719 struct snd_kcontrol *kctl;
706 snd_ctl_elem_value_t *val; 720 struct snd_ctl_elem_value *val;
707 int err = 0; 721 int err = 0;
708 722
709 val = (snd_ctl_elem_value_t *)kmalloc(sizeof(*val), GFP_KERNEL); 723 val = kmalloc(sizeof(*val), GFP_KERNEL);
710 gctl = kmalloc(sizeof(*gctl), GFP_KERNEL); 724 gctl = kmalloc(sizeof(*gctl), GFP_KERNEL);
711 nctl = kmalloc(sizeof(*nctl), GFP_KERNEL); 725 nctl = kmalloc(sizeof(*nctl), GFP_KERNEL);
712 if (!val || !gctl || !nctl) { 726 if (!val || !gctl || !nctl) {
@@ -751,7 +765,7 @@ static int snd_emu10k1_add_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode
751 nctl->max = gctl->max; 765 nctl->max = gctl->max;
752 nctl->translation = gctl->translation; 766 nctl->translation = gctl->translation;
753 if (ctl == NULL) { 767 if (ctl == NULL) {
754 ctl = (snd_emu10k1_fx8010_ctl_t *)kmalloc(sizeof(*ctl), GFP_KERNEL); 768 ctl = kmalloc(sizeof(*ctl), GFP_KERNEL);
755 if (ctl == NULL) { 769 if (ctl == NULL) {
756 err = -ENOMEM; 770 err = -ENOMEM;
757 goto __error; 771 goto __error;
@@ -782,13 +796,14 @@ static int snd_emu10k1_add_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode
782 return err; 796 return err;
783} 797}
784 798
785static int snd_emu10k1_del_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) 799static int snd_emu10k1_del_controls(struct snd_emu10k1 *emu,
800 struct snd_emu10k1_fx8010_code *icode)
786{ 801{
787 unsigned int i; 802 unsigned int i;
788 snd_ctl_elem_id_t id; 803 struct snd_ctl_elem_id id;
789 snd_ctl_elem_id_t __user *_id; 804 struct snd_ctl_elem_id __user *_id;
790 snd_emu10k1_fx8010_ctl_t *ctl; 805 struct snd_emu10k1_fx8010_ctl *ctl;
791 snd_card_t *card = emu->card; 806 struct snd_card *card = emu->card;
792 807
793 for (i = 0, _id = icode->gpr_del_controls; 808 for (i = 0, _id = icode->gpr_del_controls;
794 i < icode->gpr_del_control_count; i++, _id++) { 809 i < icode->gpr_del_control_count; i++, _id++) {
@@ -803,14 +818,15 @@ static int snd_emu10k1_del_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode
803 return 0; 818 return 0;
804} 819}
805 820
806static int snd_emu10k1_list_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) 821static int snd_emu10k1_list_controls(struct snd_emu10k1 *emu,
822 struct snd_emu10k1_fx8010_code *icode)
807{ 823{
808 unsigned int i = 0, j; 824 unsigned int i = 0, j;
809 unsigned int total = 0; 825 unsigned int total = 0;
810 emu10k1_fx8010_control_gpr_t *gctl; 826 struct snd_emu10k1_fx8010_control_gpr *gctl;
811 emu10k1_fx8010_control_gpr_t __user *_gctl; 827 struct snd_emu10k1_fx8010_control_gpr __user *_gctl;
812 snd_emu10k1_fx8010_ctl_t *ctl; 828 struct snd_emu10k1_fx8010_ctl *ctl;
813 snd_ctl_elem_id_t *id; 829 struct snd_ctl_elem_id *id;
814 struct list_head *list; 830 struct list_head *list;
815 831
816 gctl = kmalloc(sizeof(*gctl), GFP_KERNEL); 832 gctl = kmalloc(sizeof(*gctl), GFP_KERNEL);
@@ -851,7 +867,8 @@ static int snd_emu10k1_list_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icod
851 return 0; 867 return 0;
852} 868}
853 869
854static int snd_emu10k1_icode_poke(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) 870static int snd_emu10k1_icode_poke(struct snd_emu10k1 *emu,
871 struct snd_emu10k1_fx8010_code *icode)
855{ 872{
856 int err = 0; 873 int err = 0;
857 874
@@ -882,7 +899,8 @@ static int snd_emu10k1_icode_poke(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
882 return err; 899 return err;
883} 900}
884 901
885static int snd_emu10k1_icode_peek(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) 902static int snd_emu10k1_icode_peek(struct snd_emu10k1 *emu,
903 struct snd_emu10k1_fx8010_code *icode)
886{ 904{
887 int err; 905 int err;
888 906
@@ -900,11 +918,12 @@ static int snd_emu10k1_icode_peek(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
900 return err; 918 return err;
901} 919}
902 920
903static int snd_emu10k1_ipcm_poke(emu10k1_t *emu, emu10k1_fx8010_pcm_t *ipcm) 921static int snd_emu10k1_ipcm_poke(struct snd_emu10k1 *emu,
922 struct snd_emu10k1_fx8010_pcm_rec *ipcm)
904{ 923{
905 unsigned int i; 924 unsigned int i;
906 int err = 0; 925 int err = 0;
907 snd_emu10k1_fx8010_pcm_t *pcm; 926 struct snd_emu10k1_fx8010_pcm *pcm;
908 927
909 if (ipcm->substream >= EMU10K1_FX8010_PCM_COUNT) 928 if (ipcm->substream >= EMU10K1_FX8010_PCM_COUNT)
910 return -EINVAL; 929 return -EINVAL;
@@ -945,11 +964,12 @@ static int snd_emu10k1_ipcm_poke(emu10k1_t *emu, emu10k1_fx8010_pcm_t *ipcm)
945 return err; 964 return err;
946} 965}
947 966
948static int snd_emu10k1_ipcm_peek(emu10k1_t *emu, emu10k1_fx8010_pcm_t *ipcm) 967static int snd_emu10k1_ipcm_peek(struct snd_emu10k1 *emu,
968 struct snd_emu10k1_fx8010_pcm_rec *ipcm)
949{ 969{
950 unsigned int i; 970 unsigned int i;
951 int err = 0; 971 int err = 0;
952 snd_emu10k1_fx8010_pcm_t *pcm; 972 struct snd_emu10k1_fx8010_pcm *pcm;
953 973
954 if (ipcm->substream >= EMU10K1_FX8010_PCM_COUNT) 974 if (ipcm->substream >= EMU10K1_FX8010_PCM_COUNT)
955 return -EINVAL; 975 return -EINVAL;
@@ -979,7 +999,9 @@ static int snd_emu10k1_ipcm_peek(emu10k1_t *emu, emu10k1_fx8010_pcm_t *ipcm)
979#define SND_EMU10K1_PLAYBACK_CHANNELS 8 999#define SND_EMU10K1_PLAYBACK_CHANNELS 8
980#define SND_EMU10K1_CAPTURE_CHANNELS 4 1000#define SND_EMU10K1_CAPTURE_CHANNELS 4
981 1001
982static void __devinit snd_emu10k1_init_mono_control(emu10k1_fx8010_control_gpr_t *ctl, const char *name, int gpr, int defval) 1002static void __devinit
1003snd_emu10k1_init_mono_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
1004 const char *name, int gpr, int defval)
983{ 1005{
984 ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 1006 ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
985 strcpy(ctl->id.name, name); 1007 strcpy(ctl->id.name, name);
@@ -990,7 +1012,9 @@ static void __devinit snd_emu10k1_init_mono_control(emu10k1_fx8010_control_gpr_t
990 ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100; 1012 ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;
991} 1013}
992 1014
993static void __devinit snd_emu10k1_init_stereo_control(emu10k1_fx8010_control_gpr_t *ctl, const char *name, int gpr, int defval) 1015static void __devinit
1016snd_emu10k1_init_stereo_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
1017 const char *name, int gpr, int defval)
994{ 1018{
995 ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 1019 ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
996 strcpy(ctl->id.name, name); 1020 strcpy(ctl->id.name, name);
@@ -1002,7 +1026,9 @@ static void __devinit snd_emu10k1_init_stereo_control(emu10k1_fx8010_control_gpr
1002 ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100; 1026 ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;
1003} 1027}
1004 1028
1005static void __devinit snd_emu10k1_init_mono_onoff_control(emu10k1_fx8010_control_gpr_t *ctl, const char *name, int gpr, int defval) 1029static void __devinit
1030snd_emu10k1_init_mono_onoff_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
1031 const char *name, int gpr, int defval)
1006{ 1032{
1007 ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 1033 ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
1008 strcpy(ctl->id.name, name); 1034 strcpy(ctl->id.name, name);
@@ -1013,7 +1039,9 @@ static void __devinit snd_emu10k1_init_mono_onoff_control(emu10k1_fx8010_control
1013 ctl->translation = EMU10K1_GPR_TRANSLATION_ONOFF; 1039 ctl->translation = EMU10K1_GPR_TRANSLATION_ONOFF;
1014} 1040}
1015 1041
1016static void __devinit snd_emu10k1_init_stereo_onoff_control(emu10k1_fx8010_control_gpr_t *ctl, const char *name, int gpr, int defval) 1042static void __devinit
1043snd_emu10k1_init_stereo_onoff_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
1044 const char *name, int gpr, int defval)
1017{ 1045{
1018 ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 1046 ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
1019 strcpy(ctl->id.name, name); 1047 strcpy(ctl->id.name, name);
@@ -1030,7 +1058,7 @@ static void __devinit snd_emu10k1_init_stereo_onoff_control(emu10k1_fx8010_contr
1030 * initial DSP configuration for Audigy 1058 * initial DSP configuration for Audigy
1031 */ 1059 */
1032 1060
1033static int __devinit _snd_emu10k1_audigy_init_efx(emu10k1_t *emu) 1061static int __devinit _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu)
1034{ 1062{
1035 int err, i, z, gpr, nctl; 1063 int err, i, z, gpr, nctl;
1036 const int playback = 10; 1064 const int playback = 10;
@@ -1038,8 +1066,8 @@ static int __devinit _snd_emu10k1_audigy_init_efx(emu10k1_t *emu)
1038 const int stereo_mix = capture + 2; 1066 const int stereo_mix = capture + 2;
1039 const int tmp = 0x88; 1067 const int tmp = 0x88;
1040 u32 ptr; 1068 u32 ptr;
1041 emu10k1_fx8010_code_t *icode = NULL; 1069 struct snd_emu10k1_fx8010_code *icode = NULL;
1042 emu10k1_fx8010_control_gpr_t *controls = NULL, *ctl; 1070 struct snd_emu10k1_fx8010_control_gpr *controls = NULL, *ctl;
1043 u32 *gpr_map; 1071 u32 *gpr_map;
1044 mm_segment_t seg; 1072 mm_segment_t seg;
1045 1073
@@ -1047,8 +1075,11 @@ static int __devinit _snd_emu10k1_audigy_init_efx(emu10k1_t *emu)
1047 INIT_LIST_HEAD(&emu->fx8010.gpr_ctl); 1075 INIT_LIST_HEAD(&emu->fx8010.gpr_ctl);
1048 1076
1049 if ((icode = kzalloc(sizeof(*icode), GFP_KERNEL)) == NULL || 1077 if ((icode = kzalloc(sizeof(*icode), GFP_KERNEL)) == NULL ||
1050 (icode->gpr_map = (u_int32_t __user *)kcalloc(512 + 256 + 256 + 2 * 1024, sizeof(u_int32_t), GFP_KERNEL)) == NULL || 1078 (icode->gpr_map = (u_int32_t __user *)
1051 (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, sizeof(*controls), GFP_KERNEL)) == NULL) { 1079 kcalloc(512 + 256 + 256 + 2 * 1024, sizeof(u_int32_t),
1080 GFP_KERNEL)) == NULL ||
1081 (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS,
1082 sizeof(*controls), GFP_KERNEL)) == NULL) {
1052 err = -ENOMEM; 1083 err = -ENOMEM;
1053 goto __err; 1084 goto __err;
1054 } 1085 }
@@ -1434,7 +1465,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
1434 1465
1435 seg = snd_enter_user(); 1466 seg = snd_enter_user();
1436 icode->gpr_add_control_count = nctl; 1467 icode->gpr_add_control_count = nctl;
1437 icode->gpr_add_controls = (emu10k1_fx8010_control_gpr_t __user *)controls; 1468 icode->gpr_add_controls = (struct snd_emu10k1_fx8010_control_gpr __user *)controls;
1438 err = snd_emu10k1_icode_poke(emu, icode); 1469 err = snd_emu10k1_icode_poke(emu, icode);
1439 snd_leave_user(seg); 1470 snd_leave_user(seg);
1440 1471
@@ -1454,14 +1485,14 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
1454 1485
1455/* when volume = max, then copy only to avoid volume modification */ 1486/* when volume = max, then copy only to avoid volume modification */
1456/* with iMAC0 (negative values) */ 1487/* with iMAC0 (negative values) */
1457static void __devinit _volume(emu10k1_fx8010_code_t *icode, u32 *ptr, u32 dst, u32 src, u32 vol) 1488static void __devinit _volume(struct snd_emu10k1_fx8010_code *icode, u32 *ptr, u32 dst, u32 src, u32 vol)
1458{ 1489{
1459 OP(icode, ptr, iMAC0, dst, C_00000000, src, vol); 1490 OP(icode, ptr, iMAC0, dst, C_00000000, src, vol);
1460 OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff); 1491 OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff);
1461 OP(icode, ptr, iSKIP, GPR_COND, GPR_COND, CC_REG_NONZERO, C_00000001); 1492 OP(icode, ptr, iSKIP, GPR_COND, GPR_COND, CC_REG_NONZERO, C_00000001);
1462 OP(icode, ptr, iACC3, dst, src, C_00000000, C_00000000); 1493 OP(icode, ptr, iACC3, dst, src, C_00000000, C_00000000);
1463} 1494}
1464static void __devinit _volume_add(emu10k1_fx8010_code_t *icode, u32 *ptr, u32 dst, u32 src, u32 vol) 1495static void __devinit _volume_add(struct snd_emu10k1_fx8010_code *icode, u32 *ptr, u32 dst, u32 src, u32 vol)
1465{ 1496{
1466 OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff); 1497 OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff);
1467 OP(icode, ptr, iSKIP, GPR_COND, GPR_COND, CC_REG_NONZERO, C_00000002); 1498 OP(icode, ptr, iSKIP, GPR_COND, GPR_COND, CC_REG_NONZERO, C_00000002);
@@ -1469,7 +1500,7 @@ static void __devinit _volume_add(emu10k1_fx8010_code_t *icode, u32 *ptr, u32 ds
1469 OP(icode, ptr, iSKIP, C_00000000, C_7fffffff, C_7fffffff, C_00000001); 1500 OP(icode, ptr, iSKIP, C_00000000, C_7fffffff, C_7fffffff, C_00000001);
1470 OP(icode, ptr, iMAC0, dst, dst, src, vol); 1501 OP(icode, ptr, iMAC0, dst, dst, src, vol);
1471} 1502}
1472static void __devinit _volume_out(emu10k1_fx8010_code_t *icode, u32 *ptr, u32 dst, u32 src, u32 vol) 1503static void __devinit _volume_out(struct snd_emu10k1_fx8010_code *icode, u32 *ptr, u32 dst, u32 src, u32 vol)
1473{ 1504{
1474 OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff); 1505 OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff);
1475 OP(icode, ptr, iSKIP, GPR_COND, GPR_COND, CC_REG_NONZERO, C_00000002); 1506 OP(icode, ptr, iSKIP, GPR_COND, GPR_COND, CC_REG_NONZERO, C_00000002);
@@ -1500,13 +1531,13 @@ static void __devinit _volume_out(emu10k1_fx8010_code_t *icode, u32 *ptr, u32 ds
1500 _SWITCH_NEG(icode, ptr, GPR(dst), GPR(src)) 1531 _SWITCH_NEG(icode, ptr, GPR(dst), GPR(src))
1501 1532
1502 1533
1503static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu) 1534static int __devinit _snd_emu10k1_init_efx(struct snd_emu10k1 *emu)
1504{ 1535{
1505 int err, i, z, gpr, tmp, playback, capture; 1536 int err, i, z, gpr, tmp, playback, capture;
1506 u32 ptr; 1537 u32 ptr;
1507 emu10k1_fx8010_code_t *icode; 1538 struct snd_emu10k1_fx8010_code *icode;
1508 emu10k1_fx8010_pcm_t *ipcm = NULL; 1539 struct snd_emu10k1_fx8010_pcm_rec *ipcm = NULL;
1509 emu10k1_fx8010_control_gpr_t *controls = NULL, *ctl; 1540 struct snd_emu10k1_fx8010_control_gpr *controls = NULL, *ctl;
1510 u32 *gpr_map; 1541 u32 *gpr_map;
1511 mm_segment_t seg; 1542 mm_segment_t seg;
1512 1543
@@ -1515,8 +1546,12 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
1515 1546
1516 if ((icode = kzalloc(sizeof(*icode), GFP_KERNEL)) == NULL) 1547 if ((icode = kzalloc(sizeof(*icode), GFP_KERNEL)) == NULL)
1517 return -ENOMEM; 1548 return -ENOMEM;
1518 if ((icode->gpr_map = (u_int32_t __user *)kcalloc(256 + 160 + 160 + 2 * 512, sizeof(u_int32_t), GFP_KERNEL)) == NULL || 1549 if ((icode->gpr_map = (u_int32_t __user *)
1519 (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, sizeof(emu10k1_fx8010_control_gpr_t), GFP_KERNEL)) == NULL || 1550 kcalloc(256 + 160 + 160 + 2 * 512, sizeof(u_int32_t),
1551 GFP_KERNEL)) == NULL ||
1552 (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS,
1553 sizeof(struct snd_emu10k1_fx8010_control_gpr),
1554 GFP_KERNEL)) == NULL ||
1520 (ipcm = kzalloc(sizeof(*ipcm), GFP_KERNEL)) == NULL) { 1555 (ipcm = kzalloc(sizeof(*ipcm), GFP_KERNEL)) == NULL) {
1521 err = -ENOMEM; 1556 err = -ENOMEM;
1522 goto __err; 1557 goto __err;
@@ -2050,7 +2085,7 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
2050 goto __err; 2085 goto __err;
2051 seg = snd_enter_user(); 2086 seg = snd_enter_user();
2052 icode->gpr_add_control_count = i; 2087 icode->gpr_add_control_count = i;
2053 icode->gpr_add_controls = (emu10k1_fx8010_control_gpr_t __user *)controls; 2088 icode->gpr_add_controls = (struct snd_emu10k1_fx8010_control_gpr __user *)controls;
2054 err = snd_emu10k1_icode_poke(emu, icode); 2089 err = snd_emu10k1_icode_poke(emu, icode);
2055 snd_leave_user(seg); 2090 snd_leave_user(seg);
2056 if (err >= 0) 2091 if (err >= 0)
@@ -2065,7 +2100,7 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
2065 return err; 2100 return err;
2066} 2101}
2067 2102
2068int __devinit snd_emu10k1_init_efx(emu10k1_t *emu) 2103int __devinit snd_emu10k1_init_efx(struct snd_emu10k1 *emu)
2069{ 2104{
2070 if (emu->audigy) 2105 if (emu->audigy)
2071 return _snd_emu10k1_audigy_init_efx(emu); 2106 return _snd_emu10k1_audigy_init_efx(emu);
@@ -2073,7 +2108,7 @@ int __devinit snd_emu10k1_init_efx(emu10k1_t *emu)
2073 return _snd_emu10k1_init_efx(emu); 2108 return _snd_emu10k1_init_efx(emu);
2074} 2109}
2075 2110
2076void snd_emu10k1_free_efx(emu10k1_t *emu) 2111void snd_emu10k1_free_efx(struct snd_emu10k1 *emu)
2077{ 2112{
2078 /* stop processor */ 2113 /* stop processor */
2079 if (emu->audigy) 2114 if (emu->audigy)
@@ -2083,7 +2118,7 @@ void snd_emu10k1_free_efx(emu10k1_t *emu)
2083} 2118}
2084 2119
2085#if 0 // FIXME: who use them? 2120#if 0 // FIXME: who use them?
2086int snd_emu10k1_fx8010_tone_control_activate(emu10k1_t *emu, int output) 2121int snd_emu10k1_fx8010_tone_control_activate(struct snd_emu10k1 *emu, int output)
2087{ 2122{
2088 if (output < 0 || output >= 6) 2123 if (output < 0 || output >= 6)
2089 return -EINVAL; 2124 return -EINVAL;
@@ -2091,7 +2126,7 @@ int snd_emu10k1_fx8010_tone_control_activate(emu10k1_t *emu, int output)
2091 return 0; 2126 return 0;
2092} 2127}
2093 2128
2094int snd_emu10k1_fx8010_tone_control_deactivate(emu10k1_t *emu, int output) 2129int snd_emu10k1_fx8010_tone_control_deactivate(struct snd_emu10k1 *emu, int output)
2095{ 2130{
2096 if (output < 0 || output >= 6) 2131 if (output < 0 || output >= 6)
2097 return -EINVAL; 2132 return -EINVAL;
@@ -2100,7 +2135,7 @@ int snd_emu10k1_fx8010_tone_control_deactivate(emu10k1_t *emu, int output)
2100} 2135}
2101#endif 2136#endif
2102 2137
2103int snd_emu10k1_fx8010_tram_setup(emu10k1_t *emu, u32 size) 2138int snd_emu10k1_fx8010_tram_setup(struct snd_emu10k1 *emu, u32 size)
2104{ 2139{
2105 u8 size_reg = 0; 2140 u8 size_reg = 0;
2106 2141
@@ -2142,7 +2177,7 @@ int snd_emu10k1_fx8010_tram_setup(emu10k1_t *emu, u32 size)
2142 return 0; 2177 return 0;
2143} 2178}
2144 2179
2145static int snd_emu10k1_fx8010_open(snd_hwdep_t * hw, struct file *file) 2180static int snd_emu10k1_fx8010_open(struct snd_hwdep * hw, struct file *file)
2146{ 2181{
2147 return 0; 2182 return 0;
2148} 2183}
@@ -2155,7 +2190,8 @@ static void copy_string(char *dst, char *src, char *null, int idx)
2155 strcpy(dst, src); 2190 strcpy(dst, src);
2156} 2191}
2157 2192
2158static int snd_emu10k1_fx8010_info(emu10k1_t *emu, emu10k1_fx8010_info_t *info) 2193static int snd_emu10k1_fx8010_info(struct snd_emu10k1 *emu,
2194 struct snd_emu10k1_fx8010_info *info)
2159{ 2195{
2160 char **fxbus, **extin, **extout; 2196 char **fxbus, **extin, **extout;
2161 unsigned short fxbus_mask, extin_mask, extout_mask; 2197 unsigned short fxbus_mask, extin_mask, extout_mask;
@@ -2181,19 +2217,19 @@ static int snd_emu10k1_fx8010_info(emu10k1_t *emu, emu10k1_fx8010_info_t *info)
2181 return 0; 2217 return 0;
2182} 2218}
2183 2219
2184static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigned int cmd, unsigned long arg) 2220static int snd_emu10k1_fx8010_ioctl(struct snd_hwdep * hw, struct file *file, unsigned int cmd, unsigned long arg)
2185{ 2221{
2186 emu10k1_t *emu = hw->private_data; 2222 struct snd_emu10k1 *emu = hw->private_data;
2187 emu10k1_fx8010_info_t *info; 2223 struct snd_emu10k1_fx8010_info *info;
2188 emu10k1_fx8010_code_t *icode; 2224 struct snd_emu10k1_fx8010_code *icode;
2189 emu10k1_fx8010_pcm_t *ipcm; 2225 struct snd_emu10k1_fx8010_pcm_rec *ipcm;
2190 unsigned int addr; 2226 unsigned int addr;
2191 void __user *argp = (void __user *)arg; 2227 void __user *argp = (void __user *)arg;
2192 int res; 2228 int res;
2193 2229
2194 switch (cmd) { 2230 switch (cmd) {
2195 case SNDRV_EMU10K1_IOCTL_INFO: 2231 case SNDRV_EMU10K1_IOCTL_INFO:
2196 info = (emu10k1_fx8010_info_t *)kmalloc(sizeof(*info), GFP_KERNEL); 2232 info = kmalloc(sizeof(*info), GFP_KERNEL);
2197 if (!info) 2233 if (!info)
2198 return -ENOMEM; 2234 return -ENOMEM;
2199 if ((res = snd_emu10k1_fx8010_info(emu, info)) < 0) { 2235 if ((res = snd_emu10k1_fx8010_info(emu, info)) < 0) {
@@ -2209,7 +2245,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne
2209 case SNDRV_EMU10K1_IOCTL_CODE_POKE: 2245 case SNDRV_EMU10K1_IOCTL_CODE_POKE:
2210 if (!capable(CAP_SYS_ADMIN)) 2246 if (!capable(CAP_SYS_ADMIN))
2211 return -EPERM; 2247 return -EPERM;
2212 icode = (emu10k1_fx8010_code_t *)kmalloc(sizeof(*icode), GFP_KERNEL); 2248 icode = kmalloc(sizeof(*icode), GFP_KERNEL);
2213 if (icode == NULL) 2249 if (icode == NULL)
2214 return -ENOMEM; 2250 return -ENOMEM;
2215 if (copy_from_user(icode, argp, sizeof(*icode))) { 2251 if (copy_from_user(icode, argp, sizeof(*icode))) {
@@ -2220,7 +2256,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne
2220 kfree(icode); 2256 kfree(icode);
2221 return res; 2257 return res;
2222 case SNDRV_EMU10K1_IOCTL_CODE_PEEK: 2258 case SNDRV_EMU10K1_IOCTL_CODE_PEEK:
2223 icode = (emu10k1_fx8010_code_t *)kmalloc(sizeof(*icode), GFP_KERNEL); 2259 icode = kmalloc(sizeof(*icode), GFP_KERNEL);
2224 if (icode == NULL) 2260 if (icode == NULL)
2225 return -ENOMEM; 2261 return -ENOMEM;
2226 if (copy_from_user(icode, argp, sizeof(*icode))) { 2262 if (copy_from_user(icode, argp, sizeof(*icode))) {
@@ -2235,7 +2271,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne
2235 kfree(icode); 2271 kfree(icode);
2236 return res; 2272 return res;
2237 case SNDRV_EMU10K1_IOCTL_PCM_POKE: 2273 case SNDRV_EMU10K1_IOCTL_PCM_POKE:
2238 ipcm = (emu10k1_fx8010_pcm_t *)kmalloc(sizeof(*ipcm), GFP_KERNEL); 2274 ipcm = kmalloc(sizeof(*ipcm), GFP_KERNEL);
2239 if (ipcm == NULL) 2275 if (ipcm == NULL)
2240 return -ENOMEM; 2276 return -ENOMEM;
2241 if (copy_from_user(ipcm, argp, sizeof(*ipcm))) { 2277 if (copy_from_user(ipcm, argp, sizeof(*ipcm))) {
@@ -2327,14 +2363,14 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne
2327 return -ENOTTY; 2363 return -ENOTTY;
2328} 2364}
2329 2365
2330static int snd_emu10k1_fx8010_release(snd_hwdep_t * hw, struct file *file) 2366static int snd_emu10k1_fx8010_release(struct snd_hwdep * hw, struct file *file)
2331{ 2367{
2332 return 0; 2368 return 0;
2333} 2369}
2334 2370
2335int __devinit snd_emu10k1_fx8010_new(emu10k1_t *emu, int device, snd_hwdep_t ** rhwdep) 2371int __devinit snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device, struct snd_hwdep ** rhwdep)
2336{ 2372{
2337 snd_hwdep_t *hw; 2373 struct snd_hwdep *hw;
2338 int err; 2374 int err;
2339 2375
2340 if (rhwdep) 2376 if (rhwdep)