mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
spi: make OF helper available for others
The of_find_spi_device_by_node() helper function is useful for other modules too. Export the funciton as GPL like all other spi helper functions and make it available if CONFIG_OF is enabled, because it isn't related to the CONFIG_OF_DYNAMIC context. Finally add a stub if CONFIG_OF isn't enabled, so others must not care about it. Signed-off-by: Marco Felsch <[email protected]> Signed-off-by: Mark Brown <[email protected]>
This commit is contained in:
parent
5b394b2ddf
commit
5f143af750
2 changed files with 21 additions and 3 deletions
|
|
@ -3314,20 +3314,23 @@ EXPORT_SYMBOL_GPL(spi_write_then_read);
|
|||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
#if IS_ENABLED(CONFIG_OF_DYNAMIC)
|
||||
#if IS_ENABLED(CONFIG_OF)
|
||||
static int __spi_of_device_match(struct device *dev, void *data)
|
||||
{
|
||||
return dev->of_node == data;
|
||||
}
|
||||
|
||||
/* must call put_device() when done with returned spi_device device */
|
||||
static struct spi_device *of_find_spi_device_by_node(struct device_node *node)
|
||||
struct spi_device *of_find_spi_device_by_node(struct device_node *node)
|
||||
{
|
||||
struct device *dev = bus_find_device(&spi_bus_type, NULL, node,
|
||||
__spi_of_device_match);
|
||||
return dev ? to_spi_device(dev) : NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(of_find_spi_device_by_node);
|
||||
#endif /* IS_ENABLED(CONFIG_OF) */
|
||||
|
||||
#if IS_ENABLED(CONFIG_OF_DYNAMIC)
|
||||
static int __spi_of_controller_match(struct device *dev, const void *data)
|
||||
{
|
||||
return dev->of_node == data;
|
||||
|
|
|
|||
Loading…
Reference in a new issue