From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] spi: introduce spi_get_master
Date: Fri, 2 Nov 2012 17:17:39 +0100 [thread overview]
Message-ID: <1351873060-27968-1-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20121102160659.GS29599@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
next prev parent reply other threads:[~2012-11-02 16:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-02 16:06 [PATCH 0/2] add spi command Jean-Christophe PLAGNIOL-VILLARD
2012-11-02 16:17 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-11-02 16:17 ` [PATCH 2/2] introduce " Jean-Christophe PLAGNIOL-VILLARD
2012-11-02 16:26 ` Alexander Shiyan
2012-11-02 16:45 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-03 21:39 ` Sascha Hauer
2012-11-02 19:01 ` [PATCH 0/2] add " Sascha Hauer
2012-11-03 7:36 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-04 8:54 [PATCH 0/2 v2] " Jean-Christophe PLAGNIOL-VILLARD
2012-11-04 8:59 ` [PATCH 1/2] spi: introduce spi_get_master Jean-Christophe PLAGNIOL-VILLARD
2012-11-05 9:29 [PATCH 0/2 v3] add spi command Jean-Christophe PLAGNIOL-VILLARD
2012-11-05 9:36 ` [PATCH 1/2] spi: introduce spi_get_master Jean-Christophe PLAGNIOL-VILLARD
2012-11-05 18:21 [PATCH 0/2 v4] add spi command Jean-Christophe PLAGNIOL-VILLARD
2012-11-05 18:30 ` [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=1351873060-27968-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