Skip to content

Commit c72fad7

Browse files
chleroytiwai
authored andcommitted
ALSA: pcm: Replace [audio_]tstamp_[n]sec by struct __snd_timespec in struct snd_pcm_mmap_status32
To match struct __snd_pcm_mmap_status and enable reuse of snd_pcm_sync_ptr_get_user() and snd_pcm_sync_ptr_put_user() by snd_pcm_sync_ptr() replace tstamp_sec and tstamp_nsec fields by a struct __snd_timespec in struct snd_pcm_mmap_status32. Do the same with audio_tstamp_sec and audio_tstamp_nsec. This is possible because struct snd_pcm_mmap_status32 is packed and __SND_STRUCT_TIME64 is always defined for kernel which means struct __snd_timespec is always defined as: struct __snd_timespec { __s32 tv_sec; __s32 tv_nsec; }; Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/df8ea1a9aff61c3e358759b1f495bdb9fb8a3e6a.1749883041.git.christophe.leroy@csgroup.eu
1 parent a9b49bf commit c72fad7

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

sound/core/pcm_compat.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,12 +377,10 @@ struct snd_pcm_mmap_status_x32 {
377377
s32 pad1;
378378
u32 hw_ptr;
379379
u32 pad2; /* alignment */
380-
s64 tstamp_sec;
381-
s64 tstamp_nsec;
380+
struct __snd_timespec64 tstamp;
382381
snd_pcm_state_t suspended_state;
383382
s32 pad3;
384-
s64 audio_tstamp_sec;
385-
s64 audio_tstamp_nsec;
383+
struct __snd_timespec64 audio_tstamp;
386384
} __packed;
387385

388386
struct snd_pcm_mmap_control_x32 {

sound/core/pcm_native.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3078,11 +3078,11 @@ failed_begin: \
30783078
goto failed_begin; \
30793079
unsafe_put_user(__s.state, &__src->s.status.state, failed); \
30803080
unsafe_put_user(__s.hw_ptr, &__src->s.status.hw_ptr, failed); \
3081-
unsafe_put_user(__s.tstamp.tv_sec, &__src->s.status.tstamp_sec, failed);\
3082-
unsafe_put_user(__s.tstamp.tv_nsec, &__src->s.status.tstamp_nsec, failed); \
3081+
unsafe_put_user(__s.tstamp.tv_sec, &__src->s.status.tstamp.tv_sec, failed); \
3082+
unsafe_put_user(__s.tstamp.tv_nsec, &__src->s.status.tstamp.tv_nsec, failed); \
30833083
unsafe_put_user(__s.suspended_state, &__src->s.status.suspended_state, failed); \
3084-
unsafe_put_user(__s.audio_tstamp.tv_sec, &__src->s.status.audio_tstamp_sec, failed); \
3085-
unsafe_put_user(__s.audio_tstamp.tv_nsec, &__src->s.status.audio_tstamp_nsec, failed); \
3084+
unsafe_put_user(__s.audio_tstamp.tv_sec, &__src->s.status.audio_tstamp.tv_sec, failed); \
3085+
unsafe_put_user(__s.audio_tstamp.tv_nsec, &__src->s.status.audio_tstamp.tv_nsec, failed);\
30863086
unsafe_put_user(__c.appl_ptr, &__src->c.control.appl_ptr, failed); \
30873087
unsafe_put_user(__c.avail_min, &__src->c.control.avail_min, failed); \
30883088
__err = 0; \
@@ -3143,11 +3143,9 @@ struct snd_pcm_mmap_status32 {
31433143
snd_pcm_state_t state;
31443144
s32 pad1;
31453145
u32 hw_ptr;
3146-
s32 tstamp_sec;
3147-
s32 tstamp_nsec;
3146+
struct __snd_timespec tstamp;
31483147
snd_pcm_state_t suspended_state;
3149-
s32 audio_tstamp_sec;
3150-
s32 audio_tstamp_nsec;
3148+
struct __snd_timespec audio_tstamp;
31513149
} __packed;
31523150

31533151
struct snd_pcm_mmap_control32 {

0 commit comments

Comments
 (0)