Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp979954ybi; Fri, 14 Jun 2019 06:39:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqw2tlkVP1ggIBYWIIt+SgeXM5guzg8gCi40v7g0BMlSjKeEXXrl+R17nUKqod0s21X10hUB X-Received: by 2002:a63:e54d:: with SMTP id z13mr35728947pgj.132.1560519587141; Fri, 14 Jun 2019 06:39:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560519587; cv=none; d=google.com; s=arc-20160816; b=iaufP1raEA89ghNj2squcJu9Vet0B0PICjjDzy59D7/9G5K0JvXQDbZVcGCCMrxNd/ vtV+8a+yuTrItji+nQG3D5ZrESQDxwxTn7zNB6Bvi9stqhoUFpuia9QVhlPyidKacLEN DDhpogWSnHHxdO8XJmkqbmxTr1X262dO1PRsrdX3rBvkN/YI0lNBlHlbyFC6rwMqcTDt FSw7rqZMm0bz4+AHLqyVp2xpQ+bVUFPX39YZkb+4WrJwHNNyBEoQq6GInIS0XlQFMB6v VIuXm43dXLVtbn0audpnZLkWqsDn3JsuZyMMZjR5CzlgBsF1sQyYVOXOEkNR7dbVQuFd aZeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=mf2bKQ1Z/VTq3e7QXHPp0wzQeyKuWquj296yPDRE/PY=; b=jsWT4XoArlbejnKak7UmH6MvGtT+kUdrxhcMaJ7BQZFWHIRatBDRfpK2gpkWWV3B06 /6y7XtPTeRMVKUK/TYQO0SLrOMY/jFh0MbCJ5UosBTZQ+PD9HxdwaH1BHetTKu8oTMlA akuUqhgRLgCcDBSxxdZc+qQcJSEObx7qtJ9Wn+UPbIH0yarDiVVmZBXeUPOsDagySUAT aalae+ar/Ma/+WFut3HQAdYhLysszqd/VP/8wJzwAbfAkqkMMBykq1WRCv1SYCfUyUjO 4uTiMla0A86r+0W5+rl/J1+tv7Yja0P6E4kueslVkfj5Qwm2spZmkdTbROcv8rZ0k12i YBhQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k137si2646020pga.59.2019.06.14.06.39.30; Fri, 14 Jun 2019 06:39:47 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728312AbfFNNip (ORCPT + 99 others); Fri, 14 Jun 2019 09:38:45 -0400 Received: from mga14.intel.com ([192.55.52.115]:37599 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727808AbfFNNip (ORCPT ); Fri, 14 Jun 2019 09:38:45 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jun 2019 06:38:44 -0700 X-ExtLoop1: 1 Received: from smile.fi.intel.com (HELO smile) ([10.237.68.145]) by orsmga003.jf.intel.com with ESMTP; 14 Jun 2019 06:38:41 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1hbmPg-0007Ry-BM; Fri, 14 Jun 2019 16:38:40 +0300 Date: Fri, 14 Jun 2019 16:38:40 +0300 From: Andy Shevchenko To: Markus Elfring , Jack Ping CHNG Cc: kernel-janitors@vger.kernel.org, Greg Kroah-Hartman , "Rafael J. Wysocki" , LKML , Bartosz Golaszewski , Enrico Weigelt , Himanshu Jha , Linus Walleij Subject: Re: [PATCH] drivers: Provide devm_platform_ioremap_resource_byname() Message-ID: <20190614133840.GN9224@smile.fi.intel.com> References: <39e46643-d799-94b7-4aa5-d6d99d738f99@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <39e46643-d799-94b7-4aa5-d6d99d738f99@web.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +Cc: Jack Ping, who did internally the same On Fri, Jun 14, 2019 at 03:26:25PM +0200, Markus Elfring wrote: > From: Markus Elfring > Date: Fri, 14 Jun 2019 15:15:14 +0200 > > The functions “platform_get_resource_byname” and “devm_ioremap_resource” > are called together in 181 source files. > This implementation detail can be determined also with the help > of the semantic patch language (Coccinelle software). > > Wrap these two calls into another helper function. > Thus a local variable does not need to be declared for a resource > structure pointer before and a redundant argument can be omitted > for the resource type. This one makes sense. Though I'm not sure Greg will see your message. Rafael, maybe you can apply this one? FWIW, Reviewed-by: Andy Shevchenko > > Signed-off-by: Markus Elfring > --- > drivers/base/platform.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c > index 4d1729853d1a..c1f19a479dd7 100644 > --- a/drivers/base/platform.c > +++ b/drivers/base/platform.c > @@ -97,6 +97,24 @@ 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 management > + * @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 */ > > /** > -- > 2.22.0 > -- With Best Regards, Andy Shevchenko