linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Anatolij Gustschin <agust-ynQEQJNshbs@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH] spi: spi-mpc512x-psc: don't use obsolet cell-index property
Date: Fri, 21 Dec 2012 19:29:14 +0000	[thread overview]
Message-ID: <20121221192914.77D523E03CE@localhost> (raw)
In-Reply-To: <CACxGe6sT_fsdcGN1OCRBVMXzAiDbbf=SnKp2F8eYL+F5Qoyu=g@mail.gmail.com>

On Fri, 21 Dec 2012 14:48:38 +0000, Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
> On Fri, Dec 21, 2012 at 2:43 PM, Anatolij Gustschin <agust-ynQEQJNshbs@public.gmane.org> wrote:
> > Use unique PSCx register base offset to obtain the
> > SPI PSC number used for SPI bus id.
> >
> > Signed-off-by: Anatolij Gustschin <agust-ynQEQJNshbs@public.gmane.org>
> 
> Don't do this. If you really want to assign a specific bus number,
> then use a property in /aliases. cell-index has been deprecated a very
> long time ago now.

Ummm.. I really should read patches before I reply to them. I see you're
removing cell-index, not adding it back in. It is fine.

Aliases would be a more generic solution though. Would this following
change work for you? Try it out and let me know.

g.

---
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 84c2861..de9f6ee 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -983,6 +983,9 @@ int spi_register_master(struct spi_master *master)
 	if (master->num_chipselect == 0)
 		return -EINVAL;
 
+	if ((master->bus_num < 0) && master->dev.of_node)
+		master->bus_num = of_alias_get_id(master->dev.of_node, "spi");
+
 	/* convention:  dynamically assigned bus IDs count down from the max */
 	if (master->bus_num < 0) {
 		/* FIXME switch to an IDR based scheme, something like


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d

  reply	other threads:[~2012-12-21 19:29 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 [this message]
2013-01-10 23:12       ` Anatolij Gustschin
2013-01-10 23:26       ` [PATCH v2] " Anatolij Gustschin
2013-01-11  0:05       ` 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=20121221192914.77D523E03CE@localhost \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=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).