From patchwork Mon Nov 26 04:49:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13192 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id DED5123EFB for ; Mon, 26 Nov 2012 04:55:55 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 93AA2A180E3 for ; Mon, 26 Nov 2012 04:55:55 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so4958363iag.11 for ; Sun, 25 Nov 2012 20:55:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=ZH4cexRtGKQeSYnwVlyJRo0bOwO5y1pUq74bm4sqMNc=; b=Kib+2bxjMp+DMFlsCjgsMjGojUFyFnq3aNaLsmh+uTWVdvNdpCbXHmG+dOwGMQ3JWy tJb1EM5ht9ybhc5mVLY0O2YtWX6ZqtBEKVC+RrLGxeIcibKyXbe1Dt3AtrKrWY1WSmF2 nfSzsBcHbWc0ipg9Pnq9Q5sb9ng3sBaLrU5DFaQlRXYVm5fKvjnJ7nfXbQolsCoYyvoS 4pgH4baAAqFcoZCOLU5gS2NJ5ZqaDrBw36y/tfJ/Jj+n/YlI62pTg2w431/CCsI+SleY iTfdh90ybk8PM9nFdWksNgZ23dNqEoYv9Zk3aflYsc4fjMxkXH0dbsDhqdQrqstAcB/Y +yDg== Received: by 10.50.152.137 with SMTP id uy9mr9690492igb.62.1353905755371; Sun, 25 Nov 2012 20:55:55 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp201162igt; Sun, 25 Nov 2012 20:55:55 -0800 (PST) Received: by 10.68.233.230 with SMTP id tz6mr34111372pbc.36.1353905754811; Sun, 25 Nov 2012 20:55:54 -0800 (PST) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx.google.com with ESMTPS id yk3si17915335pbc.339.2012.11.25.20.55.54 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 25 Nov 2012 20:55:54 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.54 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.220.54; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.54 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by mail-pa0-f54.google.com with SMTP id bi5so2482053pad.27 for ; Sun, 25 Nov 2012 20:55:54 -0800 (PST) Received: by 10.66.77.201 with SMTP id u9mr29714840paw.6.1353905754589; Sun, 25 Nov 2012 20:55:54 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id g1sm8082844pax.21.2012.11.25.20.55.51 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 25 Nov 2012 20:55:54 -0800 (PST) From: Sachin Kamat To: linux-media@vger.kernel.org Cc: t.stanislaws@samsung.com, s.nawrocki@samsung.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 7/9] [media] s5p-tv: Use devm_clk_get APIs in sdo_drv.c Date: Mon, 26 Nov 2012 10:19:06 +0530 Message-Id: <1353905348-15475-8-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1353905348-15475-1-git-send-email-sachin.kamat@linaro.org> References: <1353905348-15475-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQnNaOadYcq/3ad0IP/wzukka/ZAtvLMy7mz4A+zDUZucCeRrLDqbYrqlINKvQs0JwARh6d3 devm_clk_get() is device managed function and makes error handling and exit code a bit simpler. Signed-off-by: Sachin Kamat --- drivers/media/platform/s5p-tv/sdo_drv.c | 39 +++++++++--------------------- 1 files changed, 12 insertions(+), 27 deletions(-) diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c b/drivers/media/platform/s5p-tv/sdo_drv.c index 91e2de3..9e78adf 100644 --- a/drivers/media/platform/s5p-tv/sdo_drv.c +++ b/drivers/media/platform/s5p-tv/sdo_drv.c @@ -340,36 +340,33 @@ static int __devinit sdo_probe(struct platform_device *pdev) sdev->irq = res->start; /* acquire clocks */ - sdev->sclk_dac = clk_get(dev, "sclk_dac"); + sdev->sclk_dac = devm_clk_get(dev, "sclk_dac"); if (IS_ERR_OR_NULL(sdev->sclk_dac)) { dev_err(dev, "failed to get clock 'sclk_dac'\n"); ret = -ENXIO; goto fail; } - sdev->dac = clk_get(dev, "dac"); + sdev->dac = devm_clk_get(dev, "dac"); if (IS_ERR_OR_NULL(sdev->dac)) { dev_err(dev, "failed to get clock 'dac'\n"); - ret = -ENXIO; - goto fail_sclk_dac; + return -ENXIO; } - sdev->dacphy = clk_get(dev, "dacphy"); + sdev->dacphy = devm_clk_get(dev, "dacphy"); if (IS_ERR_OR_NULL(sdev->dacphy)) { dev_err(dev, "failed to get clock 'dacphy'\n"); - ret = -ENXIO; - goto fail_dac; + return -ENXIO; } - sclk_vpll = clk_get(dev, "sclk_vpll"); + sclk_vpll = devm_clk_get(dev, "sclk_vpll"); if (IS_ERR_OR_NULL(sclk_vpll)) { dev_err(dev, "failed to get clock 'sclk_vpll'\n"); - ret = -ENXIO; - goto fail_dacphy; + return -ENXIO; } clk_set_parent(sdev->sclk_dac, sclk_vpll); - clk_put(sclk_vpll); - sdev->fout_vpll = clk_get(dev, "fout_vpll"); + devm_clk_put(dev, sclk_vpll); + sdev->fout_vpll = devm_clk_get(dev, "fout_vpll"); if (IS_ERR_OR_NULL(sdev->fout_vpll)) { dev_err(dev, "failed to get clock 'fout_vpll'\n"); - goto fail_dacphy; + return -ENXIO; } dev_info(dev, "fout_vpll.rate = %lu\n", clk_get_rate(sclk_vpll)); @@ -377,12 +374,12 @@ static int __devinit sdo_probe(struct platform_device *pdev) sdev->vdac = devm_regulator_get(dev, "vdd33a_dac"); if (IS_ERR_OR_NULL(sdev->vdac)) { dev_err(dev, "failed to get regulator 'vdac'\n"); - goto fail_fout_vpll; + goto fail; } sdev->vdet = devm_regulator_get(dev, "vdet"); if (IS_ERR_OR_NULL(sdev->vdet)) { dev_err(dev, "failed to get regulator 'vdet'\n"); - goto fail_fout_vpll; + goto fail; } /* enable gate for dac clock, because mixer uses it */ @@ -406,14 +403,6 @@ static int __devinit sdo_probe(struct platform_device *pdev) dev_info(dev, "probe succeeded\n"); return 0; -fail_fout_vpll: - clk_put(sdev->fout_vpll); -fail_dacphy: - clk_put(sdev->dacphy); -fail_dac: - clk_put(sdev->dac); -fail_sclk_dac: - clk_put(sdev->sclk_dac); fail: dev_info(dev, "probe failed\n"); return ret; @@ -426,10 +415,6 @@ static int __devexit sdo_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); clk_disable(sdev->dac); - clk_put(sdev->fout_vpll); - clk_put(sdev->dacphy); - clk_put(sdev->dac); - clk_put(sdev->sclk_dac); dev_info(&pdev->dev, "remove successful\n"); return 0;