All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Vinod Koul <vinod.koul@intel.com>
Cc: patches.audio@intel.com, liam.r.girdwood@linux.intel.com,
	alsa-devel@alsa-project.org,
	"Subhransu S. Prusty" <subhransu.s.prusty@intel.com>,
	Jeeja KP <jeeja.kp@intel.com>
Subject: Re: [PATCH v2 1/9] ASoC: Intel: Skylake: Add pipe and modules handlers
Date: Sat, 19 Sep 2015 09:00:23 -0700	[thread overview]
Message-ID: <20150919160023.GC30445@sirena.org.uk> (raw)
In-Reply-To: <1439832404-12424-2-git-send-email-vinod.koul@intel.com>


[-- Attachment #1.1: Type: text/plain, Size: 2002 bytes --]

On Mon, Aug 17, 2015 at 10:56:36PM +0530, Vinod Koul wrote:

> +static int skl_tplg_bind_unbind_pipes(struct skl_module_cfg *src_module,
> +	struct skl_module_cfg *sink_module, struct skl_sst *ctx, bool bind)
> +{
> +	int ret;
> +
> +	if (!bind) {
> +		ret = skl_stop_pipe(ctx, src_module->pipe);
> +		if (ret < 0)
> +			return ret;
> +
> +		ret = skl_unbind_modules(ctx, src_module, sink_module);
> +	} else {
> +		ret = skl_bind_modules(ctx, src_module, sink_module);
> +	}
> +
> +	return ret;
> +}

Can we *please* stop having these functions which optionally do several
different things with nothing at all shared between the different paths?
It just adds a layer of indentation in the function and makes everything
harder to read (including at the call site - how does the reader know if
a given call will bind or unbind?).

I'm sure I've raised this before.

> +static bool skl_tplg_is_pipe_mem_available(struct skl *skl,
> +                               struct skl_module_cfg *mconfig)

I'm not seeing any users of this function (unlike the mcps checker).

> +	if (skl->resource.mem + mconfig->pipe->memory_pages > skl->resource.max_mem) {
> +		dev_err(ctx->dev, "exceeds ppl memory available=%d > mem=%d\n",
> +				skl->resource.max_mem, skl->resource.mem);
> +		return false;
> +	}

I'm not sure how the user is going to be able to tell what exceeded the
maximum memory here.  

> +static bool skl_tplg_is_pipe_mcps_available(struct skl *skl,
> +				struct skl_module_cfg *mconfig)

This looks an awful lot like the memory check.  Can we make a struct or
ideally array for the constraints and then have a single function which
checks them all?

> +	list_for_each_entry(p, &w->sinks, list_source) {
> +		if ((p->sink->priv == NULL)
> +			&& (!is_skl_dsp_widget_type(w)))
> +			continue;
> +
> +		if ((p->sink->priv != NULL) && (p->connect)
> +			&& (is_skl_dsp_widget_type(p->sink))) {

This is harder to read with the extra brackets.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2015-09-20  0:32 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-17 17:26 [PATCH v2 0/9] Add DSP topology management for SKL Vinod Koul
2015-08-17 17:26 ` [PATCH v2 1/9] ASoC: Intel: Skylake: Add pipe and modules handlers Vinod Koul
2015-09-19 16:00   ` Mark Brown [this message]
2015-09-21  3:37     ` Vinod Koul
2015-09-21 16:36       ` Mark Brown
2015-08-17 17:26 ` [PATCH v2 2/9] ASoC: Intel: Skylake: Add module configuration helpers Vinod Koul
2015-08-17 17:26 ` [PATCH v2 3/9] ASoC: Intel: Skylake: add DSP platform widget event handlers Vinod Koul
2015-09-17  9:47   ` Liam Girdwood
2015-09-17 11:38     ` Vinod Koul
2015-09-17 12:25       ` Liam Girdwood
2015-09-18  4:22         ` Vinod Koul
2015-09-19 16:11   ` Mark Brown
2015-09-21  3:24     ` Vinod Koul
2015-08-17 17:26 ` [PATCH v2 4/9] ASoC: Intel: Skylake: Add FE and BE hw_params handling Vinod Koul
2015-09-19 16:22   ` Mark Brown
2015-09-21  3:13     ` Vinod Koul
2015-08-17 17:26 ` [PATCH v2 5/9] ASoC: Intel: Skylake: Add topology core init and handlers Vinod Koul
2015-09-18  9:55   ` Liam Girdwood
2015-09-18 15:09     ` Vinod Koul
2015-08-17 17:26 ` [PATCH v2 6/9] ASoC: Intel: Skylake: Initialize and load DSP controls Vinod Koul
2015-09-18  9:58   ` Liam Girdwood
2015-09-18 15:11     ` Vinod Koul
2015-09-19 16:26     ` Mark Brown
2015-09-21  3:26       ` Vinod Koul
2015-08-17 17:26 ` [PATCH v2 7/9] ASoC: Intel: Skylake: Add DSP support and enable it Vinod Koul
2015-08-17 17:26 ` [PATCH v2 8/9] ASoC: Intel: Skylake: Initialize NHLT table Vinod Koul
2015-09-19 16:27   ` Mark Brown
2015-09-21  3:38     ` Vinod Koul
2015-08-17 17:26 ` [PATCH v2 9/9] ASoC: Intel: Skylake: Remove unused CPU dai's Vinod Koul
2015-09-03  8:14 ` [PATCH v2 0/9] Add DSP topology management for SKL Vinod Koul
2015-09-11 11:45   ` Mark Brown
2015-09-19 16:56     ` Mark Brown
2015-09-21  3:57       ` Vinod Koul
2015-09-21 16:33         ` Mark Brown
2015-09-21 16:47           ` Vinod Koul

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=20150919160023.GC30445@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=jeeja.kp@intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=patches.audio@intel.com \
    --cc=subhransu.s.prusty@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.