Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Vinod Koul <vinod.koul@intel.com>, alsa-devel@alsa-project.org
Subject: Re: [PATCH 1/5] compress: remove dead code _is_codec_supported()
Date: Thu, 19 Apr 2018 00:19:28 -0700	[thread overview]
Message-ID: <6b870058-e263-775f-f70b-55f159537666@linux.intel.com> (raw)
In-Reply-To: <1524119780-21206-1-git-send-email-vinod.koul@intel.com>

On 4/18/18 11:36 PM, Vinod Koul wrote:
> The _is_codec_supported() was dead and none using it, so remove this and
> eliminate unused function warning
> 
> compress.c:145:13: warning: ‘_is_codec_supported’ defined but not used [-Wunused-function]
> 
> We can take from git if user appears
> 
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> ---
>   src/lib/compress.c | 53 -----------------------------------------------------
>   1 file changed, 53 deletions(-)
> 
> diff --git a/src/lib/compress.c b/src/lib/compress.c
> index 8ae6bbda7a89..934690e39ed0 100644
> --- a/src/lib/compress.c
> +++ b/src/lib/compress.c
> @@ -142,49 +142,6 @@ static int get_compress_version(struct compress *compress)
>   	return version;
>   }
>   
> -static bool _is_codec_supported(struct compress *compress, struct compr_config *config,
> -				const struct snd_compr_caps *caps)
> -{
> -	bool codec = false;
> -	unsigned int i;
> -
> -	for (i = 0; i < caps->num_codecs; i++) {
> -		if (caps->codecs[i] == config->codec->id) {
> -			/* found the codec */
> -			codec = true;
> -			break;
> -		}
> -	}
> -	if (codec == false) {
> -		oops(compress, ENXIO, "this codec is not supported");
> -		return false;
> -	}
> -
> -	if (config->fragment_size < caps->min_fragment_size) {
> -		oops(compress, EINVAL, "requested fragment size %d is below min supported %d",
> -			config->fragment_size, caps->min_fragment_size);
> -		return false;
> -	}
> -	if (config->fragment_size > caps->max_fragment_size) {
> -		oops(compress, EINVAL, "requested fragment size %d is above max supported %d",
> -			config->fragment_size, caps->max_fragment_size);
> -		return false;
> -	}
> -	if (config->fragments < caps->min_fragments) {
> -		oops(compress, EINVAL, "requested fragments %d are below min supported %d",
> -			config->fragments, caps->min_fragments);
> -		return false;
> -	}
> -	if (config->fragments > caps->max_fragments) {
> -		oops(compress, EINVAL, "requested fragments %d are above max supported %d",
> -			config->fragments, caps->max_fragments);
> -		return false;
> -	}
> -
> -	/* TODO: match the codec properties */
> -	return true;
> -}
> -
>   static bool _is_codec_type_supported(int fd, struct snd_codec *codec)
>   {
>   	struct snd_compr_caps caps;
> @@ -271,16 +228,6 @@ struct compress *compress_open(unsigned int card, unsigned int device,
>   		config->fragments = caps.max_fragments;
>   	}
>   
> -#if 0
> -	/* FIXME need to turn this On when DSP supports
> -	 * and treat in no support case
> -	 */
> -	if (_is_codec_supported(compress, config, &caps) == false) {
> -		oops(compress, errno, "codec not supported\n");
> -		goto codec_fail;
> -	}
> -#endif

Why was this commented out in the first place?

This seems like a valid check to me. If the application is asking for a 
codec that isn't supported by hardware, should it be allowed to proceed?

> -
>   	memcpy(compress->config, config, sizeof(*compress->config));
>   	fill_compress_params(config, &params);
>   
> 

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2018-04-19  7:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-19  6:36 [PATCH 1/5] compress: remove dead code _is_codec_supported() Vinod Koul
2018-04-19  6:36 ` [PATCH 2/5] cplay: remove dead code codec_name_from_id() Vinod Koul
2018-04-19  6:36 ` [PATCH 3/5] cplay: remove dead code check_codec_format_supported() Vinod Koul
2018-04-19  6:36 ` [PATCH 4/5] cplay: fix incorrect print specifier warning Vinod Koul
2018-04-19  6:36 ` [PATCH 5/5] crecord: " Vinod Koul
2018-04-19  7:19 ` Pierre-Louis Bossart [this message]
2018-04-19  8:08   ` [PATCH 1/5] compress: remove dead code _is_codec_supported() Vinod Koul
2018-04-20 22:20     ` Pierre-Louis Bossart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b870058-e263-775f-f70b-55f159537666@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox