linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anatolij Gustschin <agust-ynQEQJNshbs@public.gmane.org>
To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [PATCH v2] spi: spi-mpc512x-psc: don't use obsolet cell-index property
Date: Fri, 11 Jan 2013 00:26:57 +0100	[thread overview]
Message-ID: <1357860417-11953-1-git-send-email-agust@denx.de> (raw)
In-Reply-To: <20121221192914.77D523E03CE@localhost>

Remove deprecated cell-index property and use spi alias to
obtain the SPI PSC number used for SPI bus id.

Signed-off-by: Anatolij Gustschin <agust-ynQEQJNshbs@public.gmane.org>
---
v2:
 - use of_alias_get_id() to get spi bus number

 drivers/spi/spi-mpc512x-psc.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
index cb3a310..88e5441 100644
--- a/drivers/spi/spi-mpc512x-psc.c
+++ b/drivers/spi/spi-mpc512x-psc.c
@@ -522,17 +522,11 @@ static int mpc512x_psc_spi_of_probe(struct platform_device *op)
 	regaddr64 = of_translate_address(op->dev.of_node, regaddr_p);
 
 	/* get PSC id (0..11, used by port_config) */
-	if (op->dev.platform_data == NULL) {
-		const u32 *psc_nump;
-
-		psc_nump = of_get_property(op->dev.of_node, "cell-index", NULL);
-		if (!psc_nump || *psc_nump > 11) {
-			dev_err(&op->dev, "mpc512x_psc_spi: Device node %s "
-				"has invalid cell-index property\n",
-				op->dev.of_node->full_name);
-			return -EINVAL;
-		}
-		id = *psc_nump;
+	id = of_alias_get_id(op->dev.of_node, "spi");
+	if (id < 0) {
+		dev_err(&op->dev, "no alias id for %s\n",
+			op->dev.of_node->full_name);
+		return id;
 	}
 
 	return mpc512x_psc_spi_do_probe(&op->dev, (u32) regaddr64, (u32) size64,
-- 
1.7.5.4


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712

  parent reply	other threads:[~2013-01-10 23:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-21 14:43 [PATCH] spi: spi-mpc512x-psc: don't use obsolet cell-index property Anatolij Gustschin
     [not found] ` <1356100981-18685-1-git-send-email-agust-ynQEQJNshbs@public.gmane.org>
2012-12-21 14:48   ` Grant Likely
2012-12-21 19:29     ` Grant Likely
2013-01-10 23:12       ` Anatolij Gustschin
2013-01-10 23:26       ` Anatolij Gustschin [this message]
2013-01-11  0:05       ` [PATCH v2] " Anatolij Gustschin
     [not found]         ` <1357862748-14130-1-git-send-email-agust-ynQEQJNshbs@public.gmane.org>
2013-02-05 14:09           ` Grant Likely

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=1357860417-11953-1-git-send-email-agust@denx.de \
    --to=agust-ynqeqjnshbs@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@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).