[alsa-devel] [PATCH 04/14] ASoC: Allow codecs to override register display
Takashi Iwai
tiwai at suse.de
Fri Aug 1 17:49:54 CEST 2008
At Fri, 1 Aug 2008 16:35:40 +0100,
Mark Brown wrote:
>
> On Fri, Aug 01, 2008 at 05:23:27PM +0200, Takashi Iwai wrote:
> > Jon Smirl wrote:
>
> > > - count += codec->display_register(codec, buf + count,
> > > - PAGE_SIZE - count, i);
>
> ...
>
> > > + count += codec->display_register(codec,
> > > + buf + count, PAGE_SIZE - count, i);
>
> > Please make it fit in 80 chars like the original code.
>
> This also seems to be an indentation-only change but perhaps I'm missing
> something here?
In the new code, display_register() prints both the index and the
value. This allows you to skip the unnecessary registers.
> > > - /* Truncate count; min() would cause a warning */
> > > - if (count >= PAGE_SIZE)
> > > - count = PAGE_SIZE - 1;
> > > -
>
> > Really safe to remove this?
>
> No. snprintf() returns how many bytes it wanted to write, not the
> number of bytes it wrote, which means that if the end of the buffer is
> hit then count will include the overspill and sysfs will complain.
Ah, yes. Then it has to be checked.
thanks,
Takashi
More information about the Alsa-devel
mailing list