mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: dmaengine@vger.kernel.org, Vinod Koul <vinod.koul@intel.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	Dan Williams <dan.j.williams@intel.com>
Subject: [PATCH 06/11] dmaengine: mpc512x: Remove chancnt affectations
Date: Thu, 16 Oct 2014 11:00:58 +0200	[thread overview]
Message-ID: <1413450063-23829-7-git-send-email-maxime.ripard@free-electrons.com> (raw)
In-Reply-To: <1413450063-23829-1-git-send-email-maxime.ripard@free-electrons.com>

chanctnt is already filled by dma_async_device_register, which uses the channel
list to know how much channels there is.

Since it's already filled, we can safely remove it from the drivers' probe
function.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/dma/mpc512x_dma.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c
index 881db2bcb48b..fc08bb3af440 100644
--- a/drivers/dma/mpc512x_dma.c
+++ b/drivers/dma/mpc512x_dma.c
@@ -885,6 +885,7 @@ static int mpc_dma_probe(struct platform_device *op)
 	struct resource res;
 	ulong regs_start, regs_size;
 	int retval, i;
+	u8 chancnt;
 
 	mdma = devm_kzalloc(dev, sizeof(struct mpc_dma), GFP_KERNEL);
 	if (!mdma) {
@@ -956,10 +957,6 @@ static int mpc_dma_probe(struct platform_device *op)
 
 	dma = &mdma->dma;
 	dma->dev = dev;
-	if (mdma->is_mpc8308)
-		dma->chancnt = MPC8308_DMACHAN_MAX;
-	else
-		dma->chancnt = MPC512x_DMACHAN_MAX;
 	dma->device_alloc_chan_resources = mpc_dma_alloc_chan_resources;
 	dma->device_free_chan_resources = mpc_dma_free_chan_resources;
 	dma->device_issue_pending = mpc_dma_issue_pending;
@@ -972,7 +969,12 @@ static int mpc_dma_probe(struct platform_device *op)
 	dma_cap_set(DMA_MEMCPY, dma->cap_mask);
 	dma_cap_set(DMA_SLAVE, dma->cap_mask);
 
-	for (i = 0; i < dma->chancnt; i++) {
+	if (mdma->is_mpc8308)
+		chancnt = MPC8308_DMACHAN_MAX;
+	else
+		chancnt = MPC512x_DMACHAN_MAX;
+
+	for (i = 0; i < chancnt; i++) {
 		mchan = &mdma->channels[i];
 
 		mchan->chan.device = dma;
-- 
2.1.1


  parent reply	other threads:[~2014-10-16  9:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-16  9:00 [PATCH 00/11] dmaengine: Cleanup chancnt Maxime Ripard
2014-10-16  9:00 ` [PATCH 01/11] dmaengine: pl08x: Remove chancnt affectations Maxime Ripard
2014-10-16  9:00 ` [PATCH 02/11] dmaengine: bcm2835: " Maxime Ripard
2014-10-16  9:00 ` [PATCH 03/11] dmaengine: jz4740: " Maxime Ripard
2014-10-16  9:00 ` [PATCH 04/11] dmaengine: fsldma: " Maxime Ripard
2014-10-16  9:00 ` [PATCH 05/11] dmaengine: k3: " Maxime Ripard
2014-10-16  9:00 ` Maxime Ripard [this message]
2014-10-16  9:00 ` [PATCH 07/11] dmaengine: omap: " Maxime Ripard
2014-10-16  9:01 ` [PATCH 08/11] dmaengine: sa11x0: " Maxime Ripard
2014-10-16  9:01 ` [PATCH 09/11] dmaengine: sh: " Maxime Ripard
2014-10-26 16:31   ` Laurent Pinchart
2014-10-16  9:01 ` [PATCH 10/11] dmaengine: sirf: " Maxime Ripard
2014-10-16  9:01 ` [PATCH 11/11] dmaengine: sun6i: " Maxime Ripard
2014-10-16  9:03 ` [PATCH 00/11] dmaengine: Cleanup chancnt Vinod Koul
2014-11-05 13:51   ` Maxime Ripard
2014-11-06  6:06 ` Vinod Koul
2014-11-06  9:58   ` Maxime Ripard

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=1413450063-23829-7-git-send-email-maxime.ripard@free-electrons.com \
    --to=maxime.ripard@free-electrons.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®