From: Cornelia Huck <cohuck@redhat.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, Eric Auger <eric.auger@redhat.com>,
Alex Williamson <alex.williamson@redhat.com>,
kvm@vger.kernel.org, linux-usb@vger.kernel.org,
Peng Hao <peng.hao2@zte.com.cn>, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH v1 1/5] driver core: platform: Introduce platform_get_mem_or_io_resource()
Date: Thu, 3 Dec 2020 14:21:40 +0100 [thread overview]
Message-ID: <20201203142140.73a0c5e6.cohuck@redhat.com> (raw)
In-Reply-To: <20201027175806.20305-1-andriy.shevchenko@linux.intel.com>
On Tue, 27 Oct 2020 19:58:02 +0200
Andy Shevchenko <andriy.shevchenko@linux.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@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,
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@redhat.com>
prev parent reply other threads:[~2020-12-03 13:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
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-12-03 13:21 ` Cornelia Huck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201203142140.73a0c5e6.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=eric.auger@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=peng.hao2@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).