From patchwork Sat Dec 7 17:13:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 298702 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7A0D12C00CD for ; Sun, 8 Dec 2013 04:18:58 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755115Ab3LGRS5 (ORCPT ); Sat, 7 Dec 2013 12:18:57 -0500 Received: from smtp-out-165.synserver.de ([212.40.185.165]:1032 "EHLO smtp-out-151.synserver.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753464Ab3LGRS5 (ORCPT ); Sat, 7 Dec 2013 12:18:57 -0500 X-Greylist: delayed 399 seconds by postgrey-1.27 at vger.kernel.org; Sat, 07 Dec 2013 12:18:56 EST Received: (qmail 3464 invoked by uid 0); 7 Dec 2013 17:12:14 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@laprican.de X-SynServer-PPID: 3230 Received: from ppp-83-171-154-177.dynamic.mnet-online.de (HELO lars-laptop.fritz.box) [83.171.154.177] by 217.119.54.81 with SMTP; 7 Dec 2013 17:12:14 -0000 From: Lars-Peter Clausen To: Thierry Reding Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH resend 2/2] pwm: jz4740: Use devm_clk_get() Date: Sat, 7 Dec 2013 18:13:16 +0100 Message-Id: <1386436396-2307-2-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386436396-2307-1-git-send-email-lars@metafoo.de> References: <1386436396-2307-1-git-send-email-lars@metafoo.de> Sender: linux-pwm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pwm@vger.kernel.org Using the managed version of clk_get() makes the code a bit shorter and the error paths less complicated. Signed-off-by: Lars-Peter Clausen --- drivers/pwm/pwm-jz4740.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c index a44d890..9c46209 100644 --- a/drivers/pwm/pwm-jz4740.c +++ b/drivers/pwm/pwm-jz4740.c @@ -165,13 +165,12 @@ static const struct pwm_ops jz4740_pwm_ops = { static int jz4740_pwm_probe(struct platform_device *pdev) { struct jz4740_pwm_chip *jz4740; - int ret; jz4740 = devm_kzalloc(&pdev->dev, sizeof(*jz4740), GFP_KERNEL); if (!jz4740) return -ENOMEM; - jz4740->clk = clk_get(&pdev->dev, "ext"); + jz4740->clk = devm_clk_get(&pdev->dev, "ext"); if (IS_ERR(jz4740->clk)) return PTR_ERR(jz4740->clk); @@ -180,29 +179,16 @@ static int jz4740_pwm_probe(struct platform_device *pdev) jz4740->chip.npwm = NUM_PWM; jz4740->chip.base = -1; - ret = pwmchip_add(&jz4740->chip); - if (ret < 0) { - clk_put(jz4740->clk); - return ret; - } - platform_set_drvdata(pdev, jz4740); - return 0; + return pwmchip_add(&jz4740->chip); } static int jz4740_pwm_remove(struct platform_device *pdev) { struct jz4740_pwm_chip *jz4740 = platform_get_drvdata(pdev); - int ret; - - ret = pwmchip_remove(&jz4740->chip); - if (ret < 0) - return ret; - clk_put(jz4740->clk); - - return 0; + return pwmchip_remove(&jz4740->chip); } static struct platform_driver jz4740_pwm_driver = {