From patchwork Fri Feb 26 03:43:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 62921 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp502569lbc; Thu, 25 Feb 2016 19:46:19 -0800 (PST) X-Received: by 10.67.6.226 with SMTP id cx2mr67990319pad.93.1456458378710; Thu, 25 Feb 2016 19:46:18 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id va5si16769887pac.165.2016.02.25.19.46.18; Thu, 25 Feb 2016 19:46:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932273AbcBZDqG (ORCPT + 30 others); Thu, 25 Feb 2016 22:46:06 -0500 Received: from mail-pf0-f170.google.com ([209.85.192.170]:32972 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932205AbcBZDqD (ORCPT ); Thu, 25 Feb 2016 22:46:03 -0500 Received: by mail-pf0-f170.google.com with SMTP id q63so44347028pfb.0 for ; Thu, 25 Feb 2016 19:46:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wgGVXteSHG5R6ebIUp0Lo9B9c+ZEqngvcYtBVmMQ2dk=; b=HunvgGiPkKKp807AMlwEE6C09LcpJlCdwjd+C8KAw+P6471ALUlEJx7ZQwHBEFlfoL ErEMeLaufRQJXJzkfcjO+E5JHIfrGrUjhzZcXI7G8riI+0sS8yV8YHDyOoSZ2SSgp9cJ qh/M0Qa3eYwDQE/Ms9v5MDrlHRjlm2gbaeO1k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wgGVXteSHG5R6ebIUp0Lo9B9c+ZEqngvcYtBVmMQ2dk=; b=SiX76iie63kWv7tWkFsEfEYK+yrvU9hCI2T7mHtXl8Ca+bVGxUctlaAv53efiOc3IO LW0N671p2IGTbfj6vz7U16C2wrVH51SFHELRNTe7nqcqPkM6MmU+YXPaxj2ZW0hdIJV9 Tl+UEiDHkNgcWcEbRmubzbJco8IW7f076tNYX/7a8epHUMkhy+wtqyPQorXmsLjZgAef OG7mwOLzRKL4ehO+xTExa5FVtEdaL3hwFKRtVp2Bl5hhEo3k7M46ibGtG5Wk9mOGtuV5 WEpSaDk3ShqVfmRbBDj6zUSMmDP11mKgMxIsnOrlsMcIm8m723jcdmhcwKBGfXeXqiwy MSVg== X-Gm-Message-State: AG10YOTfL/MxsGosFBhoLpxHqnQoMXzc/v4RxuWeBgwAn4oFnrCJHO8n0PtERdvWLfLETWHJ X-Received: by 10.98.89.139 with SMTP id k11mr19936021pfj.56.1456458362652; Thu, 25 Feb 2016 19:46:02 -0800 (PST) Received: from leoy-linaro.a1.60in.com (li401-178.members.linode.com. [106.187.51.178]) by smtp.gmail.com with ESMTPSA id fn3sm15295884pab.20.2016.02.25.19.45.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 Feb 2016 19:46:01 -0800 (PST) From: Leo Yan To: Wei Xu , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Catalin Marinas , Will Deacon , Zhang Rui , Eduardo Valentin , kongxinwei , Javi Merino , Punit Agrawal Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Leo Yan Subject: [PATCH v2 3/5] thermal: hisilicon: fix IRQ imbalance enabling Date: Fri, 26 Feb 2016 11:43:45 +0800 Message-Id: <1456458227-12950-4-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456458227-12950-1-git-send-email-leo.yan@linaro.org> References: <1456458227-12950-1-git-send-email-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When register sensors into thermal zone during initialization phase, it reports error for IRQ imbalance enabling: [ 2.040713] WARNING: at kernel/irq/manage.c:513 [ 2.040719] Modules linked in: [ 2.040721] [ 2.040729] CPU: 1 PID: 804 Comm: irq/33-hisi_the Not tainted 4.5.0-rc4+ #505 [ 2.040732] Hardware name: HiKey Development Board (DT) [ 2.040736] task: ffffffc03ae82580 ti: ffffffc0379c8000 task.ti: ffffffc0379c8000 [ 2.040745] PC is at __enable_irq+0x74/0x84 [ 2.040749] LR is at __enable_irq+0x74/0x84 This warning is for IRQ imbalance enabling, which is caused by enable_irq() twice. During sensor's initialization it tries to enable IRQ, the driver will call thermal_zone_of_sensor_register() to bind sensors and read sensor's temperature. But at this moment the flag "data->irq_enabled" has been not initialized as correct state, so it finally introduces the function enabled_irq() to be called twice. In essentially this is caused by the flag "data->irq_enabled" is inconsistent with real hardware IRQ enabling state. So this patch is to fix this issue, firstly init "irq_enabled" flag before binding sensors to thermal zone. Also change to use the function irq_get_irqchip_state() to read back real interrupt line state. Signed-off-by: Leo Yan --- drivers/thermal/hisi_thermal.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 1.9.1 diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 7a3e5d8..982ffd1 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -343,6 +343,10 @@ static int hisi_thermal_probe(struct platform_device *pdev) return ret; } + hisi_thermal_enable_bind_irq_sensor(data); + irq_get_irqchip_state(data->irq, IRQCHIP_STATE_MASKED, + &data->irq_enabled); + for (i = 0; i < HISI_MAX_SENSORS; ++i) { ret = hisi_thermal_register_sensor(pdev, data, &data->sensors[i], i); @@ -353,9 +357,6 @@ static int hisi_thermal_probe(struct platform_device *pdev) hisi_thermal_toggle_sensor(&data->sensors[i], true); } - hisi_thermal_enable_bind_irq_sensor(data); - data->irq_enabled = true; - return 0; }