From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C676CF34A1 for ; Thu, 3 Oct 2024 12:01:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UTtnSXnJk3JLvfLo9Q0NgQAcDpewVAdseFo+29m2nI4=; b=w+I8BddM0ofXfeSuhSRvxjRKYg ndySmXBSpQr9YWg4DUz8rb7dnB9xpFJ6GIasxCq8ZFsZlNOJNWv5utLOGQUS7uCitTsGKjfxQsw44 wad0VZIaXmvTGd+4YEPTxlJo7vnZP0TCTAulk3JMQkvfMjkqfO90qFhDes/d901Yu6wKl6mQMy62m 8wpZOUIAWYQAmPOK+JJoZyd2TPYnh2fzzJE1vj7/+Jt1bvKm5n34FKYAvZ59lbNaOELBuDbMql/29 CVIBfJqTEgS58XeNqDcnguf100pi46KC4fusFspOp/rvFAldfofhIxdEj94EuSDwQtU5qz1MosVT3 45SqQkQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1swKW0-00000008y5V-2X43; Thu, 03 Oct 2024 12:01:04 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1swKUd-00000008xwq-0Svo for linux-arm-kernel@lists.infradead.org; Thu, 03 Oct 2024 11:59:45 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 5220F5C5BD6; Thu, 3 Oct 2024 11:59:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 952ABC4CEC5; Thu, 3 Oct 2024 11:59:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1727956778; bh=SYpAIjch7sjAvwc6DfsD+Yb8KF7SVa1BfiHQzyrY9UY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=W6Qq55em9Y+v8h2QVMDM5rZoxnoCFKUtBwczjyBQJBHtBssruG7SlzZS/Udo1e9xC wxzxV6FsDkZfOZM0Gcdy2b7pa+S2CFKavLcH3+H0qzVJDA3JUSEWAxU1VgIcwfCotj Vr+IT2tYo5ZuW/s4Q8TEVcRig2Z1qshHf4mQRba8= Date: Thu, 3 Oct 2024 13:59:35 +0200 From: Greg Kroah-Hartman To: Andrei Stefanescu Cc: Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chester Lin , Matthias Brugger , "Rafael J. Wysocki" , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP S32 Linux Team , Christophe Lizzi , Alberto Ruiz , Enric Balletbo , Krzysztof Kozlowski Subject: Re: [PATCH v4 1/4] drivers: provide devm_platform_get_and_ioremap_resource_byname() Message-ID: <2024100348-mortally-diary-f718@gregkh> References: <20240926143122.1385658-1-andrei.stefanescu@oss.nxp.com> <20240926143122.1385658-2-andrei.stefanescu@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240926143122.1385658-2-andrei.stefanescu@oss.nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241003_045939_255220_82B4C27F X-CRM114-Status: GOOD ( 20.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 > Reviewed-by: Matthias Brugger > Signed-off-by: Andrei Stefanescu > --- > 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