All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/5] driver core: platform: Introduce platform_get_mem_or_io_resource()
@ 2020-10-27 17:58 Andy Shevchenko
  2020-10-27 17:58 ` [PATCH v1 2/5] vfio: platform: Switch to use platform_get_mem_or_io_resource() Andy Shevchenko
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Andy Shevchenko @ 2020-10-27 17:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: Andy Shevchenko, Eric Auger, Alex Williamson, Cornelia Huck, kvm,
	linux-usb, Peng Hao, Arnd Bergmann

There are at least few existing users of the proposed API which
retrieves either MEM or IO resource from platform device.

Make it common to utilize in the existing and new users.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Eric Auger <eric.auger@redhat.com>
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: kvm@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: Peng Hao <peng.hao2@zte.com.cn>
Cc: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/platform_device.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 77a2aada106d..eb8d74744e29 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -52,6 +52,19 @@ extern struct device platform_bus;
 
 extern struct resource *platform_get_resource(struct platform_device *,
 					      unsigned int, unsigned int);
+static inline
+struct resource *platform_get_mem_or_io_resource(struct platform_device *pdev,
+						 unsigned int num)
+{
+	struct resource *res;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, num);
+	if (res)
+		return res;
+
+	return platform_get_resource(pdev, IORESOURCE_IO, num);
+}
+
 extern struct device *
 platform_find_device_by_driver(struct device *start,
 			       const struct device_driver *drv);
-- 
2.28.0


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

end of thread, other threads:[~2020-12-09 18:23 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-27 17:58 [PATCH v1 1/5] driver core: platform: Introduce platform_get_mem_or_io_resource() Andy Shevchenko
2020-10-27 17:58 ` [PATCH v1 2/5] vfio: platform: Switch to use platform_get_mem_or_io_resource() Andy Shevchenko
2020-12-03 12:54   ` Auger Eric
2020-12-03 13:07     ` Andy Shevchenko
2020-12-09 14:47       ` Greg Kroah-Hartman
2020-12-09 16:48         ` Andy Shevchenko
2020-12-09 16:53           ` Greg Kroah-Hartman
2020-12-09 18:22             ` Andy Shevchenko
2020-12-03 13:22   ` Cornelia Huck
2020-12-03 18:05   ` Alex Williamson
2020-10-27 17:58 ` [PATCH v1 3/5] usb: host: sl811: " Andy Shevchenko
2020-10-27 17:58 ` [PATCH v1 4/5] misc: pvpanic: Combine ACPI and platform drivers Andy Shevchenko
     [not found]   ` <CAK8P3a3XgTD2bFej0=WsD3a=uMur36_C71EiOvw3wb5A9QPAfQ@mail.gmail.com>
2020-10-28 15:51     ` Arnd Bergmann
2020-10-28 16:27       ` Andy Shevchenko
2020-10-27 17:58 ` [PATCH v1 5/5] misc: pvpanic: Replace OF headers by mod_devicetable.h Andy Shevchenko
2020-12-03 13:21 ` [PATCH v1 1/5] driver core: platform: Introduce platform_get_mem_or_io_resource() Cornelia Huck

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.