From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2915BC43603 for ; Thu, 5 Dec 2019 08:26:40 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A7FBD24249 for ; Thu, 5 Dec 2019 08:26:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Wdvz8TQ0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7FBD24249 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C8F6C165E; Thu, 5 Dec 2019 09:25:47 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C8F6C165E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1575534397; bh=GvQWn4x1z4NPpTZWg6i3Ip8USHQ+9c3JhCnGGT4n4H8=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Wdvz8TQ0+m2QAp0MHmV31F3Hgr9vZXQTYt5jrXKkZK4Q61FO2/EqrR1CI3qvRKgkO mLrXoJKeByvcYQymTg8Fjt/9Zmdku5N1I69QDBuHJ2qRkzdrRfdJbShz12A1qXqGQD mS3DY2xtIeEp6lZh+Q8febh9o4Eclush/saPO/xk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 53897F8015A; Thu, 5 Dec 2019 09:25:47 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3B597F801F8; Thu, 5 Dec 2019 09:25:36 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 81626F8010F for ; Thu, 5 Dec 2019 09:25:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 81626F8010F X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 91DE7B2E0; Thu, 5 Dec 2019 08:25:32 +0000 (UTC) Date: Thu, 05 Dec 2019 09:25:32 +0100 Message-ID: From: Takashi Iwai To: Daniel Mack In-Reply-To: <20191205081428.611572-1-daniel@zonque.org> References: <20191205081428.611572-1-daniel@zonque.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: alsa-devel@alsa-project.org, broonie@kernel.org Subject: Re: [alsa-devel] [PATCH 1/2] ALSA: core: add snd_pcm_format_by_name() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Thu, 05 Dec 2019 09:14:27 +0100, Daniel Mack wrote: > > Add a new function to look up PCM format codes by name. This can be used > by ASoC drivers to look up formats through device-tree properties, for > instance. > > Signed-off-by: Daniel Mack > --- > include/sound/pcm.h | 1 + > sound/core/pcm.c | 12 ++++++++++++ > 2 files changed, 13 insertions(+) > > diff --git a/include/sound/pcm.h b/include/sound/pcm.h > index bbe6eb1ff5d2..ce398caf12ba 100644 > --- a/include/sound/pcm.h > +++ b/include/sound/pcm.h > @@ -1339,6 +1339,7 @@ static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max) > #define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime) > > const char *snd_pcm_format_name(snd_pcm_format_t format); > +snd_pcm_format_t snd_pcm_format_by_name(const char *name); > > /** > * snd_pcm_stream_str - Get a string naming the direction of a stream > diff --git a/sound/core/pcm.c b/sound/core/pcm.c > index 9a72d641743d..248f2dca7a12 100644 > --- a/sound/core/pcm.c > +++ b/sound/core/pcm.c > @@ -225,6 +225,18 @@ const char *snd_pcm_format_name(snd_pcm_format_t format) > } > EXPORT_SYMBOL_GPL(snd_pcm_format_name); > > +snd_pcm_format_t snd_pcm_format_by_name(const char *name) > +{ Could you give the proper document in kernel-doc style? We try to provide some documentation at least for public API functions. > + int i; > + > + for (i = 0; i < ARRAY_SIZE(snd_pcm_format_names); i++) > + if (strcasecmp(name, snd_pcm_format_names[i]) == 0) > + return i; > + > + return -ENOENT; snd_pcm_format_t is with __bitwise, hence this would lead to some warning for sparse, I guess. thanks, Takashi _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel