9
0
Fork 0

spi: introduce spi_get_master

so we can request a master usefull for the spi command

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2012-11-05 19:30:18 +01:00 committed by Sascha Hauer
parent d74bef2b04
commit 968d444cdd
2 changed files with 14 additions and 0 deletions

View File

@ -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);

View File

@ -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;