Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1637899ybm; Tue, 21 May 2019 18:17:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/wLc+u/4S1DZcCYMrODUYwRUxqtPPkMmglaIljeUNRlSb0bppll6WdrjIShbIjOE9xlmh X-Received: by 2002:aa7:9ab0:: with SMTP id x16mr84073360pfi.201.1558487826329; Tue, 21 May 2019 18:17:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558487826; cv=none; d=google.com; s=arc-20160816; b=RBAZ3IS4GyLFNURPcZ5Z4FfvvlMziZu7nGw48A9oj+jOlYv2ivlgLzywYgN8sECnVN Bxhngb4WGGAB52ND9kCyiIyLQEHkt/xVB6idv/dT45MZ7YMfbsen/VJPYjBv/Zpl1ut7 v9k9dwXTzqWe4ZxDquR7NbhvnFEHdoMli14jfYr7aT/PApFTLccEUbc4p32ccq/iZbos bQRvkJehRrYxlxkdn0d34TbgwVqQv4nACWcFYt0maUi62G0H+ae+yhHWpcOJFwiMXKDO KCXDICynpso3GVdrR+AnQfmyLqtNfpvvCJtdjOCYLJFOIDMkf9Dpw79KBJf2cZTcViqI tpQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=zgkPEB5XZ9b9X9cOU2xEF1BiqUs2NT/hLhDQBCKndyY=; b=wBVKTV5WMG5uXzUdCBVTxr94ajDWr0f9E71MuyUuXUPglg7kpcBA4W2ZVPv0kOkPWY Q4UbkpXNqjG8Am8gHPy/G7mKhe7V6Sdkrem7SV28VK1Xu1pTnwRb2Wv407bJP5nzNWkZ DVcIS6AR2CjAO9F4U3+mYMLL9UxZ2jREyeqk19ewrwZovW6kvMferHsY0WXVMrPjGE7h yfyoI2bO91x30ZVHbTUgFyp2LtzdsgHYhSqxTOvueqfDAmqGe6Otam76WgRGicQOtaaj 4fPBIU4PWZLPC1Hb6FkOor/9a5Fwa3hF+as73x+2DiZcYXiJvNMS8aIGDXi4Te7oL8Lx ACfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ICfWIVfa; 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 f8si26468640pfh.200.2019.05.21.18.16.51; Tue, 21 May 2019 18:17:06 -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=ICfWIVfa; 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 S1728184AbfEVBPl (ORCPT + 99 others); Tue, 21 May 2019 21:15:41 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:39461 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727930AbfEVBPl (ORCPT ); Tue, 21 May 2019 21:15:41 -0400 Received: by mail-pf1-f194.google.com with SMTP id z26so376432pfg.6 for ; Tue, 21 May 2019 18:15:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zgkPEB5XZ9b9X9cOU2xEF1BiqUs2NT/hLhDQBCKndyY=; b=ICfWIVfagetutSTP2wJda5tntZ8oDmNuRYEHtIPXtdZzblw9wcwSioYM0Cl1uKgkyF eJrq8x30tUjUiVJEBeuEd9L85/PFaHhXwWMjpn7vaV1+M+wlxyrehiIS3gi6zDtjpq1L xzg91FyV/tV0HK5AFOt2jNiDTc+/0XPZfAP9f1e24a7tRWBC0fYvNU3NCzvMrvlIQv6L b9nmQy2ntC5zKewyeT1UrrN/oNPxmokx7+8J0II081WOZUXWNLUDrQLiDU2dX6RxQ3h5 UTBsgH9nKnYynRkx4mvTI26Rb00Pt2Guq1VdML4bEstoJaBj06kEcJNeUqHxWP753buF /yxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zgkPEB5XZ9b9X9cOU2xEF1BiqUs2NT/hLhDQBCKndyY=; b=bEg/mNRVMVyRpkEiMHzEr68dfaDR9lp4YZeXHhy/sVq6BWLEFB1o7o2AwR4DIkx9RC 96KJVItAiIiaSPHFy6o4ugszjU1I2KDrVKwms6yl+DBSzGYHGv7IcGrokRQ1tikjR4lr otaC7/2tgdeW6RaKMQDoudHPj8p8FcI7SwuQy90V5UHBtYIc1MiID5x1dMMF3NN90pHL Gi0dqXJO5M/if0akndi1Sb2fcHk2ENFwXj3ETTmpkhx8nQuM9HqHR8ZRiqDjidVrOcHM EpLISqlmFGD6fv7lK86yyHykViAoIQJDO5iiyCZ//p8FuYqZUJTy7V6wVAnAh7blkssA HYnA== X-Gm-Message-State: APjAAAXyaY8PhclSLYztQ+S9wXOO4GVqXKGmYGQvKp1VIGiaK0pWK14a Jeurr8tFHWvv1CRApHXZXwbTvt5xqkw= X-Received: by 2002:a63:4c54:: with SMTP id m20mr87048720pgl.316.1558487740876; Tue, 21 May 2019 18:15:40 -0700 (PDT) Received: from ubt.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id e184sm31756061pfa.169.2019.05.21.18.15.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 May 2019 18:15:40 -0700 (PDT) From: Chunyan Zhang To: Stephen Boyd Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Orson Zhai , Chunyan Zhang , Baolin Wang Subject: [PATCH v2 1/3] clk: sprd: Switch from of_iomap() to devm_ioremap_resource() Date: Wed, 22 May 2019 09:15:01 +0800 Message-Id: <20190522011504.19342-2-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190522011504.19342-1-zhang.chunyan@linaro.org> References: <20190522011504.19342-1-zhang.chunyan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/clk/sprd/common.c b/drivers/clk/sprd/common.c index e038b0447206..9ce690999eaa 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,7 +51,11 @@ 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)) { -- 2.17.1