Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp438860ybt; Wed, 24 Jun 2020 03:03:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9krZxB8QZQ9SA7bzeHrf50A/vS8cvtkQJn4ysaY0N2ALK/0vGbORnPR3JUgi+flTZKM7O X-Received: by 2002:a17:907:42cb:: with SMTP id nz19mr19362135ejb.447.1592993025857; Wed, 24 Jun 2020 03:03:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592993025; cv=none; d=google.com; s=arc-20160816; b=J99QbpN8n5VDZrly1dQbCnSIN2MkCrm8Jy9NNxF510q3D86i1Gjo1n42jkPpnNfT6n ruUjFTLe+IacKVOihE7qxF3B7W+Bba/b6lMefdLUJ7JASQmRDx3jV0HWp0qRvzLjeQ80 eVT4Nu8jTCnBGvoftk1Ahc5wPPltfx4tYjlQLYw0fCy5ELH3KEpDW1LZKOiNXLOTtdS4 cObsSiFurReaL3ref1Go2Cvi8EuvcbhFN7KnPqtOUf3+5qDof9S25IwreAV8O2YhnhuC jgyDvz7ngDDk4W9asu9mKE78BM2N+t0ucA5ILk3hIi5/xja//Yjcya5T1+TKnCUjlGjT t2HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:cc:to:subject:dkim-signature :dkim-filter; bh=zS7BBcIf8Er4wztyqZriZDzfVjYDv4HA67jYgilMcYw=; b=L190mXMahr/p17F234LSL3mqQlSXEnMCLp7Sn8lRr/50wIaDw1RBaG9J9A86NW5biy P4L5DKY8CIdcmyWmV2XTfRfe6THhtbty/6tDO9HUNpXnpth/kUYrmVD4yHiouS6SJPk8 ix3HNbGhLt3FiqncAKp2WFPKtkwYW8IHGe/LNxdEeC5pP7aKNbf3oBdFfaDTN316hn0V puWdDRZXjGBTpAIVjgn86wM8rplSPKla29Yk17N04nJWSADlpAWgQf5hA99zXhQeQkRe AMffiW6ZexhPDQkEPoOddIi804PfQTnXqwwPox8ZnzEISyXNe272whxL7ahyRaiJ1b5R CieA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=UQ0QJjQg; 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=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r25si12622918edq.98.2020.06.24.03.03.19; Wed, 24 Jun 2020 03:03:45 -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=@samsung.com header.s=mail20170921 header.b=UQ0QJjQg; 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=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389959AbgFXKC0 (ORCPT + 99 others); Wed, 24 Jun 2020 06:02:26 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:38234 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387647AbgFXKCZ (ORCPT ); Wed, 24 Jun 2020 06:02:25 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200624100222euoutp011db24646a41e870db7597ae0664fc24f~bcqQ2CnEd0612406124euoutp01j; Wed, 24 Jun 2020 10:02:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200624100222euoutp011db24646a41e870db7597ae0664fc24f~bcqQ2CnEd0612406124euoutp01j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1592992942; bh=zS7BBcIf8Er4wztyqZriZDzfVjYDv4HA67jYgilMcYw=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=UQ0QJjQgi6CBTf3zF7M84ccG/AKMnIkKVBA04dSPmlhvFlgXnojIYoHSHNI8JaSlE Fv2YoH08hjijRKaHfTfPsuBrMkZE4d4ISG/Vsu1oK+IxAT8xo6RRPX8ER7ZqvnGETX I+ccM3oetX7iecJqaxxPZMQIQNUyqhZg67TmyNxU= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200624100222eucas1p10a5cfceffc5ce4734ede8694d051b79d~bcqQtEPGG1072510725eucas1p1D; Wed, 24 Jun 2020 10:02:22 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 8F.EA.06318.EA423FE5; Wed, 24 Jun 2020 11:02:22 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200624100222eucas1p11aefed06847804a9445c4c7858e0c219~bcqQOzNkS0259002590eucas1p1O; Wed, 24 Jun 2020 10:02:22 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200624100222eusmtrp18a681d259c048efb5efcaa2eb9b73532~bcqQNiFL10684506845eusmtrp1m; Wed, 24 Jun 2020 10:02:22 +0000 (GMT) X-AuditID: cbfec7f5-38bff700000018ae-35-5ef324aecf9b Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id A3.D5.06314.DA423FE5; Wed, 24 Jun 2020 11:02:22 +0100 (BST) Received: from [106.120.51.71] (unknown [106.120.51.71]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200624100220eusmtip243a748218d3af717d49d92a57478c61f~bcqOTWYY62653526535eusmtip2O; Wed, 24 Jun 2020 10:02:20 +0000 (GMT) Subject: Re: [PATCH v4 09/11] thermal: core: Stop polling DISABLED thermal devices To: Andrzej Pietrasiewicz Cc: 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, "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 , Daniel Lezcano , 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 , kernel@collabora.com From: Bartlomiej Zolnierkiewicz Message-ID: <31d0e28b-adb3-3cf6-4cd9-ce273ba94b01@samsung.com> Date: Wed, 24 Jun 2020 12:02:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20200528192051.28034-10-andrzej.p@collabora.com> Content-Language: en-US Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA02Ta0ybZRTHfd5rKZa86y48Mi+xislQxwx+OFGziG7x/aTMLHExyOzYG0Ch LC0U2GLW6dhGw1gHG2DF2U2kFxVoYaXdWDNhFrVb3WYkslFXLmpRyqCdlxJXbPuyyLf//5zf ec4leSSk3MBmScpUVYJapSxXMFLK6Y35n+5+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OBw6kmVFY6t4t7 7qNnn3L0z/6jC7W9HRrR1hG7H/juf7Yn/TVHQ6LLWnY2zVp+pnuj99ImlHT8xYtVueqdKzi3 Ij9Sn3r9D/ewaLFefPOT7+SUWKRRppMGUfMvOAcie7QDAAA= X-CMS-MailID: 20200624100222eucas1p11aefed06847804a9445c4c7858e0c219 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200528192216eucas1p19e192fbee4848c95c4077b10c46d8017 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200528192216eucas1p19e192fbee4848c95c4077b10c46d8017 References: <20200528192051.28034-1-andrzej.p@collabora.com> <20200528192051.28034-10-andrzej.p@collabora.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 5/28/20 9:20 PM, Andrzej Pietrasiewicz wrote: > Polling DISABLED devices is not desired, as all such "disabled" devices > are meant to be handled by userspace. This patch introduces and uses > should_stop_polling() to decide whether the device should be polled or not. > > Signed-off-by: Andrzej Pietrasiewicz Reviewed-by: Bartlomiej Zolnierkiewicz Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics > --- > drivers/thermal/thermal_core.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c > index 14baf0288759..e9c0b990e4a9 100644 > --- a/drivers/thermal/thermal_core.c > +++ b/drivers/thermal/thermal_core.c > @@ -301,13 +301,22 @@ static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, > cancel_delayed_work(&tz->poll_queue); > } > > +static inline bool should_stop_polling(struct thermal_zone_device *tz) > +{ > + return !thermal_zone_device_is_enabled(tz); > +} > + > static void monitor_thermal_zone(struct thermal_zone_device *tz) > { > + bool stop; > + > + stop = should_stop_polling(tz); > + > mutex_lock(&tz->lock); > > - if (tz->passive) > + if (!stop && tz->passive) > thermal_zone_device_set_polling(tz, tz->passive_delay); > - else if (tz->polling_delay) > + else if (!stop && tz->polling_delay) > thermal_zone_device_set_polling(tz, tz->polling_delay); > else > thermal_zone_device_set_polling(tz, 0); > @@ -517,6 +526,9 @@ void thermal_zone_device_update(struct thermal_zone_device *tz, > { > int count; > > + if (should_stop_polling(tz)) > + return; > + > if (atomic_read(&in_suspend)) > return; > >