[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201203142140.73a0c5e6.cohuck@redhat.com>
Date: Thu, 3 Dec 2020 14:21:40 +0100
From: Cornelia Huck <cohuck@...hat.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, Eric Auger <eric.auger@...hat.com>,
Alex Williamson <alex.williamson@...hat.com>,
kvm@...r.kernel.org, linux-usb@...r.kernel.org,
Peng Hao <peng.hao2@....com.cn>, Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH v1 1/5] driver core: platform: Introduce
platform_get_mem_or_io_resource()
On Tue, 27 Oct 2020 19:58:02 +0200
Andy Shevchenko <andriy.shevchenko@...ux.intel.com> wrote:
> 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@...ux.intel.com>
> Cc: Eric Auger <eric.auger@...hat.com>
> Cc: Alex Williamson <alex.williamson@...hat.com>
> Cc: Cornelia Huck <cohuck@...hat.com>
> Cc: kvm@...r.kernel.org
> Cc: linux-usb@...r.kernel.org
> Cc: Peng Hao <peng.hao2@....com.cn>
> Cc: Arnd Bergmann <arnd@...db.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,
Minor nit: If I would want to break up the long line, I'd use
static inline struct resource *
platform_get_mem_or_io_resource(...)
> + 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);
Reviewed-by: Cornelia Huck <cohuck@...hat.com>
Powered by blists - more mailing lists