Skip to content

Commit 90ec3a8

Browse files
rfvirgilbroonie
authored andcommitted
spi: Add empty versions of ACPI functions
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. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20240802152215.20831-2-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent a0c04bd commit 90ec3a8

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)