From patchwork Thu Aug 2 06:59:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingoo Han X-Patchwork-Id: 1266601 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id B35833FC71 for ; Thu, 2 Aug 2012 06:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752899Ab2HBG7H (ORCPT ); Thu, 2 Aug 2012 02:59:07 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:51992 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751662Ab2HBG7H (ORCPT ); Thu, 2 Aug 2012 02:59:07 -0400 Received: from epcpsbgm1.samsung.com (mailout1.samsung.com [203.254.224.24]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M8400BKL8PGSDG0@mailout1.samsung.com> for linux-fbdev@vger.kernel.org; Thu, 02 Aug 2012 15:59:05 +0900 (KST) X-AuditID: cbfee61a-b7f616d000004b7e-2a-501a2539b33a Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 61.64.19326.9352A105; Thu, 02 Aug 2012 15:59:05 +0900 (KST) Received: from DOJG1HAN02 ([12.23.119.56]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M8400F478QH2T60@mmp2.samsung.com> for linux-fbdev@vger.kernel.org; Thu, 02 Aug 2012 15:59:05 +0900 (KST) From: Jingoo Han To: 'Florian Tobias Schandinat' Cc: linux-fbdev@vger.kernel.org, 'Jingoo Han' Subject: [PATCH] video: s3c-fb: use devm_clk_get() Date: Thu, 02 Aug 2012 15:59:05 +0900 Message-id: <000101cd707c$4e574450$eb05ccf0$%han@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac1wfE4vTOYB3uBdRR2EChiNhabSPQ== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCLMWRmVeSWpSXmKPExsVy+t9jQV1LVakAg/WPDS1O9H1gdWD0+LxJ LoAxissmJTUnsyy1SN8ugSvj/rtexoLfghWnd+xmb2B8yNfFyMkhIWAiMe/PbEYIW0ziwr31 bF2MXBxCAtMZJSb+e8YK4cxiktj7aDITSBWbgJrEly+H2bsYOThEBKwkNm3VBAkzCzhLTLhx gg3EFhYwkpg84QcLiM0ioCpx//g7sFZeAVuJBxvnsELYghI/Jt9jgejVkli/8zgThC0vsXnN W2aQ8RIC6hKP/uqChEUE9CQ+N8+AKhGR2PfiHeMERoFZSCbNQjJpFpJJs5C0LGBkWcUomlqQ XFCclJ5rqFecmFtcmpeul5yfu4kRHJbPpHYwrmywOMQowMGoxMO7slQyQIg1say4MvcQowQH s5II7x0JqQAh3pTEyqrUovz4otKc1OJDjNIcLErivMbeX/2FBNITS1KzU1MLUotgskwcnFIN jDv61C8+VDHQNrv5LuxKy2aeqUmTrfe72PtcjGycWZolJZ7844XXbFOG86duzm87HMIlNqe7 +frHvydW/CtedqC20fuJkeRSvUlrwkQnzZpxTSzs3w339XO9rtdzz153MbLlZMI9hga+3YtD N33w0Y/5ICp56vP5q4HfDps05O+/s326VXnT6UtKLMUZiYZazEXFiQD8nhIeRwIAAA== X-TM-AS-MML: No Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org The devm_ functions allocate memory that is released when a driver detaches. This patch uses devm_clk_get() for these functions. Signed-off-by: Jingoo Han --- drivers/video/s3c-fb.c | 24 +++++------------------- 1 files changed, 5 insertions(+), 19 deletions(-) diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c index 69bf9d0..6c95126 100644 --- a/drivers/video/s3c-fb.c +++ b/drivers/video/s3c-fb.c @@ -1398,17 +1398,16 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev) spin_lock_init(&sfb->slock); - sfb->bus_clk = clk_get(dev, "lcd"); + sfb->bus_clk = devm_clk_get(dev, "lcd"); if (IS_ERR(sfb->bus_clk)) { dev_err(dev, "failed to get bus clock\n"); - ret = PTR_ERR(sfb->bus_clk); - goto err_sfb; + return PTR_ERR(sfb->bus_clk); } clk_enable(sfb->bus_clk); if (!sfb->variant.has_clksel) { - sfb->lcd_clk = clk_get(dev, "sclk_fimd"); + sfb->lcd_clk = devm_clk_get(dev, "sclk_fimd"); if (IS_ERR(sfb->lcd_clk)) { dev_err(dev, "failed to get lcd clock\n"); ret = PTR_ERR(sfb->lcd_clk); @@ -1421,12 +1420,6 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev) pm_runtime_enable(sfb->dev); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev, "failed to find registers\n"); - ret = -ENOENT; - goto err_lcd_clk; - } - sfb->regs = devm_request_and_ioremap(dev, res); if (!sfb->regs) { dev_err(dev, "failed to map registers\n"); @@ -1510,16 +1503,12 @@ err_pm_runtime: err_lcd_clk: pm_runtime_disable(sfb->dev); - if (!sfb->variant.has_clksel) { + if (!sfb->variant.has_clksel) clk_disable(sfb->lcd_clk); - clk_put(sfb->lcd_clk); - } err_bus_clk: clk_disable(sfb->bus_clk); - clk_put(sfb->bus_clk); -err_sfb: return ret; } @@ -1541,13 +1530,10 @@ static int __devexit s3c_fb_remove(struct platform_device *pdev) if (sfb->windows[win]) s3c_fb_release_win(sfb, sfb->windows[win]); - if (!sfb->variant.has_clksel) { + if (!sfb->variant.has_clksel) clk_disable(sfb->lcd_clk); - clk_put(sfb->lcd_clk); - } clk_disable(sfb->bus_clk); - clk_put(sfb->bus_clk); pm_runtime_put_sync(sfb->dev); pm_runtime_disable(sfb->dev);