From patchwork Mon Apr 6 16:50:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atsushi Nemoto X-Patchwork-Id: 25644 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from wa-out-1516.google.com (wa-out-1516.google.com [209.85.146.166]) by ozlabs.org (Postfix) with ESMTP id 30371DDEE9 for ; Tue, 7 Apr 2009 02:50:34 +1000 (EST) Received: by wa-out-1516.google.com with SMTP id c2so1812700waa.1 for ; Mon, 06 Apr 2009 09:50:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:received:x-sender:x-apparently-to :received:received:received-spf:authentication-results:received:from :to:cc:subject:date:message-id:x-mailer:reply-to:sender:precedence :x-google-loop:mailing-list:list-id:list-post:list-help :list-unsubscribe:x-beenthere-env:x-beenthere; bh=M/MJHgqSq0A0GAUwbWpR7t2LvJPZnH3iBOjPvot9QmE=; b=IJpsaiHcxq10uPjVZNGUt/DsLr+5JtP6Bj6W53SFErjRhmj76EDAd9kkwS1SRyqc1B pV1GI1Q4eOA9kn/ARfC8VQePsRIu7y15d6YGD9Vus3B4c4v6NK/aHVmy8/z8tNpJQBM0 8nQWZURu8znJSi2ghMdmSw+j5fDoyWOOjzCYo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-sender:x-apparently-to:received-spf:authentication-results:from :to:cc:subject:date:message-id:x-mailer:reply-to:sender:precedence :x-google-loop:mailing-list:list-id:list-post:list-help :list-unsubscribe:x-beenthere-env:x-beenthere; b=HiFLJQlmc2Wc0EXqrKl64zJbqMr9A6tmwMjfrXthrveXhW5G0v1pUtIYismgVEZSMN e/ofeQsfdd57lrCbcaZZQI78MEYDBfl64rG4U9oMoioxV9HSdz71MZPOE4004bIIo6i2 iu9Ip8N1VkEFQ/P5iGclRH2wAkQPLy7qHw2vs= Received: by 10.140.199.16 with SMTP id w16mr462760rvf.23.1239036629473; Mon, 06 Apr 2009 09:50:29 -0700 (PDT) Received: by 10.107.5.24 with SMTP id h24gr2088pri.0; Mon, 06 Apr 2009 09:50:29 -0700 (PDT) X-Sender: anemo@mba.ocn.ne.jp X-Apparently-To: rtc-linux@googlegroups.com Received: by 10.114.77.1 with SMTP id z1mr841618waa.15.1239036628996; Mon, 06 Apr 2009 09:50:28 -0700 (PDT) Received: from smtp.mba.ocn.ne.jp (mba.ocn.ne.jp [122.1.235.107]) by gmr-mx.google.com with ESMTP id k19si2447131waf.5.2009.04.06.09.50.28; Mon, 06 Apr 2009 09:50:28 -0700 (PDT) Received-SPF: pass (google.com: domain of anemo@mba.ocn.ne.jp designates 122.1.235.107 as permitted sender) client-ip=122.1.235.107; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of anemo@mba.ocn.ne.jp designates 122.1.235.107 as permitted sender) smtp.mail=anemo@mba.ocn.ne.jp Received: from localhost.localdomain (p7250-ipad207funabasi.chiba.ocn.ne.jp [222.145.89.250]) by smtp.mba.ocn.ne.jp (Postfix) with ESMTP id 49856A462; Tue, 7 Apr 2009 01:50:27 +0900 (JST) From: Atsushi Nemoto To: Alessandro Zummo Cc: rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org Subject: [rtc-linux] [PATCH] rtc: Make rtc_update_irq callable with irqs enabled Date: Tue, 7 Apr 2009 01:50:31 +0900 Message-Id: <1239036633-10032-1-git-send-email-anemo@mba.ocn.ne.jp> X-Mailer: git-send-email 1.5.6.3 Reply-To: rtc-linux@googlegroups.com Sender: rtc-linux@googlegroups.com Precedence: bulk X-Google-Loop: groups Mailing-List: list rtc-linux@googlegroups.com; contact rtc-linux+owner@googlegroups.com List-Id: List-Post: List-Help: List-Unsubscribe: , X-BeenThere-Env: rtc-linux@googlegroups.com X-BeenThere: rtc-linux@googlegroups.com The rtc_update_irq() might be called with irqs enabled, if a interrupt handler was registered without IRQF_DISABLED. Use spin_lock_irqsave/spin_unlock_irqrestore instead of spin_lock/spin_unlock. Signed-off-by: Atsushi Nemoto --- drivers/rtc/interface.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 4348c4b..a8641f7 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -376,14 +376,16 @@ EXPORT_SYMBOL_GPL(rtc_update_irq_enable); void rtc_update_irq(struct rtc_device *rtc, unsigned long num, unsigned long events) { - spin_lock(&rtc->irq_lock); + unsigned long flags; + + spin_lock_irqsave(&rtc->irq_lock, flags); rtc->irq_data = (rtc->irq_data + (num << 8)) | events; - spin_unlock(&rtc->irq_lock); + spin_unlock_irqrestore(&rtc->irq_lock, flags); - spin_lock(&rtc->irq_task_lock); + spin_lock_irqsave(&rtc->irq_task_lock, flags); if (rtc->irq_task) rtc->irq_task->func(rtc->irq_task->private_data); - spin_unlock(&rtc->irq_task_lock); + spin_unlock_irqrestore(&rtc->irq_task_lock, flags); wake_up_interruptible(&rtc->irq_queue); kill_fasync(&rtc->async_queue, SIGIO, POLL_IN);