Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

spi: export of_find_spi_controller_by_node()

Some devices are primarily described on another bus (e.g. I2C) but also
have an additional SPI connection that serves as a transport for
firmware loading. Export of_find_spi_controller_by_node() so drivers can
obtain the SPI controller referenced by a DT phandle.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/0e572a00aa305e588357162d400ba9472ce56dd3.1767148150.git.oder_chiou@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Oder Chiou and committed by
Mark Brown
ee69f55e 9ace4753

+11 -1
+2 -1
drivers/spi/spi.c
··· 4771 4771 } 4772 4772 4773 4773 /* The spi controllers are not using spi_bus, so we find it with another way */ 4774 - static struct spi_controller *of_find_spi_controller_by_node(struct device_node *node) 4774 + struct spi_controller *of_find_spi_controller_by_node(struct device_node *node) 4775 4775 { 4776 4776 struct device *dev; 4777 4777 ··· 4784 4784 /* Reference got in class_find_device */ 4785 4785 return container_of(dev, struct spi_controller, dev); 4786 4786 } 4787 + EXPORT_SYMBOL_GPL(of_find_spi_controller_by_node); 4787 4788 4788 4789 static int of_spi_notify(struct notifier_block *nb, unsigned long action, 4789 4790 void *arg)
+9
include/linux/spi/spi.h
··· 882 882 struct spi_controller *ctlr); 883 883 extern void spi_unregister_controller(struct spi_controller *ctlr); 884 884 885 + #if IS_ENABLED(CONFIG_OF_DYNAMIC) 886 + extern struct spi_controller *of_find_spi_controller_by_node(struct device_node *node); 887 + #else 888 + static inline struct spi_controller *of_find_spi_controller_by_node(struct device_node *node) 889 + { 890 + return NULL; 891 + } 892 + #endif 893 + 885 894 #if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SPI_MASTER) 886 895 extern struct spi_controller *acpi_spi_find_controller_by_adev(struct acpi_device *adev); 887 896 extern struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,