[alsa-devel] [PATCH 1/3] OMAP: McBSP: Use textual values in DMA operating mode sysfs files

Eduardo Valentin eduardo.valentin at nokia.com
Mon Aug 24 09:34:22 CEST 2009


On Mon, Aug 24, 2009 at 09:35:03AM +0200, Jarkko Nikula wrote:
> On Mon, 24 Aug 2009 09:49:41 +0300
> Eduardo Valentin <eduardo.valentin at nokia.com> wrote:
> 
> > > +			len += sprintf(buf + len, "[%s] ", *s);
> > > +		else
> > > +			len += sprintf(buf + len, "%s ", *s);
> > > +	}
> > > +	len += sprintf(len+buf, "\n");
> > 
> > Just a tiny thing, add spaces before and after + operator:
> > +	len += sprintf(len + buf, "\n");
> > 
> > > +	p = memchr(buf, '\n', size);
> > > +	len = p ? p - buf : size;
> > 
> > I guess here we have two better options, please use one of these:
> > * strstrip
> > * sysfs_streq
> > 
> Thanks Eduardo. I'll fix the first the one and use the sysfs_streq as
> it's much cleaner to use.
> 
> > >  
> > > -	spin_lock_irq(&mcbsp->lock);
> > > +	for (s = &dma_op_modes[i]; i < ARRAY_SIZE(dma_op_modes); s++, i++)
> > > +		if (*s && len == strlen(*s) && !strncmp(buf, *s, len))
> > 
> > how about using strnicmp ??
> > 
> Are there need for case insensitive check? The sysfs_streq is not.

Yes, sysfs_streq is not. There is no need for the insensitive, but
it can give user more options (ELEMENT or element)?

If using strcicmp, then strstrip would be required.

Just to reminder that strstrip does a wider job by cleaning any kind of
spaces. sysfs_streq deals only with 1 leading "\n".

> 
> I'll send a new version later this day.
> 
> 
> -- 
> Jarkko

-- 
Eduardo Valentin


More information about the Alsa-devel mailing list