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: 6841561 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B3C6C9F358 for ; Wed, 22 Jul 2015 09:40:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E1DB220729 for ; Wed, 22 Jul 2015 09:40:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0634B20727 for ; Wed, 22 Jul 2015 09:40:54 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZHqUO-00062x-9E; Wed, 22 Jul 2015 09:39:00 +0000 Received: from mail-pd0-f177.google.com ([209.85.192.177]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZHqUK-0005uS-Io for linux-arm-kernel@lists.infradead.org; Wed, 22 Jul 2015 09:38:57 +0000 Received: by pdjr16 with SMTP id r16so138536167pdj.3 for ; Wed, 22 Jul 2015 02:38:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=UpWJ1ICKASh15xVQ+vsuFJ8B1iWBWmDSODDyYyOPECw=; b=JqeIAcgr6MUmibVpIPkP5HvBiQQi3WD6twD3UCygQo3eoeCmXd387cQ+zcGDfPuZGE 7vVT9u4jkdCFUMcJccBsVE00Wwm3az4qejYu84edRZcYzV2yqq3diDtUzVOx7HvrZjuq 0Q5fhI0Xu0lF1ZgmfsjuH8iiz6024nAZ+LOCSC0opRRD1e/7s66Tt19IQqHb7yFN6wgv d+hw0zzPN+oGffIOA0TJGGjVoHWsrzXE+q5bidnfP84ml4NHsqVpBsNEfDjAGpSRGFiy 3dYzVGdHfWlQuhSd0mvOn4lHL4qyLxue8d/KWNYC7d8O1tLxTcHg3yq8sjNl1jbtirXm fZig== X-Gm-Message-State: ALoCoQk/tO4cyAPnJOXR/WMC9/BUHeMCUhgFGW/8qrczDqSeS++D/cSjDCeEpyZ6VRF0uxSEkpZQ 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150722_023856_646919_363E6025 X-CRM114-Status: GOOD ( 16.37 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Krzysztof Kozlowski , "open list:SAMSUNG MULTIFUNCTION PMIC DEVICE DRIVERS" , Sangbeom Kim , Michael Turquette , Stephen Boyd , Vaibhav Hiremath , "open list:SAMSUNG MULTIFUNCTION PMIC DEVICE DRIVERS" , "open list:COMMON CLK FRAMEWORK" MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Tested-by: Anand Moon Reviewed-by: Krzysztof Kozlowski --- 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); }