Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13083404ybl; Sun, 29 Dec 2019 04:15:51 -0800 (PST) X-Google-Smtp-Source: APXvYqwkXchOarNURGAktm/rZUJ4strL7poE9alczj9U5xBUchhaS068iIkjkr2JicBD4zV1ZhL3 X-Received: by 2002:a05:6830:1715:: with SMTP id 21mr23505200otk.145.1577621751778; Sun, 29 Dec 2019 04:15:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577621751; cv=none; d=google.com; s=arc-20160816; b=QJaYjaOdzdLF/gDo2te7/uyNhct6194ccTxLDjSdQqdSGP32zVYpp4r2j6NoX3pc3f YD2Titmh/Riw2sLe6Aj+mF4tlj0/m/bTrjsTBCw2TSrzAsq0BK6i2p9fJwIuGeA+r/Sc QjSYF1hK2A1dMmcYfEhg3XF3Lw8EDe8rO+QpPGIc1QbbIs2npOsgJEVh7R/jupXRxqye 8H28za47xteFYZwNyxrYIuOcm/w5kyESUZtlkzDvF4V4uX9kL6+Q9yGt5NItHvwvMJHg WRBJXEGJMnF634ljYsN+eAywOB8TbUdJ1CqfvQ1x5dqhHKWb5czbxMgKH1InyVI9BzRx U3vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=3NS0YuGMiOiXrvIw4OA/SAcuSinUcRqRdHd2DvYzoZU=; b=nZHsVzAn6dWmQs1AkbaIA1HiN6d2rBRAYeVcmRbgyDKFiM5SCcoG9XuQ8YdPx/tKts pQX1+4mUDubMlHSBK27NUHkzSFamZ7FPIEKqjTJ7GAhczbtwysmkKfid4Lu55RzWKJNX wdJ6ZFf8m/yy5Hqe9HqXF/CemQaJ09KJ9534qqxkijuIEhK7rfTDSmvP6ZyPigOHQZie MAuDOtXX+OfqeGmv1zpjIhCGrAf3dkyagLI5zx15GYsrL9TD7Buzuilaj15OGrhQYDSb vMggkTVAz+p5EcI+0OEvFfHw7cNUDOhL5+/XWhfEcusK9wekSNHVGq68UTKYxYC8cO9P iP/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=NFSeelGF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l20si20705170otr.227.2019.12.29.04.15.40; Sun, 29 Dec 2019 04:15:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=NFSeelGF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726410AbfL2MOJ (ORCPT + 99 others); Sun, 29 Dec 2019 07:14:09 -0500 Received: from mail-qv1-f67.google.com ([209.85.219.67]:35571 "EHLO mail-qv1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726189AbfL2MOI (ORCPT ); Sun, 29 Dec 2019 07:14:08 -0500 Received: by mail-qv1-f67.google.com with SMTP id u10so11467535qvi.2 for ; Sun, 29 Dec 2019 04:14:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=3NS0YuGMiOiXrvIw4OA/SAcuSinUcRqRdHd2DvYzoZU=; b=NFSeelGFUGbKCnY4MqSk5IrHuOJpyf1wo+pWVTHkHUds2ORXCZQ9ZdmXN9EihMp0G5 lHRNAdHN6dIOmbMgTi4yyntauiOE27BDDXpJKSUPL2oU5yT979aRlmrQE0dZZniw3jiJ pSPph8NB+DQM24IoCts8J/eQ75Dsg0nBWkwQ+LdHJE2UDadceeR6HyFyJ5eEm/8uUVoZ m9ebwScQ2dmn7eZkiD72WzW2SY0LgiDseNBOgNc3498eMD5CXqkFc0N9fgkZlC8KrXlX c9PB701VLPkZaRHo2CNIXoSRKwJB/SoveGPMHsShioMhaty7FQFVOQh319uxfaLWLbTg CAvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=3NS0YuGMiOiXrvIw4OA/SAcuSinUcRqRdHd2DvYzoZU=; b=Yd83D7JYpBXhmQMRk4MyfDdePjN+AkWw5Qrd9rAGQQJmBNFoFimclMHwJXWqHwGsA3 QSPyVqy1MNUKfgZyzUFnuZhAKzZcE0iXII7NwKdBu3d0RMb02YZI1EGRwYjUBqj1lUhe uDrCEO4mvYTwC/rJbsiHihAIx64sH8hGlpurSy9uh1JWGTg9+IAczPYLOenPsOyH31xh sgy9iCbF3uL44MM60JRSzIqCqyVNgQbLk1LIHM+ZtnfmUTiy6BdwKi1PSfREZv7qHcn9 zmCYyGMHtNJ/cayVkyxvfRgk5EiklM4hrIZaHUIHUr0rZOTgv4/L+B3rr//RcylWxUa8 lufw== X-Gm-Message-State: APjAAAVEssHRZ59tzZsRSW1dT2PysRlaJGeszdC4rT4AExau5KYydP5t 8KUK8hqS950RRw1pgUnIdIrOTIvnkbZSl5Vo+yH04w== X-Received: by 2002:ad4:55e8:: with SMTP id bu8mr48113914qvb.61.1577621647544; Sun, 29 Dec 2019 04:14:07 -0800 (PST) MIME-Version: 1.0 References: <20191210203149.7115-1-tiny.windzz@gmail.com> In-Reply-To: From: Bartosz Golaszewski Date: Sun, 29 Dec 2019 13:13:56 +0100 Message-ID: Subject: Re: [PATCH] drivers: add devm_platform_ioremap_resource_byname() helper To: Frank Lee Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Srini Kandagatla , Vladimir Zapolskiy , Kevin Hilman , Maxime Ripard , Chen-Yu Tsai , Andy Shevchenko , Mauro Carvalho Chehab , mans@mansr.com, treding@nvidia.com, suzuki.poulose@arm.com, Thomas Gleixner , Linux Kernel Mailing List , Linux ARM , linux-amlogic@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org sob., 28 gru 2019 o 18:39 Frank Lee napisa=C5=82(a)= : > > ping... > > On Wed, Dec 11, 2019 at 4:31 AM Yangtao Li wrote: > > > > There are currently 300+ instances of using platform_get_resource_bynam= e() > > and devm_ioremap_resource() together in the kernel tree. > > > > This patch wraps these two calls in a single helper. > > > > Signed-off-by: Yangtao Li > > --- > > drivers/base/platform.c | 22 +++++++++++++++++++++- > > include/linux/platform_device.h | 3 +++ > > 2 files changed, 24 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c > > index b6c6c7d97d5b..9c4f5e229600 100644 > > --- a/drivers/base/platform.c > > +++ b/drivers/base/platform.c > > @@ -60,6 +60,7 @@ struct resource *platform_get_resource(struct platfor= m_device *dev, > > } > > EXPORT_SYMBOL_GPL(platform_get_resource); > > > > +#ifdef CONFIG_HAS_IOMEM > > /** > > * devm_platform_ioremap_resource - call devm_ioremap_resource() for a= platform > > * device > > @@ -68,7 +69,7 @@ EXPORT_SYMBOL_GPL(platform_get_resource); > > * resource management > > * @index: resource index > > */ > > -#ifdef CONFIG_HAS_IOMEM > > + > > void __iomem *devm_platform_ioremap_resource(struct platform_device *p= dev, > > unsigned int index) > > { > > @@ -78,6 +79,25 @@ void __iomem *devm_platform_ioremap_resource(struct = platform_device *pdev, > > return devm_ioremap_resource(&pdev->dev, res); > > } > > EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource); > > + > > +/** > > + * devm_platform_ioremap_resource_byname - call devm_ioremap_resource(= ) for > > + * a platform device > > + * > > + * @pdev: platform device to use both for memory resource lookup as we= ll as > > + * resource managemend > > + * @name: resource name > > + */ > > +void __iomem * > > +devm_platform_ioremap_resource_byname(struct platform_device *pdev, > > + const char *name) > > +{ > > + struct resource *res; > > + > > + res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, name= ); > > + return devm_ioremap_resource(&pdev->dev, res); > > +} > > +EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource_byname); > > #endif /* CONFIG_HAS_IOMEM */ > > > > static int __platform_get_irq(struct platform_device *dev, unsigned in= t num) > > diff --git a/include/linux/platform_device.h b/include/linux/platform_d= evice.h > > index 1b5cec067533..24ff5da9c532 100644 > > --- a/include/linux/platform_device.h > > +++ b/include/linux/platform_device.h > > @@ -63,6 +63,9 @@ extern int platform_irq_count(struct platform_device = *); > > extern struct resource *platform_get_resource_byname(struct platform_d= evice *, > > unsigned int, > > const char *); > > +extern void __iomem * > > +devm_platform_ioremap_resource_byname(struct platform_device *pdev, > > + const char *name); > > extern int platform_get_irq_byname(struct platform_device *, const cha= r *); > > extern int platform_add_devices(struct platform_device **, int); > > > > -- > > 2.17.1 > > This exact routine has existed upstream since commit c9c8641d3ebd ("drivers: provide devm_platform_ioremap_resource_byname()"). What version are you working on? Bart