LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org, linux-spi@vger.kernel.org,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Kumar Gala <galak@codeaurora.org>,
Andy Gross <agross@codeaurora.org>,
Sagar Dharia <sdharia@codeaurora.org>,
Daniel Sneddon <dsneddon@codeaurora.org>
Subject: Re: [PATCH v2] spi: qup: Add DMA capabilities
Date: Tue, 24 Feb 2015 22:56:23 +0900 [thread overview]
Message-ID: <20150224135622.GH6236@finisterre.sirena.org.uk> (raw)
In-Reply-To: <1424782803-13103-1-git-send-email-stanimir.varbanov@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 790 bytes --]
On Tue, Feb 24, 2015 at 03:00:03PM +0200, Stanimir Varbanov wrote:
> +static void spi_qup_dma_done(void *data)
> +{
> + struct spi_qup *qup = data;
> +
> + if (atomic_dec_and_test(&qup->dma_outstanding))
> + complete(&qup->done);
> +}
I'm finding it hard to be thrilled about the use of atomics for
synchronization (they're just generally hard to work with) and...
> + cookie = dmaengine_submit(desc);
> + ret = dma_submit_error(cookie);
> + if (ret)
> + return ret;
> + atomic_inc(&qup->dma_outstanding);
..don't we have two potential races here: one if somehow the DMA manages
to complete prior to the atomic_inc() (unlikely but that's what race
conditions are all about really) and one if we are issuing multiple DMAs
and the early ones complete before the later ones are issued?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2015-02-24 13:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-24 13:00 Stanimir Varbanov
2015-02-24 13:56 ` Mark Brown [this message]
2015-02-24 16:08 ` Stanimir Varbanov
2015-02-24 22:38 ` Andy Gross
2015-02-26 2:33 ` Mark Brown
2015-02-27 14:46 ` Stanimir Varbanov
2015-02-24 16:09 ` Ivan T. Ivanov
2015-02-24 17:11 ` Ivan T. Ivanov
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=20150224135622.GH6236@finisterre.sirena.org.uk \
--to=broonie@kernel.org \
--cc=agross@codeaurora.org \
--cc=devicetree@vger.kernel.org \
--cc=dsneddon@codeaurora.org \
--cc=galak@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=sdharia@codeaurora.org \
--cc=stanimir.varbanov@linaro.org \
--subject='Re: [PATCH v2] spi: qup: Add DMA capabilities' \
/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
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).