From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from 15.mo5.mail-out.ovh.net ([178.33.107.29] helo=mo5.mail-out.ovh.net) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TUJyO-0003dc-BD for barebox@lists.infradead.org; Fri, 02 Nov 2012 16:19:57 +0000 Received: from mail183.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo5.mail-out.ovh.net (Postfix) with SMTP id 21B5EFFB195 for ; Fri, 2 Nov 2012 17:27:06 +0100 (CET) From: Jean-Christophe PLAGNIOL-VILLARD Date: Fri, 2 Nov 2012 17:17:39 +0100 Message-Id: <1351873060-27968-1-git-send-email-plagnioj@jcrosoft.com> In-Reply-To: <20121102160659.GS29599@game.jcrosoft.org> References: <20121102160659.GS29599@game.jcrosoft.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 1/2] spi: introduce spi_get_master To: barebox@lists.infradead.org so we can request a master usefull for the spi command Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- 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