Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1238051ybl; Tue, 3 Dec 2019 04:05:57 -0800 (PST) X-Google-Smtp-Source: APXvYqxMYP+9WPLtGNIT1VXTEr1A3PPLt+UA/fkuwlv7sgH9iYVromi4pSqrZSBF7L4RXZbePX/R X-Received: by 2002:a05:6830:1e75:: with SMTP id m21mr2715823otr.36.1575374757371; Tue, 03 Dec 2019 04:05:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575374757; cv=none; d=google.com; s=arc-20160816; b=py9fRbUcDZd3wY+SRIadEpMxBXC191XKgwkQGVfE8vJYgXAdzkRLShAXrOl9d0/QGs +ktKhoom4gqckFYSqtXwR/Vtx5Mmk17x5snOc5f8PPLH68SYsiOaHIMIcLskE45ujsEh S2JbzhSz9ux3f/wpe3UaTY7Fiem7mcpG/VlOhOp+zM7lDf/1VU+Abpi6aTs3MHixpObs VC1nWyVhjxlKKrHGGcCFvC+GzG+qlgmLZF/w8l1lbRbwXdhH24itYjKfW8rXv5YIaiAN cqnsehj2gGcrI/ygG1qhA3Yo9U5gUHbazCKXRU8dVy6ED6JvcNO8LMjf5AMnZWrvyWfN PcEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=41gz7Pr3bu95rsc2AmP+uk3DRv43sggDSJGl0PUK5A8=; b=IEIgJ8+TbL1KJ6d2mimrUiqXA2+yUJUinAg+RiDE26p9ar9ef4RAbmPflj2NJhi3FF S9MCekxFjG3LFC8BXkI7olvipvkxFDYlL9dSqTQ+pvhFk4WVvfGGNrjNevDjYDEgiajG SHY3j3EHMnnuXvEdRRGlnbMQ8RUoFpIAsf29IZwjJdm7ycaQoZr781L/KYyzpzhuSAiK LC54S1hMzGzyEboHf6lvSZvsrZA6Ssm8dxKtof8TOVwwACjzEr6+ExdwOvgyNOQlyPX0 oU7rumgZtTIr2mf3wjSd3VgJYy6fV6x/w22Kre3dBhGxK1SFVUMSDNPrqyTj28yq1/CM cYXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vbIBHcDr; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x21si1173428oif.250.2019.12.03.04.05.40; Tue, 03 Dec 2019 04:05:57 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vbIBHcDr; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726131AbfLCMEp (ORCPT + 99 others); Tue, 3 Dec 2019 07:04:45 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:38666 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725838AbfLCMEp (ORCPT ); Tue, 3 Dec 2019 07:04:45 -0500 Received: by mail-lf1-f66.google.com with SMTP id r14so2734307lfm.5; Tue, 03 Dec 2019 04:04:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=41gz7Pr3bu95rsc2AmP+uk3DRv43sggDSJGl0PUK5A8=; b=vbIBHcDr/qXhhDiGkKQDs2V+qghI3vJUjWRJZh+QM0n7WjE7nswn5FuYePJCHdHzT2 avY0Mreifj3ivibbFeMUjPiHT+tse5RWRK63vnjmUS+IAjcQYfzm2Xx8LcDAK7FAmJRK +yUPtu9k6n+mzGGTQF8ICWdPsQnKyju/t4JU96PqX2wlaY8qdTg4pn2QAJeK+icv1Lky lfOihAkVdTDKuyvGQSRNZbXxh/DH+GeYqf4cXJLUXlCglkncka1j6IrhzSORGoPely9n b+4NVU8DzzaWt+bB8B1RFgwqtyAi3FMrobRFKfA05P2euNq7kzqUr+nm7yEpv8HcnxE1 NJDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=41gz7Pr3bu95rsc2AmP+uk3DRv43sggDSJGl0PUK5A8=; b=KEZikFOT5XHSrE49BS67wCUC83Nebbl/0p2z7hDnOJ5hz43P2CWxfnWu//cAjzAVMr MpIOe/ksmPWNZdiUrXDHw1AmCVaD+4Pj0Wvu40h9Dg9fu4gXmofK/fh3n4yKn3bMU5aQ lhhIPh0qrLATwHM61SJ8NBfLd0qmb5s88LvT4O83nFcD9KVBBPV9ZJ0ryxYP5CfgtWE6 TohlKrtVXPXgYWMwbrNkwQUmY3K5AFymcAGXXREh4KU33kTmumqUpCq1B8uJ3P1INRG0 Hbjgy3mQRWfiG4Rfg8dUNw1+mIuNSne0idwTNi3O5aDoNvQ8jzgITpIasb3pJCt+Jx7o 8iRw== X-Gm-Message-State: APjAAAVj1gx1fk8fAE3VGQZ6CyD+CeazCt/aUbbXkfnTZ0J7wn1r0YH6 ym88E//GfJurexSNjijlm3C2RKdy1q4GX7IIuZQ= X-Received: by 2002:ac2:4119:: with SMTP id b25mr2532251lfi.90.1575374683194; Tue, 03 Dec 2019 04:04:43 -0800 (PST) MIME-Version: 1.0 References: <08794fde-cdd0-287c-62bf-e2e3b8c80686@gmail.com> <20191203101509.wte47aad5k4mqu2y@pengutronix.de> In-Reply-To: <20191203101509.wte47aad5k4mqu2y@pengutronix.de> From: Fabio Estevam Date: Tue, 3 Dec 2019 09:04:58 -0300 Message-ID: Subject: Re: Issue with imx_get_temp() To: Marco Felsch Cc: Igor Plyatov , Zhang Rui , Eduardo Valentin , Daniel Lezcano , Amit Kucheria , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , NXP Linux Team , linux-pm@vger.kernel.org, "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marco, On Tue, Dec 3, 2019 at 7:15 AM Marco Felsch wrote: > Mh.. it seems that the irq gets enabled before a irq-handler is > registered. As your backlog shows the thermal_zone_device_register() > triggers a imx_get_temp() and during boot the irq_enabled is false and > it seems that your temperature is below the alarm_temp. So in such a > case the enable_irq() is executed. I don't know what happens if we > enable a irq without a irq-handler. I think your analysis makes sense. Should we move the ' data->irq_enabled = true' just prior to calling thermal_zone_device_register()? --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -803,6 +803,7 @@ static int imx_thermal_probe(struct platform_device *pdev) goto legacy_cleanup; } + data->irq_enabled = true; data->tz = thermal_zone_device_register("imx_thermal_zone", IMX_TRIP_NUM, BIT(IMX_TRIP_PASSIVE), data, @@ -837,7 +838,6 @@ static int imx_thermal_probe(struct platform_device *pdev) regmap_write(map, data->socdata->sensor_ctrl + REG_SET, data->socdata->measure_temp_mask); - data->irq_enabled = true; data->mode = THERMAL_DEVICE_ENABLED; ret = devm_request_threaded_irq(&pdev->dev, data->irq,