All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] platform: ioremap: Build iomap functions even without HAS_IOMEM
@ 2020-07-21  5:45 ` David Gow
  0 siblings, 0 replies; 7+ messages in thread
From: David Gow @ 2020-07-21  5:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jeff Dike, rafael, Logan Gunthorpe,
	Richard Weinberger, Jonathan Cameron
  Cc: Brendan Higgins, kunit-dev, linux-um, linux-kernel, David Gow

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@google.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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [RFC PATCH] platform: ioremap: Build iomap functions even without HAS_IOMEM
@ 2020-07-21  5:45 ` David Gow
  0 siblings, 0 replies; 7+ messages in thread
From: David Gow @ 2020-07-21  5:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jeff Dike, rafael, Logan Gunthorpe,
	Richard Weinberger, Jonathan Cameron
  Cc: linux-um, Brendan Higgins, linux-kernel, David Gow, kunit-dev

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@google.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


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH] platform: ioremap: Build iomap functions even without HAS_IOMEM
  2020-07-21  5:45 ` David Gow
@ 2020-07-21 23:55   ` Brendan Higgins
  -1 siblings, 0 replies; 7+ messages in thread
From: Brendan Higgins @ 2020-07-21 23:55 UTC (permalink / raw)
  To: David Gow
  Cc: Greg Kroah-Hartman, Jeff Dike, Rafael J. Wysocki,
	Logan Gunthorpe, Richard Weinberger, Jonathan Cameron,
	KUnit Development, linux-um, Linux Kernel Mailing List

On Mon, Jul 20, 2020 at 10:45 PM David Gow <davidgow@google.com> wrote:
>
> 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@google.com>

Reviewed-by: Brendan Higgins <brendanhiggins@google.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH] platform: ioremap: Build iomap functions even without HAS_IOMEM
@ 2020-07-21 23:55   ` Brendan Higgins
  0 siblings, 0 replies; 7+ messages in thread
From: Brendan Higgins @ 2020-07-21 23:55 UTC (permalink / raw)
  To: David Gow
  Cc: Rafael J. Wysocki, Greg Kroah-Hartman, Jeff Dike, linux-um,
	Linux Kernel Mailing List, Richard Weinberger, Jonathan Cameron,
	Logan Gunthorpe, KUnit Development

On Mon, Jul 20, 2020 at 10:45 PM David Gow <davidgow@google.com> wrote:
>
> 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@google.com>

Reviewed-by: Brendan Higgins <brendanhiggins@google.com>

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH] platform: ioremap: Build iomap functions even without HAS_IOMEM
  2020-07-21  5:45 ` David Gow
@ 2020-07-23  8:41   ` Jonathan Cameron
  -1 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2020-07-23  8:41 UTC (permalink / raw)
  To: David Gow
  Cc: Greg Kroah-Hartman, Jeff Dike, rafael, Logan Gunthorpe,
	Richard Weinberger, Brendan Higgins, kunit-dev, linux-um,
	linux-kernel

On Mon, 20 Jul 2020 22:45:28 -0700
David Gow <davidgow@google.com> wrote:

> 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

Hi David,

I don't quite follow why we change when iomap_copy.c is built.
Was this just a case of there not seeming to be any reason to protect it
or is there a direct dependency on something in there that I'm missing?

Otherwise looks good to me.

Jonathan

> 
> Signed-off-by: David Gow <davidgow@google.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
>  



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH] platform: ioremap: Build iomap functions even without HAS_IOMEM
@ 2020-07-23  8:41   ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2020-07-23  8:41 UTC (permalink / raw)
  To: David Gow
  Cc: rafael, Greg Kroah-Hartman, Jeff Dike, Brendan Higgins,
	linux-kernel, linux-um, Richard Weinberger, Logan Gunthorpe,
	kunit-dev

On Mon, 20 Jul 2020 22:45:28 -0700
David Gow <davidgow@google.com> wrote:

> 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

Hi David,

I don't quite follow why we change when iomap_copy.c is built.
Was this just a case of there not seeming to be any reason to protect it
or is there a direct dependency on something in there that I'm missing?

Otherwise looks good to me.

Jonathan

> 
> Signed-off-by: David Gow <davidgow@google.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
>  



_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH] platform: ioremap: Build iomap functions even without HAS_IOMEM
  2020-07-21  5:45 ` David Gow
                   ` (2 preceding siblings ...)
  (?)
@ 2020-07-23  9:31 ` kernel test robot
  -1 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-07-23  9:31 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1707 bytes --]

Hi David,

[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on driver-core/driver-core-testing]
[also build test ERROR on linux/master linus/master v5.8-rc6 next-20200722]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/David-Gow/platform-ioremap-Build-iomap-functions-even-without-HAS_IOMEM/20200721-134709
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 6bdb486c5a628f7a927c2658166e3a5ef1f883e7
config: s390-allnoconfig (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=s390 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   s390-linux-ld: lib/devres.o: in function `devm_ioremap_release':
>> devres.c:(.text+0x28): undefined reference to `iounmap'
   s390-linux-ld: lib/devres.o: in function `__devm_ioremap':
>> devres.c:(.text+0xa2): undefined reference to `ioremap'
   s390-linux-ld: lib/devres.o: in function `devm_iounmap':
   devres.c:(.text+0x284): undefined reference to `iounmap'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 5942 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-07-23  9:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-21  5:45 [RFC PATCH] platform: ioremap: Build iomap functions even without HAS_IOMEM David Gow
2020-07-21  5:45 ` David Gow
2020-07-21 23:55 ` Brendan Higgins
2020-07-21 23:55   ` Brendan Higgins
2020-07-23  8:41 ` Jonathan Cameron
2020-07-23  8:41   ` Jonathan Cameron
2020-07-23  9:31 ` kernel test robot

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.