linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: omap2-mcspi: Skip platform_get_resource_byname() for dt case
@ 2013-06-08 16:35 Sricharan R
  0 siblings, 0 replies; only message in thread
From: Sricharan R @ 2013-06-08 16:35 UTC (permalink / raw)
  To: linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: paul-DWxLp4Yu+b8AvxtiuMwx3w, b-cousson-l0cyMroinI0,
	tony-4v6yS6AI5VpBDgjK7y7TUQ, rnayak-l0cyMroinI0,
	r.sricharan-l0cyMroinI0, santosh.shilimkar-l0cyMroinI0,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-06-08 16:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-08 16:35 [PATCH] spi: omap2-mcspi: Skip platform_get_resource_byname() for dt case Sricharan R

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).