mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] spi: introduce spi_get_master
Date: Mon,  5 Nov 2012 19:30:18 +0100	[thread overview]
Message-ID: <1352140219-11309-1-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20121105182148.GA25679@game.jcrosoft.org>

so we can request a master usefull for the spi command

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/spi/spi.c |   12 ++++++++++++
 include/spi/spi.h |    2 ++
 2 files changed, 14 insertions(+)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 44040e5..6a5bd6d 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -219,6 +219,18 @@ int spi_register_master(struct spi_master *master)
 }
 EXPORT_SYMBOL(spi_register_master);
 
+struct spi_master *spi_get_master(int bus)
+{
+	struct spi_master* m;
+
+	list_for_each_entry(m, &spi_master_list, list) {
+		if (m->bus_num == bus)
+			return m;
+	}
+
+	return NULL;
+}
+
 int spi_sync(struct spi_device *spi, struct spi_message *message)
 {
 	return spi->master->transfer(spi, message);
diff --git a/include/spi/spi.h b/include/spi/spi.h
index 1773ca2..d6570a4 100644
--- a/include/spi/spi.h
+++ b/include/spi/spi.h
@@ -432,6 +432,8 @@ static inline ssize_t spi_w8r8(struct spi_device *spi, u8 cmd)
 
 extern struct bus_type spi_bus;
 
+struct spi_master *spi_get_master(int bus);
+
 static inline int spi_register_driver(struct driver_d *drv)
 {
 	drv->bus = &spi_bus;
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-11-05 18:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-05 18:21 [PATCH 0/2 v4] add spi command Jean-Christophe PLAGNIOL-VILLARD
2012-11-05 18:30 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-11-05 18:30   ` [PATCH 2/2] introduce " Jean-Christophe PLAGNIOL-VILLARD
2012-11-12  7:32 ` [PATCH 0/2 v4] add " Sascha Hauer
  -- strict thread matches above, loose matches on Subject: below --
2012-11-05  9:29 [PATCH 0/2 v3] " Jean-Christophe PLAGNIOL-VILLARD
2012-11-05  9:36 ` [PATCH 1/2] spi: introduce spi_get_master Jean-Christophe PLAGNIOL-VILLARD
2012-11-04  8:54 [PATCH 0/2 v2] add spi command Jean-Christophe PLAGNIOL-VILLARD
2012-11-04  8:59 ` [PATCH 1/2] spi: introduce spi_get_master Jean-Christophe PLAGNIOL-VILLARD
2012-11-02 16:06 [PATCH 0/2] add spi command Jean-Christophe PLAGNIOL-VILLARD
2012-11-02 16:17 ` [PATCH 1/2] spi: introduce spi_get_master Jean-Christophe PLAGNIOL-VILLARD

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=1352140219-11309-1-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.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