|
20 | 20 | #include "seq_timer.h" |
21 | 21 | #include "seq_info.h" |
22 | 22 | #include "seq_system.h" |
| 23 | +#include "seq_ump_convert.h" |
23 | 24 | #include <sound/seq_device.h> |
24 | 25 | #ifdef CONFIG_COMPAT |
25 | 26 | #include <linux/compat.h> |
@@ -612,6 +613,27 @@ static int update_timestamp_of_queue(struct snd_seq_event *event, |
612 | 613 | return 1; |
613 | 614 | } |
614 | 615 |
|
| 616 | +/* deliver a single event; called from below and UMP converter */ |
| 617 | +int __snd_seq_deliver_single_event(struct snd_seq_client *dest, |
| 618 | + struct snd_seq_client_port *dest_port, |
| 619 | + struct snd_seq_event *event, |
| 620 | + int atomic, int hop) |
| 621 | +{ |
| 622 | + switch (dest->type) { |
| 623 | + case USER_CLIENT: |
| 624 | + if (!dest->data.user.fifo) |
| 625 | + return 0; |
| 626 | + return snd_seq_fifo_event_in(dest->data.user.fifo, event); |
| 627 | + case KERNEL_CLIENT: |
| 628 | + if (!dest_port->event_input) |
| 629 | + return 0; |
| 630 | + return dest_port->event_input(event, |
| 631 | + snd_seq_ev_is_direct(event), |
| 632 | + dest_port->private_data, |
| 633 | + atomic, hop); |
| 634 | + } |
| 635 | + return 0; |
| 636 | +} |
615 | 637 |
|
616 | 638 | /* |
617 | 639 | * deliver an event to the specified destination. |
@@ -648,22 +670,20 @@ static int snd_seq_deliver_single_event(struct snd_seq_client *client, |
648 | 670 | update_timestamp_of_queue(event, dest_port->time_queue, |
649 | 671 | dest_port->time_real); |
650 | 672 |
|
651 | | - switch (dest->type) { |
652 | | - case USER_CLIENT: |
653 | | - if (dest->data.user.fifo) |
654 | | - result = snd_seq_fifo_event_in(dest->data.user.fifo, event); |
655 | | - break; |
| 673 | +#if IS_ENABLED(CONFIG_SND_SEQ_UMP) |
| 674 | + if (snd_seq_ev_is_ump(event)) { |
| 675 | + result = snd_seq_deliver_from_ump(client, dest, dest_port, |
| 676 | + event, atomic, hop); |
| 677 | + goto __skip; |
| 678 | + } else if (snd_seq_client_is_ump(dest)) { |
| 679 | + result = snd_seq_deliver_to_ump(client, dest, dest_port, |
| 680 | + event, atomic, hop); |
| 681 | + goto __skip; |
| 682 | + } |
| 683 | +#endif /* CONFIG_SND_SEQ_UMP */ |
656 | 684 |
|
657 | | - case KERNEL_CLIENT: |
658 | | - if (dest_port->event_input == NULL) |
659 | | - break; |
660 | | - result = dest_port->event_input(event, direct, |
661 | | - dest_port->private_data, |
| 685 | + result = __snd_seq_deliver_single_event(dest, dest_port, event, |
662 | 686 | atomic, hop); |
663 | | - break; |
664 | | - default: |
665 | | - break; |
666 | | - } |
667 | 687 |
|
668 | 688 | __skip: |
669 | 689 | if (dest_port) |
|
0 commit comments