linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: <tiwai@suse.com>, <broonie@kernel.org>,
	<wsa+renesas@sang-engineering.com>,
	<mika.westerberg@linux.intel.com>
Cc: <linux-sound@vger.kernel.org>, <linux-spi@vger.kernel.org>,
	<linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<patches@opensource.cirrus.com>,
	Richard Fitzgerald <rf@opensource.cirrus.com>
Subject: [PATCH v2 1/3] spi: Add empty versions of ACPI functions
Date: Fri, 2 Aug 2024 16:22:13 +0100	[thread overview]
Message-ID: <20240802152215.20831-2-rf@opensource.cirrus.com> (raw)
In-Reply-To: <20240802152215.20831-1-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.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
Changes since V1:
- This patch is new in V2.

 include/linux/spi/spi.h | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index e4f3f3d30a03..d47d5f14ff99 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -902,12 +902,29 @@ 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)
+#if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SPI_MASTER)
 extern struct spi_controller *acpi_spi_find_controller_by_adev(struct acpi_device *adev);
 extern struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
 						struct acpi_device *adev,
 						int index);
 int acpi_spi_count_resources(struct acpi_device *adev);
+#else
+static inline struct spi_controller *acpi_spi_find_controller_by_adev(struct acpi_device *adev)
+{
+	return NULL;
+}
+
+static inline struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
+						       struct acpi_device *adev,
+						       int index)
+{
+	return ERR_PTR(-ENODEV);
+}
+
+static inline int acpi_spi_count_resources(struct acpi_device *adev)
+{
+	return 0;
+}
 #endif
 
 /*
-- 
2.39.2


  reply	other threads:[~2024-08-02 15:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-02 15:22 [PATCH v2 0/3] ALSA: Add support for new HP G12 laptops Richard Fitzgerald
2024-08-02 15:22 ` Richard Fitzgerald [this message]
2024-08-02 15:22 ` [PATCH v2 2/3] i2c: Fix conditional for substituting empty ACPI functions Richard Fitzgerald
2024-08-04 14:34   ` Wolfram Sang
2024-08-02 15:22 ` [PATCH v2 3/3] ALSA: hda/realtek: Add support for new HP G12 laptops Richard Fitzgerald
2024-08-02 21:49 ` (subset) [PATCH v2 0/3] ALSA: " Mark Brown
2024-08-05  8:02 ` Takashi Iwai
2024-08-06 11:06   ` Richard Fitzgerald
2024-08-06 11:19     ` Takashi Iwai
2024-08-06 11:29       ` Wolfram Sang
2024-08-06 11:41         ` Takashi Iwai
2024-08-12  6:53           ` Wolfram Sang
2024-08-12  7:04             ` Takashi Iwai
2024-08-05 19:40 ` Mark Brown
2024-08-12  7:19   ` Takashi Iwai
2024-08-12  7:20 ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240802152215.20831-2-rf@opensource.cirrus.com \
    --to=rf@opensource.cirrus.com \
    --cc=broonie@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=patches@opensource.cirrus.com \
    --cc=tiwai@suse.com \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).