linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Scott Ellis <scott@jumpnowtek.com>
To: spi-devel-general@lists.sourceforge.net
Cc: David Brownell <dbrownell@users.sourceforge.net>,
	Grant Likely <grant.likely@secretlab.ca>,
	Tony Lindgren <tony@atomide.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Roman Tereshonkov <roman.tereshonkov@nokia.com>,
	linux-omap@vger.kernel.org,
	Aaro Koskinen <Aaro.Koskinen@nokia.com>,
	Kevin Hilman <khilman@deeprootsystems.com>
Subject: [PATCH 5/6] SPI omap2_mcspi.c: Use num chipselects from platform data
Date: Fri, 12 Mar 2010 10:22:09 -0500	[thread overview]
Message-ID: <1268407329.14445.54.camel@quad> (raw)

The platform data already has the number of chip select lines 
for each McSPI module. No need to figure it out again in 
probe().

Signed-off-by: Scott Ellis <scott@jumpnowtek.com>

 drivers/spi/omap2_mcspi.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c
index cce23c5..cd9fdc2 100644
--- a/drivers/spi/omap2_mcspi.c
+++ b/drivers/spi/omap2_mcspi.c
@@ -1058,33 +1058,28 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
 	struct resource		*r;
 	int			status = 0, i;
 	const u8		*rxdma_id, *txdma_id;
-	unsigned		num_chipselect;
 	struct omap2_mcspi_platform_config *pdata;
 
 	switch (pdev->id) {
 	case 1:
 		rxdma_id = spi1_rxdma_id;
 		txdma_id = spi1_txdma_id;
-		num_chipselect = 4;
 		break;
 	case 2:
 		rxdma_id = spi2_rxdma_id;
 		txdma_id = spi2_txdma_id;
-		num_chipselect = 2;
 		break;
 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) \
 	|| defined(CONFIG_ARCH_OMAP4)
 	case 3:
 		rxdma_id = spi3_rxdma_id;
 		txdma_id = spi3_txdma_id;
-		num_chipselect = 2;
 		break;
 #endif
 #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
 	case 4:
 		rxdma_id = spi4_rxdma_id;
 		txdma_id = spi4_txdma_id;
-		num_chipselect = 1;
 		break;
 #endif
 	default:
@@ -1106,7 +1101,6 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
 	master->setup = omap2_mcspi_setup;
 	master->transfer = omap2_mcspi_transfer;
 	master->cleanup = omap2_mcspi_cleanup;
-	master->num_chipselect = num_chipselect;
 
 	dev_set_drvdata(&pdev->dev, master);
 
@@ -1114,6 +1108,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
 	mcspi->master = master;
 	pdata = (struct omap2_mcspi_platform_config *)pdev->dev.platform_data;
 	mcspi->max_clk_div = pdata->max_clk_div;
+	master->num_chipselect = pdata->num_cs;
 
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (r == NULL) {
@@ -1160,7 +1155,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
 	if (mcspi->dma_channels == NULL)
 		goto err3;
 
-	for (i = 0; i < num_chipselect; i++) {
+	for (i = 0; i < master->num_chipselect; i++) {
 		mcspi->dma_channels[i].dma_rx_channel = -1;
 		mcspi->dma_channels[i].dma_rx_sync_dev = rxdma_id[i];
 		mcspi->dma_channels[i].dma_tx_channel = -1;






             reply	other threads:[~2010-03-12 15:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-12 15:22 Scott Ellis [this message]
2010-05-24 15:14 ` [PATCH 5/6] SPI omap2_mcspi.c: Use num chipselects from platform data Scott Ellis

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=1268407329.14445.54.camel@quad \
    --to=scott@jumpnowtek.com \
    --cc=Aaro.Koskinen@nokia.com \
    --cc=akpm@linux-foundation.org \
    --cc=dbrownell@users.sourceforge.net \
    --cc=grant.likely@secretlab.ca \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=roman.tereshonkov@nokia.com \
    --cc=spi-devel-general@lists.sourceforge.net \
    --cc=tony@atomide.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;
as well as URLs for NNTP newsgroup(s).