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

spi: Add dummy definitions for ACPI lookup functions

Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>:

Provide empty versions of acpi_spi_count_resources(),
acpi_spi_device_alloc() and acpi_spi_find_controller_by_adev()
if the real functions are not being built.

This commit fixes two problems with the original definitions:

1) There wasn't an empty version of these functions
2) The #if only depended on CONFIG_ACPI. But the functions are implemented
in the core spi.c so CONFIG_SPI_MASTER must also be enabled for the real
functions to exist.

+18 -1
+18 -1
include/linux/spi/spi.h
··· 902 902 struct spi_controller *ctlr); 903 903 extern void spi_unregister_controller(struct spi_controller *ctlr); 904 904 905 - #if IS_ENABLED(CONFIG_ACPI) 905 + #if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SPI_MASTER) 906 906 extern struct spi_controller *acpi_spi_find_controller_by_adev(struct acpi_device *adev); 907 907 extern struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr, 908 908 struct acpi_device *adev, 909 909 int index); 910 910 int acpi_spi_count_resources(struct acpi_device *adev); 911 + #else 912 + static inline struct spi_controller *acpi_spi_find_controller_by_adev(struct acpi_device *adev) 913 + { 914 + return NULL; 915 + } 916 + 917 + static inline struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr, 918 + struct acpi_device *adev, 919 + int index) 920 + { 921 + return ERR_PTR(-ENODEV); 922 + } 923 + 924 + static inline int acpi_spi_count_resources(struct acpi_device *adev) 925 + { 926 + return 0; 927 + } 911 928 #endif 912 929 913 930 /*