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: change of_find_spi_controller_by_node() gating to CONFIG_OF

Currently, the helper of_find_spi_controller_by_node() is gated under
CONFIG_OF_DYNAMIC. This prevents drivers from using it in all CONFIG_OF
configurations.

This patch moves the gating to CONFIG_OF, keeping the inline fallback
returning NULL when Device Tree support is disabled.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Link: https://patch.msgid.link/6d8ae977d9f4726ea23ad5382638750593f9a2e4.1767148150.git.oder_chiou@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Oder Chiou and committed by
Mark Brown
037f8d89 ee69f55e

+12 -10
+11 -9
drivers/spi/spi.c
··· 4761 4761 4762 4762 /*-------------------------------------------------------------------------*/ 4763 4763 4764 - #if IS_ENABLED(CONFIG_OF_DYNAMIC) 4765 - /* Must call put_device() when done with returned spi_device device */ 4766 - static struct spi_device *of_find_spi_device_by_node(struct device_node *node) 4767 - { 4768 - struct device *dev = bus_find_device_by_of_node(&spi_bus_type, node); 4769 - 4770 - return dev ? to_spi_device(dev) : NULL; 4771 - } 4772 - 4764 + #if IS_ENABLED(CONFIG_OF) 4773 4765 /* The spi controllers are not using spi_bus, so we find it with another way */ 4774 4766 struct spi_controller *of_find_spi_controller_by_node(struct device_node *node) 4775 4767 { ··· 4777 4785 return container_of(dev, struct spi_controller, dev); 4778 4786 } 4779 4787 EXPORT_SYMBOL_GPL(of_find_spi_controller_by_node); 4788 + #endif 4789 + 4790 + #if IS_ENABLED(CONFIG_OF_DYNAMIC) 4791 + /* Must call put_device() when done with returned spi_device device */ 4792 + static struct spi_device *of_find_spi_device_by_node(struct device_node *node) 4793 + { 4794 + struct device *dev = bus_find_device_by_of_node(&spi_bus_type, node); 4795 + 4796 + return dev ? to_spi_device(dev) : NULL; 4797 + } 4780 4798 4781 4799 static int of_spi_notify(struct notifier_block *nb, unsigned long action, 4782 4800 void *arg)
+1 -1
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) 885 + #if IS_ENABLED(CONFIG_OF) 886 886 extern struct spi_controller *of_find_spi_controller_by_node(struct device_node *node); 887 887 #else 888 888 static inline struct spi_controller *of_find_spi_controller_by_node(struct device_node *node)