From patchwork Tue May 18 09:24:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wan ZongShun X-Patchwork-Id: 52856 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-pw0-f56.google.com (mail-pw0-f56.google.com [209.85.160.56]) by ozlabs.org (Postfix) with ESMTP id 4685AB7D85 for ; Tue, 18 May 2010 19:24:23 +1000 (EST) Received: by pwi9 with SMTP id 9sf1623305pwi.11 for ; Tue, 18 May 2010 02:24:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:x-beenthere:received:received:received :received:received-spf:received:received:received:message-id:date :from:user-agent:mime-version:to:cc:subject:references:in-reply-to :x-original-authentication-results:x-original-sender:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe:content-type; bh=N0NaopzWoYppqdZaIT/QA2DZtiqiOZtng0znCDNb7P0=; b=uHeGCN+NUbEaXCv713QZq90by5WPap0PweKtNX+tyXP6aAIanGXOSJhpNE6Lvq/kBY anwURapw1D6FJIxY5kJ0ckjyBbH0QPPn7hz8Vo4sCYar73d0kIrFT11+3nSOB26vQ1Ku zMNwojYSNrFexQiHvOHaGTiu9dFpvCx/MlqM4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to :x-original-authentication-results:x-original-sender:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe:content-type; b=uf4fH8/hS36iQR92JGzaX3vD9BYfimUrezypvvoIYYCVEqJmbhxrxzE8eyCeXqskQw p2aSSF7WgH5MGcDB5t1MXrPnFm+N9/Ix/9cvTfQYwmYmOwGA5HLk9LB8r0UoZNBzfjch lj0L6WkRGNVWMIZITJAPdKZko+6igiU7nfGQw= Received: by 10.142.250.12 with SMTP id x12mr305546wfh.16.1274174662313; Tue, 18 May 2010 02:24:22 -0700 (PDT) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.142.248.9 with SMTP id v9ls5154425wfh.1.p; Tue, 18 May 2010 02:24:21 -0700 (PDT) Received: by 10.142.202.11 with SMTP id z11mr2211872wff.47.1274174661605; Tue, 18 May 2010 02:24:21 -0700 (PDT) Received: by 10.142.202.11 with SMTP id z11mr2211871wff.47.1274174661585; Tue, 18 May 2010 02:24:21 -0700 (PDT) Received: from mail-px0-f171.google.com (mail-px0-f171.google.com [209.85.212.171]) by gmr-mx.google.com with ESMTP id 25si956389pzk.4.2010.05.18.02.24.20; Tue, 18 May 2010 02:24:20 -0700 (PDT) Received-SPF: pass (google.com: domain of mcuos.com@gmail.com designates 209.85.212.171 as permitted sender) client-ip=209.85.212.171; Received: by pxi8 with SMTP id 8so10439174pxi.2 for ; Tue, 18 May 2010 02:24:20 -0700 (PDT) Received: by 10.114.187.17 with SMTP id k17mr5635608waf.31.1274174658587; Tue, 18 May 2010 02:24:18 -0700 (PDT) Received: from [192.168.1.10] ([116.226.217.177]) by mx.google.com with ESMTPS id v13sm57137970wav.14.2010.05.18.02.24.09 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 18 May 2010 02:24:17 -0700 (PDT) Message-ID: <4BF25CB2.3020801@gmail.com> Date: Tue, 18 May 2010 17:24:02 +0800 From: Wan ZongShun User-Agent: Thunderbird 2.0.0.24 (X11/20100411) MIME-Version: 1.0 To: Wan ZongShun , Alessandro Zummo CC: linux-arm-kernel , rtc-linux Subject: [rtc-linux] Re: [PATCH] NUC900/rtc: change the waiting for device ready implement References: <4BF25990.6070602@gmail.com> In-Reply-To: <4BF25990.6070602@gmail.com> X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of mcuos.com@gmail.com designates 209.85.212.171 as permitted sender) smtp.mail=mcuos.com@gmail.com; dkim=pass (test mode) header.i=@gmail.com X-Original-Sender: mcuos.com@gmail.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , Dear sir, Re-submitting the patch to fix careless bug. Signed-off-by:Wan ZongShun --- drivers/rtc/rtc-nuc900.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/rtc/rtc-nuc900.c b/drivers/rtc/rtc-nuc900.c index a351bd5..21d1330 100644 --- a/drivers/rtc/rtc-nuc900.c +++ b/drivers/rtc/rtc-nuc900.c @@ -85,22 +85,21 @@ static irqreturn_t nuc900_rtc_interrupt(int irq, void *_rtc) static int *check_rtc_access_enable(struct nuc900_rtc *nuc900_rtc) { - unsigned int i; + unsigned int i, timeout = 0x1000; __raw_writel(INIRRESET, nuc900_rtc->rtc_reg + REG_RTC_INIR); mdelay(10); __raw_writel(AERPOWERON, nuc900_rtc->rtc_reg + REG_RTC_AER); - for (i = 0; i < 1000; i++) { - if (__raw_readl(nuc900_rtc->rtc_reg + REG_RTC_AER) & AERRWENB) - return 0; - } + while (!(__raw_readl(nuc900_rtc->rtc_reg + REG_RTC_AER) & AERRWENB) + && timeout--) + mdelay(1); - if ((__raw_readl(nuc900_rtc->rtc_reg + REG_RTC_AER) & AERRWENB) == 0x0) - return ERR_PTR(-ENODEV); + if (!timeout) + return ERR_PTR(-EPERM); - return ERR_PTR(-EPERM); + return 0; } static void nuc900_rtc_bcd2bin(unsigned int timereg,