From patchwork Tue May 21 06:09:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 164682 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1208798ili; Mon, 20 May 2019 23:15:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJgtVgLM0idG2iXUmwFD3cE6wQ4Sad5xbTLFJcLOiXA9AxJJwgnJX7HHyFghW8GBVKEKTz X-Received: by 2002:a17:902:4283:: with SMTP id h3mr57901951pld.214.1558419351616; Mon, 20 May 2019 23:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558419351; cv=none; d=google.com; s=arc-20160816; b=YWP76pyRtupLgZDwItN2jIo0jh7PIQ5OP6CrAavd8xnt5SssA9bDy8rrgGNF5WwSfc puW7zka7PbUS08rbdjeBxXrOBFh8tTCr57NFHfLWriurKjBJSfP8Jtfv6lPdrB3RUk8y nB0bzg16YAp6xbL7gvzAr7f8JnAwWBWxCVZZW6CdYG72J4zQJuFR3KEvh2Ot+3nmAoP4 sUYC74EoEQS++nBlFqhGabAv+afQXf0XbROXkQfeC50fLRGbPnOPD5pSRkYo98IXaNFI eLNmREEkHzlCWF4jJe/Uf7QKFTrrubvMCnATGY1ihffAO7v56ss+W6PBFAD76jL2ZcHV xwuQ== 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=7zIoh9PTrB07jZj7iAACd9ksENTR45V1gQMx0juES3c=; b=aq1GbE7GUvwQfesjuUp8Tt8BTM/x1CxKRpnv5i8IgEIx1B/lVg2OTwwQOP/wo+DKlu 9/0cc9dnBuUdIJxCkmI0jymRldAY64POHwL/oO2+n9/KvLt+V8ZV5cgZ0z/TM0WY29pQ jNL5TmYwUU9xkfhFqjYiCeg+UHztHDxcHWsmYobh99q35ZP5sqeFseU6rLCCKTYCQvYP yxI/S7EuGV48wPkcHydTRoY3kPfkjTLn41Ed6iv48UOMSVoVmr9rd1ikO05NgbP+EZYr wgsIRD6r2innTn94tP/iAjMTv47Mpa6UtQnwb8ugBX6JNdxy9WfoL4RlxweXxi/OihHW Y1RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SwGzEp38; 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 d5si21063484pgn.342.2019.05.20.23.15.51; Mon, 20 May 2019 23:15:51 -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=SwGzEp38; 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 S1727940AbfEUGPu (ORCPT + 30 others); Tue, 21 May 2019 02:15:50 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:45758 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726047AbfEUGPt (ORCPT ); Tue, 21 May 2019 02:15:49 -0400 Received: by mail-pf1-f195.google.com with SMTP id s11so8477437pfm.12 for ; Mon, 20 May 2019 23:15:49 -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=7zIoh9PTrB07jZj7iAACd9ksENTR45V1gQMx0juES3c=; b=SwGzEp384/HvkIrTU8NYuqCksWK+ZeUMUQuZiITmijbwFe7qqqKdN4VhfTLQeSOeyL bW9hlEc85ItEntQa+5uXTpXbI/BnrgelNJnjl1Arx+Hqy6/FRJFiWGhV3T9x+eGYCzB2 d/DXkLuGjXOgJPa8f2oQ+SkVaB60cEycHgyWojYLccCBhPa+F1pfeq1TrBXcZZ1ezQZW 7IYZzNbDzCShsNQYoKfqIbawvrvhW1bpeipWOHlQ+xtaiOwuWFm4+OFVgKfZ37Z7i6Nb y0JEXkduPLgCT1pj5RIkDjAVBGjSo5N+mXKjFxk7PJ15G0tft56fMjMmj4C9wkgbByMG cQTA== 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=7zIoh9PTrB07jZj7iAACd9ksENTR45V1gQMx0juES3c=; b=P0hdR+orMTf/84H+rVSOOKiC+4nRj39VOPnnDhDvatL5y8cWPsSqhjqG+j8i1U6/lR GzasrnVUWKP2JoXz/hWCge0j6On0EV1kC0vyNwMoPOwocKy4YXytWlEbsVlAeXmjmlgy EMWSJ+HIeJottdKrOAOIPKMCRh/E9mnj3GyAgg75KHc6+m8ApZ+nB3Ehs6hM2fGhqNpC ixGXueN/XcspWW4Hwh+Cvobrjb6tjcSs/X8hahpb5I98rmUKp2FUKGMVbn/A8GnIP4+9 DZTIpHACzDHimq/qxNhdModHG0U/sOUrqs/Mjm47Lef9s3CdAyOoMIMQPiY622xB2alL DFig== X-Gm-Message-State: APjAAAWo3YnEZqg3NbN4Qf7Rxltx+9V7yvJtLVSWA5o/g02WIPdeVBCY VgL8w68nFISFuZwYrMcwx8hd1A== X-Received: by 2002:a62:1a0f:: with SMTP id a15mr65093150pfa.111.1558419349191; Mon, 20 May 2019 23:15:49 -0700 (PDT) Received: from ubt.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id k9sm23064259pfa.180.2019.05.20.23.15.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 23:15:48 -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 1/2] clk: sprd: Switch from of_iomap() to devm_ioremap_resource() Date: Tue, 21 May 2019 14:09:51 +0800 Message-Id: <20190521060952.2949-2-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190521060952.2949-1-zhang.chunyan@linaro.org> References: <20190521060952.2949-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 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 2.17.1 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)) { pr_err("failed to init regmap\n"); return PTR_ERR(regmap); } From patchwork Tue May 21 06:09:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 164683 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1208856ili; Mon, 20 May 2019 23:15:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6p5qZKWAuJnXVCWHqy+hNwHeEis1CEZLVfGBPv1TxunIHT8xHN8U3PUV7euB1z/4wgBT7 X-Received: by 2002:a63:da14:: with SMTP id c20mr18488082pgh.191.1558419355869; Mon, 20 May 2019 23:15:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558419355; cv=none; d=google.com; s=arc-20160816; b=E7i13AuUTpXVD/rWf7zX3kbAJ6kTCsrROjNSoJGms3GEAK81CxOPKvw9D2bjA4d78R Vow1QNUfQa6Drmkji+pNJoufKejbIo1loIJVaMvpgzHvUFr68MRk/SuOnvL2jXAvZNpe /Frb5Tm+3Ga2N343I6yhe8fXlW/QpU/8CxFps5ovwtxZvQF1w/PxOBXYkp8tc8OqgFiA 2WcWRHhZYfrGBey6dTh6fPqLozFpgfr/i/IrVRyp0ncvNBw6/W1Irp/4E9mlFJ/kuU50 RWbVaqg/OP18h8Jxuv+T6X1T1swEptWUkQTJVyZ5F12dlWvYpPafcefjnptPdXDlP6a1 EpwA== 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=4R0Z1avkl5DcwArAEdYF5RKsOqx23+ElfNwQfhlhU8U=; b=BiT7+K3YDEwqRIP5nLpVNCarDmxxaZT1YmEXPTS2mhbyv6lXKWsSWgzdtj3TK4L2zv ifPDLyq8wp76z1sqcgV5BAzxPYVo83L/Sm8Q38NOjcXzsIzNuDd+ijdXxNBf1chCCaOl zTQ4kkOGzV1Zw4VNb3n/wcCV1NyAp+eK/gf4C7YtNZZVh68LZFgJYcxWRT3dsivwDPZt lzR9+lUNiqkfnHimtfXu/KxClO3g+kItC9I/iTp3Jq74oKxufqf1yVUYUaDfvOxyXaXI F8H1AVc0arFmaAbOD4dSNt+G7IZsFRfZ5Xz+Mfj/2Ef5hLAqVAfxfy22fy2uVFAsUX5H v7pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rWBEaPbO; 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 f7si3518340pgv.105.2019.05.20.23.15.55; Mon, 20 May 2019 23:15:55 -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=rWBEaPbO; 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 S1727962AbfEUGPy (ORCPT + 30 others); Tue, 21 May 2019 02:15:54 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:36128 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726047AbfEUGPx (ORCPT ); Tue, 21 May 2019 02:15:53 -0400 Received: by mail-pl1-f196.google.com with SMTP id d21so7913170plr.3 for ; Mon, 20 May 2019 23:15:53 -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=4R0Z1avkl5DcwArAEdYF5RKsOqx23+ElfNwQfhlhU8U=; b=rWBEaPbOv0Ze4QP+zKqhgDJLjfQzgBZRlveZ5KKv6jzAPxoKfCAc9mSKLdMx/9jL3v nFmY67X/QCW8SlSFYYtgtr2TOtMrAz6nEGWK5x5dVRjLFh50dq7JDUw3s7bj6SzJ/E8I Himrhy2bu8WjqyccmLGj1r/JBcUBmkSVcN5j03XkSzrLQHubwWAiU/iwEml7Aezz4Rfq iZrUP6ztMtgo70T0vL607ynlVJImepQp5080ijDfWbjzF7kV/qvfOP6gDITJnzPftl63 g1SpLgLn40kDNPNGJq5iNOEPcyabqIhbNJdrg+RJCt1/gxr4Zr+zuxsJQoz/T8vnXL2R LJ2Q== 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=4R0Z1avkl5DcwArAEdYF5RKsOqx23+ElfNwQfhlhU8U=; b=CNEO7b2fCW9MR3rg6YpTiFaOp6wcLvRBLgOhE45YyU7bg5AyOTFru3Xus9eWrFhjLY q3cAgHUjk+fAb5kAWiSXG6pPy8WWT07aHO1xtvhzXDJSyQDgBBiucTMNXHJjD6njnY8i eRLypXoRudKd410Zp+VadFD0cpVyg+Wtbmf8O0Fxy0TGWD9BFVi8OShFKI6atBlqrt2e T3QziWrIHBdJkTcU76aslEchbGOFMrxaPxax0CV7uIypm6bpLBBBiTXQYEYkIZCrfehZ /qg5Q+P6S06doCxKb0/icy05mu//YQ9ZsTi8oSJ1F6vsk5EU2vO1wU/wCkQDw3Ze6Wow wChA== X-Gm-Message-State: APjAAAU+Jk/fWQrD3H+qrMw3AOgfKtamKmilq1DXREwelWXbfdd8D34g hP/hMYYPr0lD0f1AEvKd46vezw== X-Received: by 2002:a17:902:1cb:: with SMTP id b69mr54576811plb.158.1558419352754; Mon, 20 May 2019 23:15:52 -0700 (PDT) Received: from ubt.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id k9sm23064259pfa.180.2019.05.20.23.15.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 23:15:52 -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 2/2] clk: sprd: Add check for return value of sprd_clk_regmap_init() Date: Tue, 21 May 2019 14:09:52 +0800 Message-Id: <20190521060952.2949-3-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190521060952.2949-1-zhang.chunyan@linaro.org> References: <20190521060952.2949-1-zhang.chunyan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org sprd_clk_regmap_init() doesn't always return success, adding check for its return value should make the code more strong. Signed-off-by: Chunyan Zhang --- drivers/clk/sprd/sc9860-clk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.17.1 Reviewed-by: Baolin Wang diff --git a/drivers/clk/sprd/sc9860-clk.c b/drivers/clk/sprd/sc9860-clk.c index 9980ab55271b..1ed45b4f2fe8 100644 --- a/drivers/clk/sprd/sc9860-clk.c +++ b/drivers/clk/sprd/sc9860-clk.c @@ -2031,7 +2031,9 @@ static int sc9860_clk_probe(struct platform_device *pdev) } desc = match->data; - sprd_clk_regmap_init(pdev, desc); + ret = sprd_clk_regmap_init(pdev, desc); + if (ret) + return ret; return sprd_clk_probe(&pdev->dev, desc->hw_clks); }