[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211210154050.3713-2-sbinding@opensource.cirrus.com>
Date: Fri, 10 Dec 2021 15:40:45 +0000
From: Stefan Binding <sbinding@...nsource.cirrus.com>
To: Mark Brown <broonie@...nel.org>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>,
Hans de Goede <hdegoede@...hat.com>,
Mark Gross <markgross@...nel.org>
CC: <linux-kernel@...r.kernel.org>, <linux-spi@...r.kernel.org>,
<linux-acpi@...r.kernel.org>,
<platform-driver-x86@...r.kernel.org>,
<patches@...nsource.cirrus.com>,
Stefan Binding <sbinding@...nsource.cirrus.com>
Subject: [PATCH v2 1/6] spi: Export acpi_spi_find_controller_by_adev to be used externally
This will be used by bus-multi-instantiate to support spi.
Signed-off-by: Stefan Binding <sbinding@...nsource.cirrus.com>
---
drivers/spi/spi.c | 3 ++-
include/linux/spi/spi.h | 10 ++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 8726309b3eaf..9495f776e53c 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -4200,7 +4200,7 @@ static int spi_acpi_controller_match(struct device *dev, const void *data)
return ACPI_COMPANION(dev->parent) == data;
}
-static struct spi_controller *acpi_spi_find_controller_by_adev(struct acpi_device *adev)
+struct spi_controller *acpi_spi_find_controller_by_adev(struct acpi_device *adev)
{
struct device *dev;
@@ -4214,6 +4214,7 @@ static struct spi_controller *acpi_spi_find_controller_by_adev(struct acpi_devic
return container_of(dev, struct spi_controller, dev);
}
+EXPORT_SYMBOL_GPL(acpi_spi_find_controller_by_adev);
static struct spi_device *acpi_spi_find_device_by_adev(struct acpi_device *adev)
{
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index eb7ac8a1e03c..8c2978853573 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -17,6 +17,7 @@
#include <linux/ptp_clock_kernel.h>
#include <uapi/linux/spi/spi.h>
+#include <linux/acpi.h>
struct dma_chan;
struct software_node;
@@ -759,6 +760,15 @@ extern int devm_spi_register_controller(struct device *dev,
struct spi_controller *ctlr);
extern void spi_unregister_controller(struct spi_controller *ctlr);
+#if IS_ENABLED(CONFIG_ACPI)
+extern struct spi_controller *acpi_spi_find_controller_by_adev(struct acpi_device *adev);
+#else
+static inline struct spi_controller *acpi_spi_find_controller_by_adev(struct acpi_device *adev)
+{
+ return ERR_PTR(-EOPNOTSUPP);
+}
+#endif
+
/*
* SPI resource management while processing a SPI message
*/
--
2.25.1
Powered by blists - more mailing lists