linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: bjorn.andersson@linaro.org (Bjorn Andersson)
To: linux-arm-kernel@lists.infradead.org
Subject: [RESEND PATCH v2 07/15] ASoC: qcom: q6asm: Add support to memory map and unmap
Date: Wed, 3 Jan 2018 11:39:16 -0800	[thread overview]
Message-ID: <20180103193916.GZ478@tuxbook> (raw)
In-Reply-To: <4d1d17df-71a4-2896-29c1-9d033a2f3711@linaro.org>

On Wed 03 Jan 08:26 PST 2018, Srinivas Kandagatla wrote:

> Thanks for your review comments.
> 
> On 02/01/18 05:48, Bjorn Andersson wrote:
> > On Thu 14 Dec 09:33 PST 2017, srinivas.kandagatla at linaro.org wrote:
[..]
> > > +int q6asm_unmap_memory_regions(unsigned int dir, struct audio_client *ac)
> > > +{
> > > +	struct audio_port_data *port;
> > > +	int cnt = 0;
> > > +	int rc = 0;
> > > +
> > > +	mutex_lock(&ac->cmd_lock);
> > > +	port = &ac->port[dir];
> > > +	if (!port->buf) {
> > > +		mutex_unlock(&ac->cmd_lock);
> > > +		return 0;
> > 
> > Put a label right before the mutex_unlock below and return rc instead of
> > 0, then you can replace these two lines with "goto unlock"
> > 
> > > +	}
> > > +	cnt = port->max_buf_cnt - 1;
> > 
> > What if we mapped 1 period? Why shouldn't we enter the unmap path?
> > 
> It would enter into unmap path, as cnt  would be 0 for 1 period.
> 

You're right, I missed the = in the comparison, but I don't see a reason
to subtract 1. It seems like the max_buf_cnt might have been used
differently in the past?

I suggest that you drop the - 1 and change the comparison to cnt > 0, if
nothing else to not confuse me if I read this code again ;)

> > > +	if (cnt >= 0) {
[..]
> > > +int q6asm_map_memory_regions(unsigned int dir, struct audio_client *ac,
> > > +			     dma_addr_t phys,
> > > +			     unsigned int period_sz, unsigned int periods)
[..]
> > > +		ac->port[dir].max_buf_cnt = 0;
> > > +		kfree(buf);
> > > +		ac->port[dir].buf = NULL;
> > 
> > These operations are done without holding cmd_lock.
> > 
> I will revisit such instances where the buf is not protected.
> 

NB. I got the impression that cmd_lock was actually the port_lock in
most places.

Regards,
Bjorn

  reply	other threads:[~2018-01-03 19:39 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14 17:33 [RESEND PATCH v2 00/15] ASoC: qcom: Add support to QDSP6 based audio srinivas.kandagatla at linaro.org
2017-12-14 17:33 ` [RESEND PATCH v2 01/15] dt-bindings: soc: qcom: Add bindings for APR bus srinivas.kandagatla at linaro.org
2017-12-16 17:27   ` Rob Herring
2017-12-18  9:50     ` Srinivas Kandagatla
2018-01-03  0:35   ` Bjorn Andersson
2018-01-03 16:26     ` Srinivas Kandagatla
2017-12-14 17:33 ` [RESEND PATCH v2 02/15] soc: qcom: add support to APR bus driver srinivas.kandagatla at linaro.org
2018-01-01 23:29   ` Bjorn Andersson
2018-01-03 16:26     ` Srinivas Kandagatla
2017-12-14 17:33 ` [RESEND PATCH v2 03/15] ASoC: qcom: qdsp6: Add common qdsp6 helper functions srinivas.kandagatla at linaro.org
2018-01-02  0:19   ` Bjorn Andersson
2018-01-03 16:26     ` Srinivas Kandagatla
2017-12-14 17:33 ` [RESEND PATCH v2 04/15] ASoC: qcom: qdsp6: Add support to Q6AFE srinivas.kandagatla at linaro.org
2018-01-02  0:45   ` Bjorn Andersson
2018-01-03 16:26     ` Srinivas Kandagatla
2017-12-14 17:33 ` [RESEND PATCH v2 05/15] ASoC: qcom: qdsp6: Add support to Q6ADM srinivas.kandagatla at linaro.org
2018-01-02  1:50   ` Bjorn Andersson
2018-01-03 16:26     ` Srinivas Kandagatla
2017-12-14 17:33 ` [RESEND PATCH v2 06/15] ASoC: qcom: qdsp6: Add support to Q6ASM srinivas.kandagatla at linaro.org
2018-01-02  4:43   ` Bjorn Andersson
2018-01-03 16:26     ` Srinivas Kandagatla
2017-12-14 17:33 ` [RESEND PATCH v2 07/15] ASoC: qcom: q6asm: Add support to memory map and unmap srinivas.kandagatla at linaro.org
2018-01-02  5:48   ` Bjorn Andersson
2018-01-03 16:26     ` Srinivas Kandagatla
2018-01-03 19:39       ` Bjorn Andersson [this message]
2017-12-14 17:33 ` [RESEND PATCH v2 08/15] ASoC: qcom: q6asm: add support to audio stream apis srinivas.kandagatla at linaro.org
2018-01-02 20:08   ` Bjorn Andersson
2018-01-03 16:26     ` Srinivas Kandagatla
2018-01-13  8:42   ` [alsa-devel] " Rohit Kumar
2017-12-14 17:33 ` [RESEND PATCH v2 09/15] ASoC: qcom: qdsp6: Add support to Q6CORE srinivas.kandagatla at linaro.org
2018-01-02 22:15   ` Bjorn Andersson
2018-01-03 16:27     ` Srinivas Kandagatla
2018-02-07 12:15   ` [alsa-devel] " Rohit Kumar
2017-12-14 17:33 ` [RESEND PATCH v2 10/15] ASoC: qcom: qdsp6: Add support to q6routing driver srinivas.kandagatla at linaro.org
2018-01-02 23:00   ` Bjorn Andersson
2018-01-03 16:27     ` Srinivas Kandagatla
2017-12-14 17:33 ` [RESEND PATCH v2 11/15] ASoC: qcom: qdsp6: Add support to q6afe dai driver srinivas.kandagatla at linaro.org
2018-01-02 23:28   ` Bjorn Andersson
2018-01-03 16:27     ` Srinivas Kandagatla
2018-02-07 11:34   ` [alsa-devel] " Rohit Kumar
2018-02-07 11:40     ` Srinivas Kandagatla
2017-12-14 17:33 ` [RESEND PATCH v2 12/15] ASoC: qcom: qdsp6: Add support to q6asm " srinivas.kandagatla at linaro.org
2018-01-03  0:03   ` Bjorn Andersson
2018-01-03 16:27     ` Srinivas Kandagatla
2018-01-13  8:45   ` [alsa-devel] " Rohit Kumar
2017-12-14 17:34 ` [RESEND PATCH v2 13/15] dt-bindings: sound: qcom: Add devicetree bindings for apq8096 srinivas.kandagatla at linaro.org
2017-12-16 17:44   ` Rob Herring
2017-12-18  9:49     ` Srinivas Kandagatla
2018-01-03  0:28   ` Bjorn Andersson
2018-01-03 16:27     ` Srinivas Kandagatla
2018-01-03 19:49       ` Bjorn Andersson
2017-12-14 17:34 ` [RESEND PATCH v2 14/15] ASoC: qcom: apq8096: Add db820c machine driver srinivas.kandagatla at linaro.org
2018-01-03  0:16   ` Bjorn Andersson
2018-01-03 16:27     ` Srinivas Kandagatla
2018-01-03 20:04       ` Bjorn Andersson
2018-01-03 17:20   ` Stephen Boyd
2018-01-03 18:36     ` Srinivas Kandagatla
2018-01-03 19:41       ` Stephen Boyd
2018-01-04  9:25         ` Srinivas Kandagatla
2018-01-04 12:02     ` Mark Brown
2018-01-04 13:44       ` Srinivas Kandagatla
2018-01-04 14:03         ` Mark Brown
2017-12-14 17:34 ` [RESEND PATCH v2 15/15] arm64: dts: msm8996: db820c: Add sound card support srinivas.kandagatla at linaro.org
2018-01-03  0:22   ` Bjorn Andersson
2018-01-03 16:27     ` Srinivas Kandagatla
2018-01-03 20:01       ` Bjorn Andersson

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=20180103193916.GZ478@tuxbook \
    --to=bjorn.andersson@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).