diff options
-rw-r--r-- | include/sound/timer.h | 1 | ||||
-rw-r--r-- | sound/core/timer.c | 23 |
2 files changed, 12 insertions, 12 deletions
diff --git a/include/sound/timer.h b/include/sound/timer.h index 7990469a44ce..c4d76ff056c6 100644 --- a/include/sound/timer.h +++ b/include/sound/timer.h | |||
@@ -104,6 +104,7 @@ struct snd_timer_instance { | |||
104 | int event, | 104 | int event, |
105 | struct timespec * tstamp, | 105 | struct timespec * tstamp, |
106 | unsigned long resolution); | 106 | unsigned long resolution); |
107 | void (*disconnect)(struct snd_timer_instance *timeri); | ||
107 | void *callback_data; | 108 | void *callback_data; |
108 | unsigned long ticks; /* auto-load ticks when expired */ | 109 | unsigned long ticks; /* auto-load ticks when expired */ |
109 | unsigned long cticks; /* current ticks */ | 110 | unsigned long cticks; /* current ticks */ |
diff --git a/sound/core/timer.c b/sound/core/timer.c index 681fb051b9eb..af1f68f7e315 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -899,11 +899,6 @@ static int snd_timer_dev_register(struct snd_device *dev) | |||
899 | return 0; | 899 | return 0; |
900 | } | 900 | } |
901 | 901 | ||
902 | /* just for reference in snd_timer_dev_disconnect() below */ | ||
903 | static void snd_timer_user_ccallback(struct snd_timer_instance *timeri, | ||
904 | int event, struct timespec *tstamp, | ||
905 | unsigned long resolution); | ||
906 | |||
907 | static int snd_timer_dev_disconnect(struct snd_device *device) | 902 | static int snd_timer_dev_disconnect(struct snd_device *device) |
908 | { | 903 | { |
909 | struct snd_timer *timer = device->device_data; | 904 | struct snd_timer *timer = device->device_data; |
@@ -913,13 +908,8 @@ static int snd_timer_dev_disconnect(struct snd_device *device) | |||
913 | list_del_init(&timer->device_list); | 908 | list_del_init(&timer->device_list); |
914 | /* wake up pending sleepers */ | 909 | /* wake up pending sleepers */ |
915 | list_for_each_entry(ti, &timer->open_list_head, open_list) { | 910 | list_for_each_entry(ti, &timer->open_list_head, open_list) { |
916 | /* FIXME: better to have a ti.disconnect() op */ | 911 | if (ti->disconnect) |
917 | if (ti->ccallback == snd_timer_user_ccallback) { | 912 | ti->disconnect(ti); |
918 | struct snd_timer_user *tu = ti->callback_data; | ||
919 | |||
920 | tu->disconnected = true; | ||
921 | wake_up(&tu->qchange_sleep); | ||
922 | } | ||
923 | } | 913 | } |
924 | mutex_unlock(®ister_mutex); | 914 | mutex_unlock(®ister_mutex); |
925 | return 0; | 915 | return 0; |
@@ -1227,6 +1217,14 @@ static void snd_timer_user_ccallback(struct snd_timer_instance *timeri, | |||
1227 | wake_up(&tu->qchange_sleep); | 1217 | wake_up(&tu->qchange_sleep); |
1228 | } | 1218 | } |
1229 | 1219 | ||
1220 | static void snd_timer_user_disconnect(struct snd_timer_instance *timeri) | ||
1221 | { | ||
1222 | struct snd_timer_user *tu = timeri->callback_data; | ||
1223 | |||
1224 | tu->disconnected = true; | ||
1225 | wake_up(&tu->qchange_sleep); | ||
1226 | } | ||
1227 | |||
1230 | static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri, | 1228 | static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri, |
1231 | unsigned long resolution, | 1229 | unsigned long resolution, |
1232 | unsigned long ticks) | 1230 | unsigned long ticks) |
@@ -1600,6 +1598,7 @@ static int snd_timer_user_tselect(struct file *file, | |||
1600 | ? snd_timer_user_tinterrupt : snd_timer_user_interrupt; | 1598 | ? snd_timer_user_tinterrupt : snd_timer_user_interrupt; |
1601 | tu->timeri->ccallback = snd_timer_user_ccallback; | 1599 | tu->timeri->ccallback = snd_timer_user_ccallback; |
1602 | tu->timeri->callback_data = (void *)tu; | 1600 | tu->timeri->callback_data = (void *)tu; |
1601 | tu->timeri->disconnect = snd_timer_user_disconnect; | ||
1603 | } | 1602 | } |
1604 | 1603 | ||
1605 | __err: | 1604 | __err: |