Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1671372ybt; Thu, 2 Jul 2020 10:53:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymBmzDoNlA24bXYzV3dkDrVO+EpcOp+57Vp5F2kqhizXN0XOTOhqjXdgRYN61/GykryQah X-Received: by 2002:a50:ab5c:: with SMTP id t28mr35992010edc.209.1593712387396; Thu, 02 Jul 2020 10:53:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593712387; cv=none; d=google.com; s=arc-20160816; b=UkVMjH07RJm0IB6klNkj1EQEiIS2HC7ZL6sQ9SyrT6FkI2+FbSlAyIxG7kZ8EMCAx2 QWnqZ6SeCGuqo5vyIzPhzR+yCzUV+SFOBO+26ls1KNGh/jEAQGT4PLH5xByBaTdJSh6s lUJ2jaIrfU/QT0XomfU8xacCb0zvx+sQTlWcSSRBnReaocQ7fN22DU68UMrH4UzSBc/A 2ioAQZtoSRb1BkKtD6414a5H5cuyAuBmUcxbC87ftj1gPKhWPD2KcWbtAudUEkb89Cp0 Rflz8P6jT3OGl/of8jglitjEfdaHqAyGj+pKNWiBdcDfm2k1lcn9prtrPJRu0IfAucLQ 3SDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature; bh=oglYmDMJJsMPIXYV1ITcnNL4FWv5Lg95ZCqCfgcjHUs=; b=scA6Oy+MDxVD3ob5e1CQL50SI8t0P2aBi5e5+5uCR+p3r58gX+gCb+8yvbgxQ++Bqm 18AOP69csXqCIwsI2Xlo2V3nMh4a45YiUWAye706LYgZY3k6424z2mkqxRr9xcSCE+KM 8Wjfp1OW+prx1SGuk55FlJHwwsq0jKFwf6RyXALBeFasWToU+yp22xQxNXIP95/yyoxT BdFvMvExBvjnmwTsVvQMYhqg9zrdm/DdC2goWtOLSrEFWLclx+i+xFAnRRysYRZ9MFJx XNfBoa+ofJyNYEsPtPoS16FTVnrHprBw/ft0lcmA/LyyIVbtDLNsFpbXUUiXtWyBPlBm EB5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eCKvFL3y; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e20si6320995edv.26.2020.07.02.10.52.44; Thu, 02 Jul 2020 10:53:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eCKvFL3y; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726980AbgGBRwZ (ORCPT + 99 others); Thu, 2 Jul 2020 13:52:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727773AbgGBRwY (ORCPT ); Thu, 2 Jul 2020 13:52:24 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A456C08C5DF for ; Thu, 2 Jul 2020 10:52:24 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id l17so28081465wmj.0 for ; Thu, 02 Jul 2020 10:52:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=oglYmDMJJsMPIXYV1ITcnNL4FWv5Lg95ZCqCfgcjHUs=; b=eCKvFL3ymp9ODmh1kib4C/AcPrCHfUe4eQkI84tWMNstC588Mcs/UzyYV+30IgEPIB lfn4BGs06fAPfloAK0p40cJ3BQEuYzsfHY7d9o5Wr4ZrXyQrqXhtnG6F3jFX42w8e/2m weKvXoukAneezHhMB60mGihkb8pcI/kk8sZmWoEft2bkOnM2yQyw4RX50kJPE3J+9MnN fQinPrGJq2HYROL7Dl9fLIK+uTW325NDPRzeAtAAM2vhot8J8DATGO6hnDZGucHe9Jjs qXs+mG8rCVEuhGXBHfDtewoYJIa2KlLkJMQg70p6vJf/FdlJAKW6C6ggeDUiANRQMAFK P1Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=oglYmDMJJsMPIXYV1ITcnNL4FWv5Lg95ZCqCfgcjHUs=; b=Nd7g7UECq3YnQ8RVH9bJ/WafBXsjbOjtNOCDPekieBFvKFXu1Ob7coC0eikaKQECss K57iHFbHEsy9lSxMLOXVmBBX5kUlYazAyFtj6/WzMXdATv5qKiRR+pafn8McULjC4569 Q4ARRWNoh4RiHZGWEPTaMno0nsH9PlXHDJT3yOXxpf+n+Iznl9IiYRWh3Oj1qi0738ZU rMeG9IhZO5MBhB06ZRRNgcR2mtFkuRIHyhePgXdIPLWIeHGp6M7ye7XbZ7UmXilrBkEb KdALUP/VmZOehNYgbLQ6/6Tdb4VCwH3NYQPF3rfQyxZiIYBpFp+eZd4k6ddgo7dkrbXZ I4cA== X-Gm-Message-State: AOAM5338yUBRovbeNZ3ftMIFxN+/TSl6iggyhlaiVHr/XVA67nf4I7ZS a5XKDBm7NdGtT5uLGJWEcx+eVA== X-Received: by 2002:a7b:c041:: with SMTP id u1mr34629911wmc.56.1593712342780; Thu, 02 Jul 2020 10:52:22 -0700 (PDT) Received: from ?IPv6:2a01:e34:ed2f:f020:c88a:7b2b:a4a1:46d0? ([2a01:e34:ed2f:f020:c88a:7b2b:a4a1:46d0]) by smtp.googlemail.com with ESMTPSA id h2sm11232487wrw.62.2020.07.02.10.52.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Jul 2020 10:52:22 -0700 (PDT) Subject: Re: [PATCH v7 00/11] Stop monitoring disabled devices From: Daniel Lezcano To: Andrzej Pietrasiewicz , linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org Cc: "Rafael J . Wysocki" , Len Brown , Vishal Kulkarni , "David S . Miller" , Jiri Pirko , Ido Schimmel , Johannes Berg , Emmanuel Grumbach , Luca Coelho , Intel Linux Wireless , Kalle Valo , Peter Kaestle , Darren Hart , Andy Shevchenko , Sebastian Reichel , Miquel Raynal , Amit Kucheria , Support Opensource , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , =?UTF-8?Q?Niklas_S=c3=b6derlund?= , Heiko Stuebner , Orson Zhai , Baolin Wang , Chunyan Zhang , Zhang Rui , Allison Randal , Enrico Weigelt , Gayatri Kammela , Thomas Gleixner , Bartlomiej Zolnierkiewicz , kernel@collabora.com References: <20200629122925.21729-1-andrzej.p@collabora.com> <3d03d1a2-ac06-b69b-93cb-e0203be62c10@collabora.com> <47111821-d691-e71d-d740-e4325e290fa4@linaro.org> <4353a939-3f5e-8369-5bc0-ad8162b5ffc7@linaro.org> <73942aea-ae79-753c-fe90-d4a99423d548@collabora.com> <374dddd9-b600-3a30-d6c3-8cfcefc944d9@linaro.org> <5a28deb7-f307-8b03-faad-ab05cb8095d1@collabora.com> <8aeb4f51-1813-63c1-165b-06640af5968f@linaro.org> <685ef627-e377-bbf1-da11-7f7556ca2dd7@collabora.com> Message-ID: Date: Thu, 2 Jul 2020 19:52:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 02/07/2020 19:49, Daniel Lezcano wrote: [ ... ] >> Thanks! >> >> That confirms your suspicions. >> >> So the reason is that ->get_temp() is called while the mutex is held and >> thermal_zone_device_is_enabled() wants to take the same mutex. > > Yes, that's correct. > >> Is adding a comment to thermal_zone_device_is_enabled() to never call >> it while the mutex is held and adding another version of it which does >> not take the mutex ok? > > The thermal_zone_device_is_enabled() is only used in two places, acpi > and this imx driver, and given: > > 1. as soon as the mutex is released, there is no guarantee the thermal > zone won't be changed right after, the lock is pointless, thus the > information also. > > 2. from a design point of view, I don't see why a driver should know if > a thermal zone is disabled or not > > It would make sense to end with this function and do not give the > different drivers an opportunity to access this information. > > Why not add change_mode for the acpi in order to enable or disable the > events and for imx_thermal use irq_enabled flag instead of the thermal > zone mode? Moreover it is very unclear why this function is needed in > imx_get_temp(), and I suspect we should be able to get rid of it. If you agree with that you can send a patch on top of your series so I can test it fixes the imx platform. -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog