Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp595939ybm; Mon, 20 May 2019 23:39:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4Ame4NyKvJrCY0Dq556Nc3U10qxRyitv3GPC+1v+B2TRAWmGfWg09JJ57Et+C1dcdCxcI X-Received: by 2002:a62:e00e:: with SMTP id f14mr84907572pfh.257.1558420781959; Mon, 20 May 2019 23:39:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558420781; cv=none; d=google.com; s=arc-20160816; b=o+bTVazTtk0HPC7aCsHTcLOqm6Iv8k08S17Iyikw8UOURhtiGrKv8dEnLuPlUC+b8n tUBBrHko00b61dTIPVUy+DsDrGLO+0Z9PRqxeVpUYzehh4JTEPlOFrpBNA0xRVW1SkhB K0Vyuh2Qi6qwHWJtwhkjdHyM9o2vscl0Vid7HFVNkBBO8IZkjHX5wrB11W+sX/xZVrSV QjY95Cn72BB1wRtFrrEmXIeOCKoiNk/epwMoxkkbZRdWtLjqfCql4Yknhe20js3F7hEM LIoHUjSSDPmkDTrAAVHkJXZE8SojtgTHVQCUWD/sCnsnvsluJP7B3kSWwDRiQGgG7ebX 62Og== 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=3wKZ4IXB8g2hmXytMXYM1DsvOeazyNogr3S1uJhkvt8=; b=jn0BqpgHhYEViMyaAZB6x4ocVOGy4SfHJ8odcSnFQGwdnr2uu9RQa7nkdQB/2jhyY+ MnfB1P6b1mBjmqlOmrILNTSkO4uwCteRZJTKYb1v9KdE6xSTNTX/PckRLsJxsXf5I8Ut vujsn6NpFY5yulqzy0hKqsoa/rt5XlCxJ9w11wHpn8pDuibSfzoeqC7Z+xBRRx9CRGpn tc+nPbkg+Lipr2CQ4t7r7LT63AE/BGQYUVyF/+0DY9vppVmrsAaKlxpRZUKvNE70jML2 ls6yFrJd9wqpT07L3LIrDYl2B9lOouyww7n81KL5dvIeUPwuNtUszQ4/f0bQaEUlAVLl ubnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CmBlZ34b; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b12si21093748pfd.79.2019.05.20.23.39.27; Mon, 20 May 2019 23:39:41 -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; dkim=pass header.i=@linaro.org header.s=google header.b=CmBlZ34b; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726633AbfEUGiR (ORCPT + 99 others); Tue, 21 May 2019 02:38:17 -0400 Received: from mail-oi1-f193.google.com ([209.85.167.193]:45008 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726252AbfEUGiQ (ORCPT ); Tue, 21 May 2019 02:38:16 -0400 Received: by mail-oi1-f193.google.com with SMTP id z65so11902400oia.11 for ; Mon, 20 May 2019 23:38:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3wKZ4IXB8g2hmXytMXYM1DsvOeazyNogr3S1uJhkvt8=; b=CmBlZ34bXv10h+yhn07EjFFpEQjD4NUwHDKPZoWFbMURqp+7pZXePDFmSLm/brCQlw /xntKPradmiH6HvMqrfgZrO90GeDa/l8EqnJB/0aZ8f6AbZTv7pheYmEyyNIIizn47Dx 9jLmxAnoMh8gBm3uZr+KN3wMpAHkFHl1XEA1/7PIF1XTGH5I4Ue8iuNi9AnpJyw7shTE pgFk2pBKPyr6SQzVe1qznD1Ldngk6JpkNRjVp/14REDJmlOxH+d9eEk74r/TxekIuTAh E3IqFds4emnBnXzlrkSdY8OaPv3e5SUwwL0seOr2i5CWDWj7De02qes7DO1xu64zWWcb qo5g== 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=3wKZ4IXB8g2hmXytMXYM1DsvOeazyNogr3S1uJhkvt8=; b=QVdHEWTD0i1qCuTcRM6WRNuz9XOv2b2GiFvgZlasksF0+s7k6UQMD6hTxmZex+VT22 Co+1F/6cSvCY9OLEqIfL9rvgUcri7SCOaSPcQVSFD+VjnotxGJfubJmbc2AWTXh1QTDM xGR7XOeOeuMyMi1zksuHYbFfxmFc+HX1f00GEVPqwZJ8vPIqpZsFcKRfRrA5wDLPUHTP vTIY9/Y6azwJBD+eGhhAyivFwiLi625yHEszsKc6awmFTv06MVQXZKu1V/OleKPndwvh 9FTihuUbcC60hJp1H+0EfbxQ0LRk0QOtBlQKvyNycQqeMfKdfFgwaVK7M10zwbmTXcOv j8bA== X-Gm-Message-State: APjAAAVgx7+CIRr6qy/suNj/K9K/iPUGHSGSxuWDRrQHkSRXcqUOfTgk Ec9QUiGO50SfA2YkKMB0nlTxBQEIc/RUtAGE917Hrg== X-Received: by 2002:aca:61c3:: with SMTP id v186mr148825oib.27.1558420695476; Mon, 20 May 2019 23:38:15 -0700 (PDT) MIME-Version: 1.0 References: <20190521060952.2949-1-zhang.chunyan@linaro.org> <20190521060952.2949-2-zhang.chunyan@linaro.org> In-Reply-To: <20190521060952.2949-2-zhang.chunyan@linaro.org> From: Baolin Wang Date: Tue, 21 May 2019 14:38:03 +0800 Message-ID: Subject: Re: [PATCH 1/2] clk: sprd: Switch from of_iomap() to devm_ioremap_resource() To: Chunyan Zhang Cc: Stephen Boyd , linux-clk@vger.kernel.org, LKML , Orson Zhai , Chunyan Zhang 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 Hi Chunyan, On Tue, 21 May 2019 at 14:15, Chunyan Zhang wrote: > > devm_ioremap_resources() automatically requests resources and devm_ wrappers > do better error handling and unmapping of the I/O region when needed, > that would make drivers more clean and simple. > > Signed-off-by: Chunyan Zhang > --- > drivers/clk/sprd/common.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/sprd/common.c b/drivers/clk/sprd/common.c > index e038b0447206..a5bdca1de5d0 100644 > --- a/drivers/clk/sprd/common.c > +++ b/drivers/clk/sprd/common.c > @@ -42,6 +42,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev, > void __iomem *base; > struct device_node *node = pdev->dev.of_node; > struct regmap *regmap; > + struct resource *res; > > if (of_find_property(node, "sprd,syscon", NULL)) { > regmap = syscon_regmap_lookup_by_phandle(node, "sprd,syscon"); > @@ -50,10 +51,14 @@ int sprd_clk_regmap_init(struct platform_device *pdev, > return PTR_ERR(regmap); > } > } else { > - base = of_iomap(node, 0); > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + base = devm_ioremap_resource(&pdev->dev, res); > + if (IS_ERR(base)) > + return PTR_ERR(base); > + > regmap = devm_regmap_init_mmio(&pdev->dev, base, > &sprdclk_regmap_config); > - if (IS_ERR_OR_NULL(regmap)) { > + if (IS_ERR(regmap)) { You did not mention this fix in your commit message, and it's better to move into one separate patch. > pr_err("failed to init regmap\n"); > return PTR_ERR(regmap); > } > -- > 2.17.1 > -- Baolin Wang Best Regards