From patchwork Tue Nov 8 10:14:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jhbird.choi@samsung.com X-Patchwork-Id: 124315 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-bw0-f56.google.com (mail-bw0-f56.google.com [209.85.214.56]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id B83F4B6F98 for ; Tue, 8 Nov 2011 21:35:46 +1100 (EST) Received: by bkbzu17 with SMTP id zu17sf228468bkb.11 for ; Tue, 08 Nov 2011 02:35:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=mime-version:x-beenthere:received-spf:from:to:cc:subject:date :message-id:x-mailer:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=z5piG7E90NJeC9z0zFfR85+rXJIqNA2Lmg4u7/gKlfc=; b=3/t4ZrWv/eCaMzqDUFzjGkMM7tkPXviuzdUrVu22wsCmHKNqngBOlq0q/JA9TIEFas +P+nAH+d+0Fk1bOC9fyClLZnIXiE0I2wzh6vXUC8Dt1WhkabAdhICPNhtdw68A0OX7Oc unsEZV/8luSKGO8C6D4fVydt2j2Wkyev6xmME= Received: by 10.204.18.198 with SMTP id x6mr2230919bka.16.1320748536135; Tue, 08 Nov 2011 02:35:36 -0800 (PST) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.204.33.136 with SMTP id h8ls15225225bkd.0.gmail; Tue, 08 Nov 2011 02:35:35 -0800 (PST) Received: by 10.204.143.143 with SMTP id v15mr1572918bku.1.1320748535159; Tue, 08 Nov 2011 02:35:35 -0800 (PST) Received: by 10.204.143.143 with SMTP id v15mr1572917bku.1.1320748535143; Tue, 08 Nov 2011 02:35:35 -0800 (PST) Received: from ganesha.gnumonks.org (ganesha.gnumonks.org. [213.95.27.120]) by gmr-mx.google.com with ESMTPS id h3si695551fao.3.2011.11.08.02.35.34 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Nov 2011 02:35:34 -0800 (PST) Received-SPF: neutral (google.com: 213.95.27.120 is neither permitted nor denied by best guess record for domain of jhbird.choi@samsung.com) client-ip=213.95.27.120; Received: from uucp by ganesha.gnumonks.org with local-bsmtp (Exim 4.72) (envelope-from ) id 1RNj1e-0005vV-R3; Tue, 08 Nov 2011 11:35:31 +0100 Received: from [12.23.118.173] (helo=sunrise.dsn.sec.samsung.com) by jackpot.kr.gnumonks.org with esmtp (Exim 4.69) (envelope-from ) id 1RNhe1-00047X-Jz; Tue, 08 Nov 2011 18:07:01 +0900 From: jhbird.choi@samsung.com To: rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org Cc: Alessandro Zummo , Kukjin Kim , Jonghwan Choi Subject: [rtc-linux] [PATCH] driver/rtc/rtc-s3c: Fix driver clock enable/disable balance issues Date: Tue, 8 Nov 2011 19:14:13 +0900 Message-Id: <1320747253-9281-1-git-send-email-jhbird.choi@samsung.com> X-Mailer: git-send-email 1.7.1 X-Original-Sender: jhbird.choi@samsung.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 213.95.27.120 is neither permitted nor denied by best guess record for domain of jhbird.choi@samsung.com) smtp.mail=jhbird.choi@samsung.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , From: Jonghwan Choi If an error occurs after clock is enabled, it can become unbalanced. Signed-off-by: Jonghwan Choi Acked-by: Kukjin Kim --- drivers/rtc/rtc-s3c.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 7639ab9..5b979d9 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -202,7 +202,6 @@ static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm) void __iomem *base = s3c_rtc_base; int year = tm->tm_year - 100; - clk_enable(rtc_clk); pr_debug("set time %04d.%02d.%02d %02d:%02d:%02d\n", 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); @@ -214,6 +213,7 @@ static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm) return -EINVAL; } + clk_enable(rtc_clk); writeb(bin2bcd(tm->tm_sec), base + S3C2410_RTCSEC); writeb(bin2bcd(tm->tm_min), base + S3C2410_RTCMIN); writeb(bin2bcd(tm->tm_hour), base + S3C2410_RTCHOUR);