[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2024100348-mortally-diary-f718@gregkh>
Date: Thu, 3 Oct 2024 13:59:35 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Andrei Stefanescu <andrei.stefanescu@....nxp.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Chester Lin <chester62515@...il.com>,
Matthias Brugger <mbrugger@...e.com>,
"Rafael J. Wysocki" <rafael@...nel.org>, linux-gpio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
NXP S32 Linux Team <s32@....com>,
Christophe Lizzi <clizzi@...hat.com>,
Alberto Ruiz <aruizrui@...hat.com>,
Enric Balletbo <eballetb@...hat.com>,
Krzysztof Kozlowski <krzk@...nel.org>
Subject: Re: [PATCH v4 1/4] drivers: provide
devm_platform_get_and_ioremap_resource_byname()
On Thu, Sep 26, 2024 at 05:31:18PM +0300, Andrei Stefanescu wrote:
> Similar to commit 890cc39a879906b63912482dfc41944579df2dc6
> ("drivers: provide devm_platform_get_and_ioremap_resource()")
> add a wrapper for "platform_get_resource_byname" and
> "devm_ioremap_resource". This new wrapper also returns the resource, if
> any, via a pointer.
>
> Suggested-by: Krzysztof Kozlowski <krzk@...nel.org>
> Reviewed-by: Matthias Brugger <mbrugger@...e.com>
> Signed-off-by: Andrei Stefanescu <andrei.stefanescu@....nxp.com>
> ---
> drivers/base/platform.c | 27 +++++++++++++++++++++++++++
> include/linux/platform_device.h | 13 +++++++++++++
> 2 files changed, 40 insertions(+)
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 4c3ee6521ba5..da6827f9462a 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -108,6 +108,33 @@ devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
> }
> EXPORT_SYMBOL_GPL(devm_platform_get_and_ioremap_resource);
>
> +/**
> + * devm_platform_get_and_ioremap_resource_byname - call devm_ioremap_resource()
> + * for a platform device and get
> + * a resource by its name
> + *
> + * @pdev: platform device to use both for memory resource lookup as well as
> + * resource management
> + * @name: resource name
> + * @res: optional output parameter to store a pointer to the obtained resource.
> + *
> + * Return: a pointer to the remapped memory or an ERR_PTR() encoded error code
> + * on failure.
> + */
> +void __iomem *
> +devm_platform_get_and_ioremap_resource_byname(struct platform_device *pdev,
> + const char *name,
> + struct resource **res)
> +{
> + struct resource *r;
> +
> + r = platform_get_resource_byname(pdev, IORESOURCE_MEM, name);
> + if (res)
> + *res = r;
> + return devm_ioremap_resource(&pdev->dev, r);
Does this really help out much? Where will the end be if we keep
stacking these up like this, the function names are getting huge...
I'm not going to object, but I'm also not going to ack it :)
thanks,
greg k-h
Powered by blists - more mailing lists