All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Liam Girdwood <lgirdwood@gmail.com>,
	Brendan Higgins <brendan.higgins@linux.dev>,
	David Gow <davidgow@google.com>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>
Cc: alsa-devel@alsa-project.org, linux-kselftest@vger.kernel.org,
	kunit-dev@googlegroups.com, Mark Brown <broonie@kernel.org>
Subject: [PATCH v2 2/5] platform: Provide stubs for !HAS_IOMEM builds
Date: Tue, 18 Jul 2023 01:28:43 +0100	[thread overview]
Message-ID: <20230718-asoc-topology-kunit-enable-v2-2-0ee11e662b92@kernel.org> (raw)
In-Reply-To: <20230718-asoc-topology-kunit-enable-v2-0-0ee11e662b92@kernel.org>

The various _ioremap_resource functions are not built when
CONFIG_HAS_IOMEM is disabled but no stubs are provided. Given how
widespread IOMEM usage is in drivers and how rare !IOMEM configurations
are in practical use let's just provide some stubs so users will build
without having to add explicit dependencies on IOMEM.

The most likely use case is builds with UML for KUnit testing.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 include/linux/platform_device.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index b845fd83f429..7a41c72c1959 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -63,6 +63,8 @@ extern struct resource *platform_get_mem_or_io(struct platform_device *,
 extern struct device *
 platform_find_device_by_driver(struct device *start,
 			       const struct device_driver *drv);
+
+#ifdef CONFIG_HAS_IOMEM
 extern void __iomem *
 devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
 				unsigned int index, struct resource **res);
@@ -72,6 +74,32 @@ devm_platform_ioremap_resource(struct platform_device *pdev,
 extern void __iomem *
 devm_platform_ioremap_resource_byname(struct platform_device *pdev,
 				      const char *name);
+#else
+
+static inline void __iomem *
+devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
+				unsigned int index, struct resource **res)
+{
+	return ERR_PTR(-EINVAL);
+}
+
+
+static inline void __iomem *
+devm_platform_ioremap_resource(struct platform_device *pdev,
+			       unsigned int index)
+{
+	return ERR_PTR(-EINVAL);
+}
+
+static inline void __iomem *
+devm_platform_ioremap_resource_byname(struct platform_device *pdev,
+				      const char *name)
+{
+	return ERR_PTR(-EINVAL);
+}
+
+#endif
+
 extern int platform_get_irq(struct platform_device *, unsigned int);
 extern int platform_get_irq_optional(struct platform_device *, unsigned int);
 extern int platform_irq_count(struct platform_device *);

-- 
2.39.2


  parent reply	other threads:[~2023-07-18  0:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18  0:28 [PATCH v2 0/5] ASoC: Improve coverage in default KUnit runs Mark Brown
2023-07-18  0:28 ` [PATCH v2 1/5] driver core: Provide stubs for !IOMEM builds Mark Brown
2023-07-18  9:03   ` David Gow
2023-07-18 13:35   ` Greg Kroah-Hartman
2023-07-18  0:28 ` Mark Brown [this message]
2023-07-18  9:03   ` [PATCH v2 2/5] platform: Provide stubs for !HAS_IOMEM builds David Gow
2023-07-18 13:35   ` Greg Kroah-Hartman
2023-07-18  0:28 ` [PATCH v2 3/5] ALSA: Enable build with UML Mark Brown
2023-07-18  9:03   ` David Gow
2023-07-18  0:28 ` [PATCH v2 4/5] kunit: Enable ASoC in all_tests.config Mark Brown
2023-07-18  9:03   ` David Gow
2023-07-18 14:03     ` Mark Brown
2023-07-18  0:28 ` [PATCH v2 5/5] ASoC: topology: Add explicit build option Mark Brown
2023-07-18  5:51 ` [PATCH v2 0/5] ASoC: Improve coverage in default KUnit runs Takashi Iwai
2023-07-19 13:57 ` Mark Brown

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=20230718-asoc-topology-kunit-enable-v2-2-0ee11e662b92@kernel.org \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=brendan.higgins@linux.dev \
    --cc=davidgow@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kunit-dev@googlegroups.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=rafael@kernel.org \
    --cc=tiwai@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.