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:
parent
d74bef2b04
commit
968d444cdd
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue