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: 8431151 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 10C23C0554 for ; Fri, 26 Feb 2016 03:46:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 55DA3202EB for ; Fri, 26 Feb 2016 03:46:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 83E8F20392 for ; Fri, 26 Feb 2016 03:46:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932286AbcBZDqR (ORCPT ); Thu, 25 Feb 2016 22:46:17 -0500 Received: from mail-pf0-f179.google.com ([209.85.192.179]:34037 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932205AbcBZDqN (ORCPT ); Thu, 25 Feb 2016 22:46:13 -0500 Received: by mail-pf0-f179.google.com with SMTP id x65so44420151pfb.1 for ; Thu, 25 Feb 2016 19:46:08 -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=eRkYuER2p15VGlwLLoBbztmFUCRlUghPBErzK1oVbWo6ATNyRdwJf+uoEsuWrkk2t+ RwQpvwPqX7wx51DW5CX5ZqeWJJnfunhYgy0NTqAPD4a8wMj1QFptJv/41/kE+gabydwF 6o411DtjnRhleX9RKYLz3VHeXUeBjKUJM2HAfNZj9fkZFdAxAhLoPW2kcsDY9O7Sd0Fj 6cpaHxcEWBABypr7mz5aOJs7XxrUcsR33N/k+NYUp14A9SHmLjG4JTOnIrOLydf3i7hx cFhVhtDHNwefqFVbH59Hv67V6fLmpylQVXiiYSpuHApLXKcloTvhRijbbHPp4tmLBOPZ ZRZQ== X-Gm-Message-State: AG10YOQHGZJqkP2FhQOmlO+pD4mllLQcuAvhqKg+Qnc2SfXFUA2d3E4suePUqyiTALnBJisF 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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; }