Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp38293083rwd; Wed, 12 Jul 2023 05:58:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlGjIxLHTHTGKP/DMyIlGC+0LaqWcUU9dEqqY5jsM56i6Xw3BTedMnUAeCa8VUVh35OxRUvG X-Received: by 2002:a5d:42ca:0:b0:314:3dd7:bb9e with SMTP id t10-20020a5d42ca000000b003143dd7bb9emr16804427wrr.7.1689166689587; Wed, 12 Jul 2023 05:58:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689166689; cv=none; d=google.com; s=arc-20160816; b=VJUTLDDWa31Qe3ZvzraPMGIs+Yqz4d91HShn9SMo7jvY74C2nfvVox9iVlnc1zF3jI 0NGc6gHBgzlGzvM2rN8uaq727qDrtg1y+KaCcCjJTTSFlniTTRVbA3At6Mip+4AFfc0O 7U4jh+Saj7N1ChuPE7VNCZZ7L/e3VwuwdaW+Mz4lrrEcLJ9QPOe5PQ/aFPCDRD1tItqc 2t70x0UA+iJnhu66YpPb83ojoosbr8n7cPOHFE1FciDiw3QMJ0Z7NlsOtYJ6Hbcxtnqx iw9wj8rB+vtBm0sLe1bdj84FEV0To9dCt8gSj8+pDYeOHg1j4Pw5SymdhkkNqUupYgvu FxMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=zvTXj2XKIImCanBcXd2KzasaETb74Ehz2NCjHpi8yRA=; fh=9KBkte6mMdUnx9dCJ3iwRkYBDfl69Hp+5APePEieE3A=; b=la2qcB0m5bujDBHRPrZDvLgP9uYnm5R1HSFKR+C2R9Z5Yncb6Ue0CauQ+sfDpAO1uW T+7tqI7dBfC9Yid9l34bkf5HM2PAPbEVr6BFPWONeiW+mwSjM3UBuasVUvP+slMV+9uB gaYiovOTZNi24KAk3LHlqGXqj/Ce1K3WWYI77jiZ0HRAYSALauTSMlqzt9qbwPZwMUXc 23tm5ZYKlAJjlebz+avzcAvaG8FmJVQpPs3adyvmafAELe0J+ZPRCXXbMhtzFFs8xTQl skveN3aeRCV7e9UHagTvylPXzs6Rk1t/08Z2XB3DbnJWa6lUhQAiz/24UvHKnLATZu+x i4ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=flF18ImE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f4-20020a17090624c400b00991e6951c1bsi4429345ejb.423.2023.07.12.05.57.45; Wed, 12 Jul 2023 05:58:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=flF18ImE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231370AbjGLMKB (ORCPT + 99 others); Wed, 12 Jul 2023 08:10:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbjGLMJ7 (ORCPT ); Wed, 12 Jul 2023 08:09:59 -0400 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6A1DE4D for ; Wed, 12 Jul 2023 05:09:57 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 2C5EB1BF214; Wed, 12 Jul 2023 12:09:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1689163796; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zvTXj2XKIImCanBcXd2KzasaETb74Ehz2NCjHpi8yRA=; b=flF18ImExTNqBaUSiEUNqXskEu134Ys8W2gfI8indQjF8nRIKYFPdmi5VGR+vPgzm2ob1d CVohabiv7UJjNqBz2mdRRPrgFEEsRmyswj+7isa3Nq86JPDCZplyVZG2f7VBSGs6WyqjHZ /mBWutSDzFKrrkk4nLIExk/fHlpAmTE9wIgdIDQoH7TaDbc/Wr6J1JptosxhOxJaTDbr+9 O+P0Xss+c1njp+zC60pzXqsVqVqwQLPUnzubjgMmiaW8fDVzXnE1h8zkwORGVvsJprHT/e APIewenREK6JwuAjx+t31q+0e2/xHTZfMWjFlkfrxHF3WJGNNUB8eH18oxn9CA== Date: Wed, 12 Jul 2023 14:09:53 +0200 From: Miquel Raynal To: Yangtao Li Cc: Richard Weinberger , Vignesh Raghavendra , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 09/18] mtd: rawnand: davinci: Convert to devm_platform_ioremap_resource() Message-ID: <20230712140953.30b5309c@xps-13> In-Reply-To: <20230707040622.78174-9-frank.li@vivo.com> References: <20230707040622.78174-1-frank.li@vivo.com> <20230707040622.78174-9-frank.li@vivo.com> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: miquel.raynal@bootlin.com X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Yangtao, frank.li@vivo.com wrote on Fri, 7 Jul 2023 12:06:13 +0800: > Use devm_platform_ioremap_resource() to simplify code. >=20 > Signed-off-by: Yangtao Li > --- > drivers/mtd/nand/raw/davinci_nand.c | 21 +++++++++------------ > 1 file changed, 9 insertions(+), 12 deletions(-) >=20 > diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/d= avinci_nand.c > index 415d6aaa8255..2db1cd1d3d03 100644 > --- a/drivers/mtd/nand/raw/davinci_nand.c > +++ b/drivers/mtd/nand/raw/davinci_nand.c > @@ -710,8 +710,7 @@ static int nand_davinci_probe(struct platform_device = *pdev) > { > struct davinci_nand_pdata *pdata; > struct davinci_nand_info *info; > - struct resource *res1; > - struct resource *res2; > + struct resource *res; > void __iomem *vaddr; > void __iomem *base; > int ret; > @@ -736,26 +735,24 @@ static int nand_davinci_probe(struct platform_devic= e *pdev) > =20 > platform_set_drvdata(pdev, info); > =20 > - res1 =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); > - res2 =3D platform_get_resource(pdev, IORESOURCE_MEM, 1); > - if (!res1 || !res2) { > - dev_err(&pdev->dev, "resource missing\n"); > - return -EINVAL; > - } > - > - vaddr =3D devm_ioremap_resource(&pdev->dev, res1); > + vaddr =3D devm_platform_ioremap_resource(pdev, 0); > if (IS_ERR(vaddr)) > return PTR_ERR(vaddr); > =20 > + res =3D platform_get_resource(pdev, IORESOURCE_MEM, 1); > + if (!res) { > + dev_err(&pdev->dev, "resource missing\n"); > + return -EINVAL; > + } > /* > * This registers range is used to setup NAND settings. In case with > * TI AEMIF driver, the same memory address range is requested already > * by AEMIF, so we cannot request it twice, just ioremap. > * The AEMIF and NAND drivers not use the same registers in this range. > */ > - base =3D devm_ioremap(&pdev->dev, res2->start, resource_size(res2)); > + base =3D devm_ioremap(&pdev->dev, res->start, resource_size(res)); > if (!base) { > - dev_err(&pdev->dev, "ioremap failed for resource %pR\n", res2); > + dev_err(&pdev->dev, "ioremap failed for resource %pR\n", res); I believe this is the only use of the resource, I am in favor of just using the regular devm_platform_ioremap_resource() helper here and just drop the reference to the resource from the message. I will apply all other patches, please send a v2 only for this one once improved. > return -EADDRNOTAVAIL; > } > =20 Thanks, Miqu=C3=A8l