lkml.org 
[lkml]   [2020]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v1 1/5] driver core: platform: Introduce platform_get_mem_or_io_resource()
    Date
    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
    \
     
     \ /
      Last update: 2020-10-27 19:09    [W:2.999 / U:0.920 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site