[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200721054528.2556267-1-davidgow@google.com>
Date: Mon, 20 Jul 2020 22:45:28 -0700
From: David Gow <davidgow@...gle.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jeff Dike <jdike@...toit.com>, rafael@...nel.org,
Logan Gunthorpe <logang@...tatee.com>,
Richard Weinberger <richard@....at>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc: Brendan Higgins <brendanhiggins@...gle.com>,
kunit-dev@...glegroups.com,
linux-um <linux-um@...ts.infradead.org>,
linux-kernel@...r.kernel.org, David Gow <davidgow@...gle.com>
Subject: [RFC PATCH] platform: ioremap: Build iomap functions even without HAS_IOMEM
A number of drivers use devm_platform_ioremap_resource(), but do not (or
did not) explicitly depend on IOMEM[1,2]. Given that the only platform
without HAS_IOMEM seems to be UML, and it has sufficient stubs for
devm_platform_ioremap_resource() and its dependencies to build, we can
remove the HAS_IOMEM requirement here, rather than playing whack-a-mole
with different drivers which don't try to build against ARCH=um.
The reason this works at the moment is that stub ioremap and iounmap
functions were added to UML to support this sort-of thing[3]. This
particular change doesn't require adding any additional stubs, but there
is possibly room in the future to stub out the remaining iomem functions
(or to provide mock implementations for testing), and get rid of
HAS_IOMEM entirely.
[1]: https://lkml.org/lkml/2020/6/30/176
[2]:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1e7468bd9d30a21e059af477106dc5588ae52dff
[3]:
https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1405627.html
Signed-off-by: David Gow <davidgow@...gle.com>
---
drivers/base/platform.c | 2 --
lib/Makefile | 2 +-
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index c0d0a5490ac6..628dde6675cf 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -61,7 +61,6 @@ struct resource *platform_get_resource(struct platform_device *dev,
}
EXPORT_SYMBOL_GPL(platform_get_resource);
-#ifdef CONFIG_HAS_IOMEM
/**
* devm_platform_get_and_ioremap_resource - call devm_ioremap_resource() for a
* platform device and get resource
@@ -135,7 +134,6 @@ devm_platform_ioremap_resource_byname(struct platform_device *pdev,
return devm_ioremap_resource(&pdev->dev, res);
}
EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource_byname);
-#endif /* CONFIG_HAS_IOMEM */
/**
* platform_get_irq_optional - get an optional IRQ for a device
diff --git a/lib/Makefile b/lib/Makefile
index b1c42c10073b..35c21af33b93 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -115,7 +115,7 @@ obj-y += math/ crypto/
obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o
-obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o
+obj-y += iomap_copy.o devres.o
obj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o
obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o
--
2.28.0.rc0.105.gf9edc3c819-goog
Powered by blists - more mailing lists