Skip to content

Commit 9219b17

Browse files
committed
Merge tag 'spi-acpi-lookup-dummy' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi into topic/cirrus-hp-g12
spi: Add empty versions of ACPI lookup functions A patch from Richard Fitzgerald adding dummy versions of the ACPI lookup functions for SPI: 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.
2 parents 7c626ce + 90ec3a8 commit 9219b17

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

include/linux/spi/spi.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,12 +902,29 @@ extern int devm_spi_register_controller(struct device *dev,
902902
struct spi_controller *ctlr);
903903
extern void spi_unregister_controller(struct spi_controller *ctlr);
904904

905-
#if IS_ENABLED(CONFIG_ACPI)
905+
#if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SPI_MASTER)
906906
extern struct spi_controller *acpi_spi_find_controller_by_adev(struct acpi_device *adev);
907907
extern struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
908908
struct acpi_device *adev,
909909
int index);
910910
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+
}
911928
#endif
912929

913930
/*

0 commit comments

Comments
 (0)