From: Takashi Iwai Subject: Re: [PATCH 04/14] ASoC: Allow codecs to override register display Date: Fri, 01 Aug 2008 17:49:54 +0200 Message-ID: References: <1217328155-30158-1-git-send-email-broonie@opensource.wolfsonmicro.com> <1217328155-30158-2-git-send-email-broonie@opensource.wolfsonmicro.com> <1217328155-30158-3-git-send-email-broonie@opensource.wolfsonmicro.com> <1217328155-30158-4-git-send-email-broonie@opensource.wolfsonmicro.com> <9e4733910807311841v3ebe98f5i327606d7d793f832@mail.gmail.com> <20080801100003.GA16420@rakim.wolfsonmicro.main> <9e4733910808010750x69e71cd2i21eb0b448e11544a@mail.gmail.com> <20080801153538.GA11735@sirena.org.uk> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id AA11124465 for ; Fri, 1 Aug 2008 18:04:40 +0200 (CEST) In-Reply-To: <20080801153538.GA11735@sirena.org.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Mark Brown Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org 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