Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp12325019ybl; Sat, 28 Dec 2019 09:43:02 -0800 (PST) X-Google-Smtp-Source: APXvYqx09G+DudEl61Qjv6WIw+hLLH6QdD/WXQc6I8AKAff4joFqw6YgkmUH/3XDM0mD6kEfDk9Z X-Received: by 2002:a05:6830:145:: with SMTP id j5mr61439621otp.242.1577554982080; Sat, 28 Dec 2019 09:43:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577554982; cv=none; d=google.com; s=arc-20160816; b=S/x6ol4iZNa+ficJTeQMmxVK4+fAZvcVKvYo/7ycOaPaBhTZAIzvt0v2IbJgnhHmMt 8zsv7vk+rx1o41sU2mMMr3A+uxyaAVQyzAr8xygkdCRksUoKlqT3s7Aw6SRjI4c5ctju t7jZLA8g4Qj3x/dUpxe3V/y37/sZoFZ/TednfbocrFVxPf0HRSF2ek0D4ozh9I1zH8Bj ZoImceInCy2NhGvxdoOzpFJWUD43c3YsKR1sEjqv6v5s2uDfOWuW/gxuEOIw5L6EWGr5 FW6xVNQe5n3Wc/WuIcNGYW1OS3cuXBhId2sRosIJc0C1NTQWJNs4ro05hVLyNbfc9tp3 OKnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=nkCMArF5O7FXPw9BK2mgjdrIaTyHpsDk1hbsnTlNyJs=; b=Q/aoWd9z8xNQ85aWdVzIVy3Wco4VIN/ioWbvhFrzqfkNVFSkpM4pEzzudrnFR7Bm52 zIy7gTAXzOHRyfTgwjUVJAkQzoQGtf12inTh/OsC9nIX//ZqdHXoTPplf7Uzt7eBY2oo VHXbuDB0ePf263VTe0XG0V5bHrZEZ6210S2ZRDjsbFc4z6TvOXKu4GFoCzWrQ4eWUh+h j7fPZ0xDiKKRnIbrBS23S7buMKFqqd7LjtR9/90PskD5GfiTDy5SklGkux5BOzE24KpB 5UjYLSKyripuG1l9i6wMZy34CCjIl9Ntr+JKuq71dxjVJXQMB/Vcg8H86sAWHYpf9HrI 0Ggg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=stqjHdMI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b137si19442603oii.63.2019.12.28.09.42.35; Sat, 28 Dec 2019 09:43:02 -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=@gmail.com header.s=20161025 header.b=stqjHdMI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726343AbfL1Rje (ORCPT + 99 others); Sat, 28 Dec 2019 12:39:34 -0500 Received: from mail-io1-f65.google.com ([209.85.166.65]:38817 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726088AbfL1Rje (ORCPT ); Sat, 28 Dec 2019 12:39:34 -0500 Received: by mail-io1-f65.google.com with SMTP id v3so28305278ioj.5 for ; Sat, 28 Dec 2019 09:39:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nkCMArF5O7FXPw9BK2mgjdrIaTyHpsDk1hbsnTlNyJs=; b=stqjHdMIvlCCQU7QSqBhhrLQXtLp4MjfeRb6tc8UaWpblVQe6np+9BiXPqJ4FM+lCs 60yIPCesMBN/wWiJiAb/UrVnMfND7ZNzcTOQv8NTHRm9wqQp/Z2B3sLhGpjRnJzjzfFq 1rPAFgLDUk5BylE/oIzVbfUub9tQLyIiedJL6E4NH8RAbNTI4ASDEwM8loFlLcAg6BRw ug9Vof8O1H3TXd8hOmCok9FwhAGsJLZ3o5EFhr4BoxOGrruWfIgGNS/A0qbdGod3YtHh wACkY8OpHm//bPKKEL6nXtEOyYslQqOoaXnMPSQJG4JvdO0PR5nCqAmMp6ngAQXiYLXa LSOA== 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; bh=nkCMArF5O7FXPw9BK2mgjdrIaTyHpsDk1hbsnTlNyJs=; b=hulJScJ/1rCmXrGEgBw1cu+YNTQ9Bh3pIy6iMwfLqcqsRd5pjbFCNVc2qayb9FHDDo G0aVDvYYju31ym4QcAsfeykf3qXHDK5wkEarcSNwOulrWZ4dLoujUlE2KPOBgpPguTQ2 VdsnIC9Ys/f4/FkkU96XO47xtdlyFq3mRMP2c03Hs5HbGQAs26f5k2tmNP1Ik3gMXTW5 098jhmmxRne+6+054MiX1sjWYRAqKmUL//yUzfsNZB/8M50g8ep2NOpjNymjmMbkn0/b OGpua2GLaKlDTKxvtLb87yuZuLqpuzWBuHUmS9ceXCPPoXxQGuUFnOhUrmgnxd129K4A SDoA== X-Gm-Message-State: APjAAAXkaBDEuhriqVEwJJgdDArrFx1m4he1CbBb84Jn3mqBXtqKVS1G EkOkp/XcCLZm8jb4JJXc9RsfyNVMsdaH0kYUlxw= X-Received: by 2002:a6b:c410:: with SMTP id y16mr36580386ioa.18.1577554773160; Sat, 28 Dec 2019 09:39:33 -0800 (PST) MIME-Version: 1.0 References: <20191210203149.7115-1-tiny.windzz@gmail.com> In-Reply-To: <20191210203149.7115-1-tiny.windzz@gmail.com> From: Frank Lee Date: Sun, 29 Dec 2019 01:39:21 +0800 Message-ID: Subject: Re: [PATCH] drivers: add devm_platform_ioremap_resource_byname() helper To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Srini Kandagatla , vz@mleia.com, khilman@baylibre.com, Maxime Ripard , Chen-Yu Tsai , andriy.shevchenko@linux.intel.com, Mauro Carvalho Chehab , mans@mansr.com, treding@nvidia.com, suzuki.poulose@arm.com, bgolaszewski@baylibre.com, tglx@linutronix.de Cc: Linux Kernel Mailing List , Linux ARM , linux-amlogic@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ping... On Wed, Dec 11, 2019 at 4:31 AM Yangtao Li wrote: > > There are currently 300+ instances of using platform_get_resource_byname() > 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 platform_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 *pdev, > 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 well as > + * resource managemend > + * @name: resource name > + */ > +void __iomem * > +devm_platform_ioremap_resource_byname(struct platform_device *pdev, > + const char *name) > +{ > + struct resource *res; > + > + res = 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 int num) > diff --git a/include/linux/platform_device.h b/include/linux/platform_device.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_device *, > 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 char *); > extern int platform_add_devices(struct platform_device **, int); > > -- > 2.17.1 >