linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sricharan R <r.sricharan-l0cyMroinI0@public.gmane.org>
To: <linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Cc: paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org,
	b-cousson-l0cyMroinI0@public.gmane.org,
	tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org,
	rnayak-l0cyMroinI0@public.gmane.org,
	r.sricharan-l0cyMroinI0@public.gmane.org,
	santosh.shilimkar-l0cyMroinI0@public.gmane.org,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [PATCH] spi: omap2-mcspi: Skip platform_get_resource_byname() for dt case
Date: Sat, 8 Jun 2013 22:05:38 +0530	[thread overview]
Message-ID: <1370709338-19810-1-git-send-email-r.sricharan@ti.com> (raw)

McSPI driver probe will abort for DT case because of failed
platform_get_resource_byname() lookup. Fix it by skipping resource
byname lookup for device tree build.

Issue comes out when dma entries are removed from the hwmod data.

Signed-off-by: Sricharan R <r.sricharan-l0cyMroinI0@public.gmane.org>
---
 drivers/spi/spi-omap2-mcspi.c |   36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index e4829aa..99172d2 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1275,25 +1275,31 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
 		struct resource *dma_res;
 
 		sprintf(dma_rx_ch_name, "rx%d", i);
-		dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA,
-				dma_rx_ch_name);
-		if (!dma_res) {
-			dev_dbg(&pdev->dev, "cannot get DMA RX channel\n");
-			status = -ENODEV;
-			break;
+
+		if (!pdev->dev.of_node) {
+			dma_res = platform_get_resource_byname(pdev,
+					IORESOURCE_DMA, dma_rx_ch_name);
+			if (!dma_res) {
+				dev_dbg(&pdev->dev, "cannot get DMA RX channel\n");
+				status = -ENODEV;
+				break;
+			}
+			mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start;
 		}
 
-		mcspi->dma_channels[i].dma_rx_sync_dev = dma_res->start;
 		sprintf(dma_tx_ch_name, "tx%d", i);
-		dma_res = platform_get_resource_byname(pdev, IORESOURCE_DMA,
-				dma_tx_ch_name);
-		if (!dma_res) {
-			dev_dbg(&pdev->dev, "cannot get DMA TX channel\n");
-			status = -ENODEV;
-			break;
-		}
 
-		mcspi->dma_channels[i].dma_tx_sync_dev = dma_res->start;
+		if (!pdev->dev.of_node) {
+			dma_res = platform_get_resource_byname(pdev,
+					IORESOURCE_DMA, dma_tx_ch_name);
+
+			if (!dma_res) {
+				dev_dbg(&pdev->dev, "cannot get DMA TX channel\n");
+				status = -ENODEV;
+				break;
+			}
+			mcspi->dma_channels[i].dma_tx_sync_dev = dma_res->start;
+		}
 	}
 
 	if (status < 0)
-- 
1.7.9.5


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j

                 reply	other threads:[~2013-06-08 16:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1370709338-19810-1-git-send-email-r.sricharan@ti.com \
    --to=r.sricharan-l0cymroini0@public.gmane.org \
    --cc=b-cousson-l0cyMroinI0@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org \
    --cc=rnayak-l0cyMroinI0@public.gmane.org \
    --cc=santosh.shilimkar-l0cyMroinI0@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.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).