From patchwork Wed Jul 22 09:34:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 51336 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by patches.linaro.org (Postfix) with ESMTPS id 856AF20323 for ; Wed, 22 Jul 2015 09:38:44 +0000 (UTC) Received: by lbvb1 with SMTP id b1sf55324051lbv.3 for ; Wed, 22 Jul 2015 02:38:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=O+0sU96IchkAIYEgygNs57Hfb+cnxIGT1DzkFF+QfNg=; b=gzieHo3SOFGwla249kqR80+b+Y0ts4pS4Xel/kbnvxmwN3JxqaKt2/BGJOmXVp4exC aERiU64QKhuknpoh0N/DAz89Bs5n64Xr6b8M7bhwHM45n5BXa7qWOJPMSu50I7UC1n+6 KZBiXL6NVYD9kbONWE5mI/zzO46HtEkiTBpsfBWomcSdFlIWB6t+yW2AvYf08URDmpaz QwdfgiY1LI3HjYHwEXwCCnGb6i/R/OIOdGo+HLwFU2OPiBXDv1CAKRcCUlqFeI1d8+7Q QTKsE7DTVZSSO8qCczufa1mkLUcdIG5VgTuuXcuLxnUHRDmvWpgcXpkftCMtSThs7wcz ueeQ== X-Gm-Message-State: ALoCoQldkWjsVJNaVGILWp/ZwluGfcrqx4tjdrmeC3+jtQfOcqijnYCDFQYXkl9H/yjLm5fARpcu X-Received: by 10.194.173.3 with SMTP id bg3mr777258wjc.5.1437557923512; Wed, 22 Jul 2015 02:38:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.111 with SMTP id q15ls57926laa.99.gmail; Wed, 22 Jul 2015 02:38:43 -0700 (PDT) X-Received: by 10.112.224.4 with SMTP id qy4mr1503506lbc.20.1437557922994; Wed, 22 Jul 2015 02:38:42 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id z9si744593lba.29.2015.07.22.02.38.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Jul 2015 02:38:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by lahh5 with SMTP id h5so134442983lah.2 for ; Wed, 22 Jul 2015 02:38:42 -0700 (PDT) X-Received: by 10.152.4.163 with SMTP id l3mr1484766lal.35.1437557922834; Wed, 22 Jul 2015 02:38:42 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp1985522lba; Wed, 22 Jul 2015 02:38:41 -0700 (PDT) X-Received: by 10.66.62.163 with SMTP id z3mr4107073par.12.1437557920980; Wed, 22 Jul 2015 02:38:40 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id el7si2463823pdb.190.2015.07.22.02.38.39; Wed, 22 Jul 2015 02:38:40 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933889AbbGVJih (ORCPT + 28 others); Wed, 22 Jul 2015 05:38:37 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:32809 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933017AbbGVJif (ORCPT ); Wed, 22 Jul 2015 05:38:35 -0400 Received: by padck2 with SMTP id ck2so135305385pad.0 for ; Wed, 22 Jul 2015 02:38:35 -0700 (PDT) X-Received: by 10.66.251.202 with SMTP id zm10mr821003pac.87.1437557915221; Wed, 22 Jul 2015 02:38:35 -0700 (PDT) Received: from localhost.localdomain ([202.62.77.106]) by smtp.gmail.com with ESMTPSA id zj15sm2225019pab.1.2015.07.22.02.38.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Jul 2015 02:38:34 -0700 (PDT) From: Vaibhav Hiremath To: linux-arm-kernel@lists.infradead.org Cc: Vaibhav Hiremath , Sangbeom Kim , Krzysztof Kozlowski , Michael Turquette , Stephen Boyd , linux-kernel@vger.kernel.org (open list:SAMSUNG MULTIFUNCTION PMIC DEVICE DRIVERS), linux-samsung-soc@vger.kernel.org (open list:SAMSUNG MULTIFUNCTION PMIC DEVICE DRIVERS), linux-clk@vger.kernel.org (open list:COMMON CLK FRAMEWORK) Subject: [PATCH] clk: s2mps11: Use kcalloc instead of kzalloc for array allocation Date: Wed, 22 Jul 2015 15:04:53 +0530 Message-Id: <1437557693-29433-1-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: vaibhav.hiremath@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch cleans up the driver for, - Use devm_kcalloc varient instead of devm_kzalloc for array allocation. - clk_prepare/unprepare, remove "ret" variable as it is not required - use __exit for cleanup function As I am referring this driver as a reference for my 88pm800 clk driver, applying same changes here as well. Signed-off-by: Vaibhav Hiremath --- Since I do not have platform to test, it would be helpful if someone tests it for me. I have build tested it. drivers/clk/clk-s2mps11.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c index 9b13a30..e17c66a 100644 --- a/drivers/clk/clk-s2mps11.c +++ b/drivers/clk/clk-s2mps11.c @@ -58,21 +58,17 @@ static struct s2mps11_clk *to_s2mps11_clk(struct clk_hw *hw) static int s2mps11_clk_prepare(struct clk_hw *hw) { struct s2mps11_clk *s2mps11 = to_s2mps11_clk(hw); - int ret; - ret = regmap_update_bits(s2mps11->iodev->regmap_pmic, + return regmap_update_bits(s2mps11->iodev->regmap_pmic, s2mps11->reg, s2mps11->mask, s2mps11->mask); - - return ret; } static void s2mps11_clk_unprepare(struct clk_hw *hw) { struct s2mps11_clk *s2mps11 = to_s2mps11_clk(hw); - int ret; - ret = regmap_update_bits(s2mps11->iodev->regmap_pmic, s2mps11->reg, + regmap_update_bits(s2mps11->iodev->regmap_pmic, s2mps11->reg, s2mps11->mask, ~s2mps11->mask); } @@ -186,15 +182,15 @@ static int s2mps11_clk_probe(struct platform_device *pdev) struct clk_init_data *clks_init; int i, ret = 0; - s2mps11_clks = devm_kzalloc(&pdev->dev, sizeof(*s2mps11_clk) * - S2MPS11_CLKS_NUM, GFP_KERNEL); + s2mps11_clks = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM, + sizeof(*s2mps11_clk), GFP_KERNEL); if (!s2mps11_clks) return -ENOMEM; s2mps11_clk = s2mps11_clks; - clk_table = devm_kzalloc(&pdev->dev, sizeof(struct clk *) * - S2MPS11_CLKS_NUM, GFP_KERNEL); + clk_table = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM, + sizeof(struct clk *), GFP_KERNEL); if (!clk_table) return -ENOMEM; @@ -322,7 +318,7 @@ static int __init s2mps11_clk_init(void) } subsys_initcall(s2mps11_clk_init); -static void __init s2mps11_clk_cleanup(void) +static void __exit s2mps11_clk_cleanup(void) { platform_driver_unregister(&s2mps11_clk_driver); }