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 X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A90CBC5ACD8 for ; Wed, 18 Mar 2020 10:10:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B87120768 for ; Wed, 18 Mar 2020 10:10:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584526220; bh=NGAukJ+3Nmmxnzl16xW5wI96d5RF3onz8IR/ReVAjHo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=zQ6lTaKwDOV0ZlR5mSxvvDR7oBZCv392FrnsXRTFBuAGH5ou4dJu69cjUhxfbQ+Dl W+9Izz9To4WxxpZw2yqZLsUPKEnW6NkRrYg0a/hhr5cqI1wpQdNZz+e8bEaRWaamwE yTTP3lEKOqMlRGFUBH9fCjvbXCtxj0R2AueeNHwo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726933AbgCRKKN (ORCPT ); Wed, 18 Mar 2020 06:10:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:52994 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726733AbgCRKKN (ORCPT ); Wed, 18 Mar 2020 06:10:13 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4BF2120768; Wed, 18 Mar 2020 10:10:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584526212; bh=NGAukJ+3Nmmxnzl16xW5wI96d5RF3onz8IR/ReVAjHo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XcSuvV7Md+YK8Gf6tvrlo7AcBNA2D086+W51Am5qGEnEwuSd92PdqPgVsQrezzgGq lOK8xGEaZuuLtBalvRfUbfB/H0DqXC+3iv/I+2sPzxlYMPQoqpvjvcDlLKsm7GP7/A 1/PBA/H50A5hIE5OS9dJOceeunzguK1XBoWlWJKY= Date: Wed, 18 Mar 2020 11:10:10 +0100 From: Greg KH To: Geert Uytterhoeven Cc: Dejin Zheng , "Rafael J. Wysocki" , Minas Harutyunyan , Mathias Nyman , Bartosz Golaszewski , Arnd Bergmann , Jeff Kirsher , Hans de Goede , Thierry Reding , Thomas Gleixner , "Winkler, Tomas" , Suzuki K Poulose , Sergei Shtylyov , USB list , Linux Kernel Mailing List Subject: Re: [PATCH v3 1/5] drivers: provide devm_platform_get_and_ioremap_resource() Message-ID: <20200318101010.GA2061266@kroah.com> References: <20200315140525.21780-1-zhengdejin5@gmail.com> <20200315140525.21780-2-zhengdejin5@gmail.com> <20200317192051.GA1520272@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Tue, Mar 17, 2020 at 08:35:16PM +0100, Geert Uytterhoeven wrote: > Hi Greg, > > On Tue, Mar 17, 2020 at 8:20 PM Greg KH wrote: > > On Sun, Mar 15, 2020 at 10:05:21PM +0800, Dejin Zheng wrote: > > > Since commit "drivers: provide devm_platform_ioremap_resource()", > > > it was wrap platform_get_resource() and devm_ioremap_resource() as > > > single helper devm_platform_ioremap_resource(). but now, many drivers > > > still used platform_get_resource() and devm_ioremap_resource() > > > together in the kernel tree. The reason can not be replaced is they > > > still need use the resource variables obtained by platform_get_resource(). > > > so provide this helper. > > > > > > Suggested-by: Geert Uytterhoeven > > > Suggested-by: Sergei Shtylyov > > > Signed-off-by: Dejin Zheng > > > --- > > > v2 -> v3: > > > - rename the function to > > > devm_platform_get_and_ioremap_resource() by Sergei's suggestion. > > > - make the last parameter res as optional by Geert's suggestion. > > > > > > v1 -> v2: > > > - No change. > > > > > > drivers/base/platform.c | 22 ++++++++++++++++++++++ > > > include/linux/platform_device.h | 3 +++ > > > 2 files changed, 25 insertions(+) > > > > > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c > > > index 7fa654f1288b..9f6a78f79235 100644 > > > --- a/drivers/base/platform.c > > > +++ b/drivers/base/platform.c > > > @@ -62,6 +62,28 @@ struct resource *platform_get_resource(struct platform_device *dev, > > > EXPORT_SYMBOL_GPL(platform_get_resource); > > > > > > #ifdef CONFIG_HAS_IOMEM > > > +/** > > > + * devm_platform_get_and_ioremap_resource - call devm_ioremap_resource() for a > > > + * platform device and get resource > > > + * > > > + * @pdev: platform device to use both for memory resource lookup as well as > > > + * resource management > > > + * @index: resource index > > > + * @res: get the resource > > > + */ > > > +void __iomem * > > > +devm_platform_get_and_ioremap_resource(struct platform_device *pdev, > > > + unsigned int index, struct resource **res) > > > +{ > > > + struct resource *r; > > > + > > > + r = platform_get_resource(pdev, IORESOURCE_MEM, index); > > > + if (res) > > > + *res = r; > > > > What happens if that call fails? Shouldn't that be checked? > > Then devm_ioremap_resource() will print an error message, and return > an error. > It's designed to be pipelined that way, so you have to check for an error > only once. Ok, thanks. Can I get an ack/reviewed-by for this series then? thanks, greg k-h