[alsa-devel] [PATCH v2 2/3] ALSA: core: add hooks for audio timestamps

Takashi Iwai tiwai at suse.de
Wed Oct 10 07:17:00 CEST 2012


At Tue, 09 Oct 2012 18:50:17 -0500,
Pierre-Louis Bossart wrote:
> 
> On 10/09/2012 04:33 AM, Takashi Iwai wrote:
> >> +	struct timespec audio_tstamp;
> >
> > It must be struct compat_timespec...
> 
> ok
> 
> 
> >> +	    put_user(status.suspended_state, &src->suspended_state) ||
> >> +	    put_user(status.audio_tstamp.tv_sec, &src->audio_tstamp.tv_sec) ||
> >> +	    put_user(status.audio_tstamp.tv_nsec, &src->audio_tstamp.tv_nsec))
> >
> > ... and use compat_put_timespec().
> 
> I don't get this. I copy/pasted the code used for regular timestamps. 

You copied a too old code that was written before the helper functions
were introduced :)

> Why should it be any different for audio timestamps?

The other parts should be rewritten, too.

> >>   	if (put_user(sstatus.state, &src->s.status.state) ||
> >>   	    put_user(sstatus.hw_ptr, &src->s.status.hw_ptr) ||
> >>   	    put_user(sstatus.tstamp.tv_sec, &src->s.status.tstamp.tv_sec) ||
> >>   	    put_user(sstatus.tstamp.tv_nsec, &src->s.status.tstamp.tv_nsec) ||
> >>   	    put_user(sstatus.suspended_state, &src->s.status.suspended_state) ||
> >> +	    put_user(sstatus.audio_tstamp.tv_sec,
> >> +		    &src->s.status.audio_tstamp.tv_sec) ||
> >> +	    put_user(sstatus.audio_tstamp.tv_nsec,
> >> +		    &src->s.status.audio_tstamp.tv_nsec) ||
> >
> > Ditto.
> 
> Again I don't see why I should make a difference between tstamp and 
> audio_tstamp? It's really the same type, so either my code is correct or 
> the existing code is wrong as well.

It's not about wrong or correct.  It's a question about worse or
better.


Takashi


More information about the Alsa-devel mailing list