From patchwork Mon Mar 18 14:59:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 2293141 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 1B4E1DF215 for ; Mon, 18 Mar 2013 15:01:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752492Ab3CRPAu (ORCPT ); Mon, 18 Mar 2013 11:00:50 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:43876 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751890Ab3CRPAt (ORCPT ); Mon, 18 Mar 2013 11:00:49 -0400 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r2IF0gjq015387; Mon, 18 Mar 2013 10:00:42 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2IF0g02014373; Mon, 18 Mar 2013 10:00:42 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.2.342.3; Mon, 18 Mar 2013 10:00:42 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2IF0giB031167; Mon, 18 Mar 2013 10:00:42 -0500 Received: from localhost (h64-4.vpn.ti.com [172.24.64.4]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id r2IF0cV28826; Mon, 18 Mar 2013 10:00:38 -0500 (CDT) From: Eduardo Valentin To: CC: , , , , Eduardo Valentin , Dan Carpenter Subject: [PATCH 2/8] staging: omap-thermal: use spin_lock_irqsave inside IRQ handler Date: Mon, 18 Mar 2013 10:59:10 -0400 Message-ID: <1363618756-15851-3-git-send-email-eduardo.valentin@ti.com> X-Mailer: git-send-email 1.7.7.1.488.ge8e1c In-Reply-To: <1363618756-15851-1-git-send-email-eduardo.valentin@ti.com> References: <1363618756-15851-1-git-send-email-eduardo.valentin@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Even if the IRQ is not firing because it is ONE_SHOT and disable at INTC level, the IRQ handler must use spin_lock_irqsave. It is necessary to disable IRQs from the current CPU while it is holding a spin_lock which is need. Cc: Dan Carpenter Signed-off-by: Eduardo Valentin diff --git a/drivers/staging/omap-thermal/omap-bandgap.c b/drivers/staging/omap-thermal/omap-bandgap.c index cb7aa35..a4ac06c 100644 --- a/drivers/staging/omap-thermal/omap-bandgap.c +++ b/drivers/staging/omap-thermal/omap-bandgap.c @@ -168,9 +168,10 @@ static irqreturn_t omap_bandgap_talert_irq_handler(int irq, void *data) struct omap_bandgap *bg_ptr = data; struct temp_sensor_registers *tsr; u32 t_hot = 0, t_cold = 0, ctrl; + unsigned long flags; int i; - spin_lock(&bg_ptr->lock); + spin_lock_irqsave(&bg_ptr->lock, flags); for (i = 0; i < bg_ptr->conf->sensor_count; i++) { tsr = bg_ptr->conf->sensors[i].registers; ctrl = omap_bandgap_readl(bg_ptr, tsr->bgap_status); @@ -209,7 +210,7 @@ static irqreturn_t omap_bandgap_talert_irq_handler(int irq, void *data) if (bg_ptr->conf->report_temperature) bg_ptr->conf->report_temperature(bg_ptr, i); } - spin_unlock(&bg_ptr->lock); + spin_unlock_irqrestore(&bg_ptr->lock, flags); return IRQ_HANDLED; }